Skip to content

Fix three constructor-discovery ICEs from the crates.io sweep - #4725

Merged
feliperodri merged 1 commit into
model-checking:mainfrom
tautschnig:ctor-pr-fixes
Aug 26, 2026
Merged

Fix three constructor-discovery ICEs from the crates.io sweep#4725
feliperodri merged 1 commit into
model-checking:mainfrom
tautschnig:ctor-pr-fixes

Conversation

@tautschnig

Copy link
Copy Markdown
Member

Stacked on #4717 (--constructor-args); only the last commit is new. Marked draft until #4717 merges.

A top-500 crates.io autoharness sweep (tracking #3832) ICEd in constructor discovery on 12 crates; three root causes:

  1. Item own lifetimes (brotli, sharded-slab): AtomicU8::from_ptr<'a>-style constructors were resolved with the ADT args only — arity mismatch panic.
  2. Lifetime position (regex-automata, gimli, redox_syscall, arc-swap, clap_builder, event-listener, crypto-bigint): impl<'h> Searcher<'h> places the lifetime first, so appending erased lifetimes is insufficient — the argument list is now built positionally against the item's full parent+own generics, rejecting shape mismatches up front (rustc's instantiation panics on kind mismatches rather than returning Err).
  3. Escaping bound regions (async-io, js-sys, quinn-udp, wasm-bindgen): BorrowedFd<'_>-style arguments read from a skipped fn-sig binder panicked the trait solver's dummy-binder wrap; such candidates are rejected as non-generatable.

All 12 crates verified clean with this branch. The constructor regression test gains all three shapes.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@github-actions github-actions Bot added Z-EndToEndBenchCI Tag a PR to run benchmark CI Z-CompilerBenchCI Tag a PR to run benchmark CI labels Aug 7, 2026
@feliperodri
feliperodri marked this pull request as ready for review August 25, 2026 21:06
@feliperodri
feliperodri requested review from a team as code owners August 25, 2026 21:06
@feliperodri feliperodri added the Z-Autoharness Issue related to autoharness subcommand label Aug 25, 2026
@feliperodri feliperodri added this to the Autoharness milestone Aug 25, 2026
Surfaced by a top-500 crates.io autoharness sweep (12 crates affected):

1. Items with their own early-bound lifetimes (AtomicU8::from_ptr<'a>)
   were resolved with the ADT args only, panicking on the arity mismatch
   (brotli, sharded-slab).
2. Lifetime-parameterized impls place lifetimes anywhere in the generics
   order (impl<'h> Searcher<'h> in regex-automata; also gimli,
   redox_syscall, arc-swap, clap_builder, event-listener, crypto-bigint),
   so appending erased lifetimes is not enough: build the argument list
   positionally against the item's full parent+own generics, rejecting
   the constructor when counts or kinds do not fit (rustc's instantiation
   panics on kind mismatches rather than returning Err).
3. Constructor arguments carrying escaping late-bound regions inside ADTs
   (BorrowedFd<'_> in async-io, js-sys, quinn-udp, wasm-bindgen) panicked
   the trait solver's dummy-binder wrap; such arguments are not
   generatable, so reject the candidate up front.

The constructor regression test gains all three shapes.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 13:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@feliperodri
feliperodri enabled auto-merge August 26, 2026 14:04
@feliperodri
feliperodri added this pull request to the merge queue Aug 26, 2026
Merged via the queue into model-checking:main with commit 406e7ba Aug 26, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-Autoharness Issue related to autoharness subcommand Z-CompilerBenchCI Tag a PR to run benchmark CI Z-EndToEndBenchCI Tag a PR to run benchmark CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants