Skip to content

fix: add CoroutineClosure to closure_span_overlaps_error#487

Open
SebTardif wants to merge 133 commits into
mainfrom
fix-closure-span-overlaps-coroutine-closure
Open

fix: add CoroutineClosure to closure_span_overlaps_error#487
SebTardif wants to merge 133 commits into
mainfrom
fix-closure-span-overlaps-coroutine-closure

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Fixes #484

closure_span_overlaps_error matches ty::Closure and ty::Coroutine but misses ty::CoroutineClosure. For async closures with signature mismatch errors, the function fails to recognize the type and returns false, causing the fulfillment error adjustment to skip the closure. This leads to less precise error messages.

Adds ty::CoroutineClosure(def_id, _) to the match arm.

asomers and others added 30 commits January 14, 2026 11:17
The current Linux driver treats every sendmsg call as a separate record.
That is, it behaves as though MSG_EOR is always set.  But that might not
be true forever.  And the current FreeBSD driver does _not_ do that, so
setting MSG_EOR is important for portability.
* Handle generic reborrow in expression-use adjustment walking
* Require generic reborrow to be terminal in adjustment walks
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
Co-authored-by: Kevin Reid <kpreid@switchb.org>
Co-authored-by: Kevin Reid <kpreid@switchb.org>
LLVM 23 recently changed SimplifyCFG to avoid integer lookup tables, and
that perturbed these two tests in ways that look harmless to me.
Co-authored-by: Alice Ryhl <aliceryhl@google.com>
When a `for` loop is missing its `in`, the parser suggested inserting one
based only on the token after the pattern. A malformed binding such as
`for i i in 0..10` was therefore "corrected" to `for i in i in 0..10`,
which does not parse. Only suggest inserting `in` when the loop header
does not already contain one before the body.
Document the built-in `must_use` attribute in the standard library using
the `#[doc(attribute = "...")]` mechanism, following the existing
`keyword_docs.rs` pattern.
When passing multiple `-Zsanitizer` flags to the compiler (e.g.,
`-Zsanitizer=address -Zsanitizer=shadow-call-stack`), the options parser
was overwriting the previous values in `target_modifiers` instead of
accumulating them. This resulted in only the last sanitizer being
recorded in the crate metadata's target modifiers, even though the
frontend correctly enabled all of them.

The only way to provide multiple sanitizers was to combine them into a
comma-separated list passed to a single `-Zsanitizer=` flag, but this
does not fit well into the GN build system where different targets may
pass different combinations of sanitizer flags.

Consequently, this caused spurious "incompatible target modifiers"
ABI mismatch errors when linking against dependencies compiled with
accumulated flags (e.g., `-Zsanitizer=address,shadow-call-stack`).

Fix this by entry-modifying the `target_modifiers` map to accumulate
the sanitizers as a comma-separated list when the option is
`sanitizer`.

Also add a codegen test verifying that both CFI and SafeStack
attributes/metadata are present when enabled together via multiple
flags.

Test: ./x.py test tests/codegen-llvm/sanitizer/multiple-sanitizers.rs
To get a `LintVec` for a lint pass we sometimes use `get_lints` and
sometimes use `lint_vec`. It would be nice to only have one, but doing
that is tricky.

In the meantime, this commit makes the naming more consistent.
- By always using the name `get_lints` for the methods that take `self`.
- By always using the name `lint_vec` for the methods that have no
  parameters.
These are both types that impl `LintPass` but in a degenerate way: only
the `lint_vec` method is ever used. This commit changes them to just be
a `lint_vec` function in an appropriately-named module.

The commit also removes the use of `HardwiredLints` in
`late_lint_crate`, which had no effect because all the
`HardwiredLints::check_*` methods were no-ops.
GuillaumeGomez and others added 25 commits June 18, 2026 20:30
…ee1-dead

Reject `impl const Trait` since the right syntax is `const impl Trait` now

I also let some smaller rustfmting of ui tests through, as rustfmt immediately formats `impl const Trait` to `const impl Trait`. This is also the reason I expect that this change will break very little nightly users, so we don't even need to add some helpful diagnostic.

r? @fee1-dead
…orrow-source-unsafety, r=dingxiangfei2009

Fix reborrow source expression visits

Fixes rust-lang#158033
Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103

thin-vec versions before 0.2.16 have a use-after-free / double-free in `IntoIter::drop` and `ThinVec::clear` when an element's `Drop` panics ([RUSTSEC-2026-0103](https://rustsec.org/advisories/RUSTSEC-2026-0103)).

This bumps the requirement in the compiler crates from `0.2.15` to `0.2.18` and updates `Cargo.lock` accordingly, moving past the affected range.
…rrors, r=Darksonn

Document transient connection errors from TcpListener::accept

`TcpListener::accept` can return an error that belongs to a single incoming
connection, not to the listener, for example a connection aborted by the peer
before it could be accepted (`ConnectionAborted`). The listener stays usable, so
a server looping over connections usually wants to log the error and keep
accepting rather than treat it as fatal. This was not documented, and the
`incoming` example treated every error as a failed connection.

This implements the libs-team decision in rust-lang#142557: document these transient
errors instead of changing `accept` to retry them, since retrying would hide
errors that some callers want to observe.

Changes:
- Add an `# Errors` section to `accept` describing this behavior, without
  listing specific error codes since some may be more permanent than others.
- Note that `Interrupted` errors are retried internally on Unix.
- Add the same pointer to `incoming` and `into_incoming`, which are `accept`
  in a loop.

Addresses rust-lang#142557.

r? rust-lang/libs
…llaumeGomez

rustdoc-json-types: Replace bincode dev-dependency with postcard

bincode is flagged as unmaintained by [RUSTSEC-2025-0141](https://rustsec.org/advisories/RUSTSEC-2025-0141), and the advisory covers the entire crate with no patched version available. The only use in `rustdoc-json-types` was the binary serde roundtrip in the type tests.

[postcard](https://crates.io/crates/postcard) is a maintained serde-based binary serialization format that covers the same roundtrip testing need.

bincode is still pulled in transitively by the miri subtree (via `ipc-channel`), which needs to be [addressed upstream](rust-lang/miri#5115).

### Related

- rust-lang/miri#5115
renovate: Loosen dashboard approval and adopt recommended config

Follow-up tweaks to the Renovate config now that the GitHub Actions setup has proven stable.

- GitHub Actions updates no longer need Dependency Dashboard approval. The gate was added while we dialed in the config, and the `github-actions` manager now works well enough for those PRs to open on their own. Everything else still requires approval.
- Monthly lock file maintenance is now enabled. It stays behind dashboard approval for the time being.
- The config extends [`config:recommended`](https://docs.renovatebot.com/presets-config/#configrecommended), which brings changelog links, sensible grouping, `replacements` and `workarounds`. That makes the previously explicit `dependencyDashboard: true` redundant, so it's gone.
- Config migration PRs are enabled so Renovate can keep the config up to date as options get deprecated.
…o-no-opt, r=lqd

codegen_ssa: no dbginfo for scalable vec local w/ `-O0`

LLVM uses GlobalISel with `-O0` that doesn't support scalable vectors. It normally falls back to SDAG which does support scalable vectors, but there's a bug that means that isn't happening for debuginfo - so temporarily don't emit debuginfo for scalable vector locals when there are no optimisations until that bug is fixed.

cc llvm/llvm-project#204585
cc rust-lang/stdarch#2160

r? @lqd
… r=Urgau

Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro

Fixes rust-lang#158050.

The problem is that the proc-macros might generate an impl block `impl $(trait)? for Item` where `Item` then has its span pointing to the current item, overwriting its intra-doc link (hopefully this explanation makes sense ^^').

In short, the proc-macro generates an impl block, the `for Item` makes the code enter `visit_qpath` which in turn calls `handle_path` which will take the span of the last segment of the path (so `Item` here) and use it in the link def "span map".

r? @Urgau
…llaumeGomez

Rollup of 12 pull requests

Successful merges:

 - rust-lang#156795 (Handle generic reborrow in expression-use adjustment walking)
 - rust-lang#157694 (Enhance documentation on wake call memory ordering)
 - rust-lang#157935 (Make `proc_macro::ConversionErrorKind` non exhaustive)
 - rust-lang#158002 (Replace `unwrap` with `expect` in `get_module_children`)
 - rust-lang#158009 (Reject `impl const Trait` since the right syntax is `const impl Trait` now)
 - rust-lang#158034 (Fix reborrow source expression visits)
 - rust-lang#158072 (Bump thin-vec to 0.2.18 to address RUSTSEC-2026-0103)
 - rust-lang#158074 (Document transient connection errors from TcpListener::accept)
 - rust-lang#158077 (rustdoc-json-types: Replace bincode dev-dependency with postcard)
 - rust-lang#158086 (renovate: Loosen dashboard approval and adopt recommended config)
 - rust-lang#158088 (codegen_ssa: no dbginfo for scalable vec local w/ `-O0`)
 - rust-lang#158089 (Fix invalid "jump-to-def" doc link generation when an item has a `derive` proc-macro)
There's no need to jump through all the hoops of `set` when we are
creating a new `OnceLock` from scratch.
…no-range-check, r=petrochenkov

`RegionValues`: disable unnecessary range check

Currently, when adding liveness points to region values in the `RegionValues` struct, the locations of the points are checked for ranges. This is unnecessarily cautious because they always are in range by construction. The docstring for the method used in the checks suggests that it was designed for underlying bit sets that currently aren't used for this.

This adds documentation (including debug assertions) to make this clearer and removes the checks, which should have a strictly positive impact on performance.
Initialize directly in `From<T> for OnceLock<T>`

There's no need to jump through all the hoops of `set` when we are
creating a new `OnceLock` from scratch.
It only has two impls, both of which are tuples, which is ugly. An enum
is much simpler and clearer.

Also, `EarlyContextAndPass` doesn't need to be public.
Rollup of 2 pull requests

Successful merges:

 - rust-lang#158026 (`RegionValues`: disable unnecessary range check)
 - rust-lang#158101 (Initialize directly in `From<T> for OnceLock<T>`)
Add `#[rustc_dump_generics]` attribute





Added a rustc attribute to dump the generic parameters of a given item to the compiler output.
This means you can now use remote-test-client/remote-test-server
with targets that contain a '.' in the name.

See rust-lang#158090
…=jhpratt

`impl [const] Default for BTreeMap`

Tracking issue: rust-lang#143894.
Codegen ctors in Runtime mir phase

https://github.com/rust-lang/rust/pull/156141/changes#diff-f18405dedc545b19aa3ee04cd08b17e1e0fa1b5876e46c6b445eaaa7e54618eaR421

(part of rust-lang#156141)

The mir of constructors used to be generated in MirPhase::Built, but are only used during codegen. That means they'd have a weird MirPhase, since all other items have MirPhase::Runtime during codegen. This PR still generates ctor mir in MirPhase::Built, but then immediately does a phase change to Runtime after running no passes.

Fixes rust-lang#158037

<summary>

Old description of another, worse way to solve this

<details>

starts using `TypingMode::PostTypeckUntilBorrowck` during mir building with the next solver. This is the right typing mode, and the typing mode contains a list of opaque types. However, previously, we instead just used `TypingMode::Typeck` with an empty list of opaques. That is the wrong typing mode, but it also meant we collected opaque types of slightly fewer things. Now that we do collect their opaque types, we're doing so for items that we've never gathered opaque types for before and get an ICE.

There are no tests associated with this change. @lqd tried to reproduce it, but it seems surprisingly hard except by bootstrapping rustc itself. This change makes `RUSTFLAGS_NOT_BOOTSTRAP=-Znext-solver x build compiler --stage 2` work, which I verified locally. See [#t-infra/announcements > Next solver / polonius alpha pre-stabilization CI job](https://rust-lang.zulipchat.com/#narrow/channel/533458-t-infra.2Fannouncements/topic/Next.20solver.20.2F.20polonius.20alpha.20pre-stabilization.20CI.20job/with/602503884) for work towards making bootstraps with the next solver a CI job.

</details>

</summary>

r? @oli-obk
…ss35

Stabilize `substr_range` and `subslice_range`

Closes rust-lang#126769

[Stabilization Report](rust-lang#126769 (comment))
…o-enum, r=Urgau

Change `EarlyCheckNode` from a trait to an enum.

It only has two impls, both of which are tuples, which is ugly. An enum is much simpler and clearer.

Also, `EarlyContextAndPass` doesn't need to be public.

r? @Urgau
…, r=Kobzol

Convert '.' to '_' in bootstrap envify

This means you can now use remote-test-client/remote-test-server with targets that contain a '.' in the name.

See rust-lang#158090

r? @Kobzol
…nathanBrouwer

Rollup of 5 pull requests

Successful merges:

 - rust-lang#157878 (`impl [const] Default for BTreeMap`)
 - rust-lang#158040 (Codegen ctors in Runtime mir phase)
 - rust-lang#141266 (Stabilize `substr_range` and `subslice_range`)
 - rust-lang#158109 (Change `EarlyCheckNode` from a trait to an enum.)
 - rust-lang#158118 (Convert '.' to '_' in bootstrap envify)
Fixes #484

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif SebTardif added bug Something isn't working I-wrong Wrong result or data corruption P-low Low impact: edge case or niche scenario A-diagnostics Compiler diagnostics A-type-system Type system labels Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-diagnostics Compiler diagnostics A-type-system Type system bug Something isn't working I-wrong Wrong result or data corruption P-low Low impact: edge case or niche scenario

Projects

None yet

Development

Successfully merging this pull request may close these issues.

closure_span_overlaps_error missing CoroutineClosure, worse async closure diagnostics