Skip to content

layout_of unexpected rigid alias delayed bug#152575

Open
lcnr wants to merge 2 commits intorust-lang:mainfrom
lcnr:layout-error-to-delayed-bug
Open

layout_of unexpected rigid alias delayed bug#152575
lcnr wants to merge 2 commits intorust-lang:mainfrom
lcnr:layout-error-to-delayed-bug

Conversation

@lcnr
Copy link
Contributor

@lcnr lcnr commented Feb 13, 2026

fixes #152545. The trait solver can keep aliases as rigid even if they are not well-formed

if !cx.has_item_definition(target_item_def_id) {
// If the impl is missing an item, it's either because the user forgot to
// provide it, or the user is not *obligated* to provide it (because it
// has a trivially false `Sized` predicate). If it's the latter, we cannot
// delay a bug because we can have trivially false where clauses, so we
// treat it as rigid.
if cx.impl_self_is_guaranteed_unsized(impl_def_id) {
match ecx.typing_mode() {
// Trying to normalize such associated items is always ambiguous
// during coherence to avoid cyclic reasoning. See the example in
// tests/ui/traits/trivial-unsized-projection-in-coherence.rs.
//
// As this ambiguity is unavoidable we emit a nested ambiguous
// goal instead of using `Certainty::AMBIGUOUS`. This allows us to
// return the nested goals to the parent `AliasRelate` goal. This
// would be relevant if any of the nested goals refer to the `term`.
// This is not the case here and we only prefer adding an ambiguous
// nested goal for consistency.
ty::TypingMode::Coherence => {
ecx.add_goal(GoalSource::Misc, goal.with(cx, PredicateKind::Ambiguous));
return then(ecx, Certainty::Yes);
}
ty::TypingMode::Analysis { .. }
| ty::TypingMode::Borrowck { .. }
| ty::TypingMode::PostBorrowckAnalysis { .. }
| ty::TypingMode::PostAnalysis => {
ecx.structurally_instantiate_normalizes_to_term(
goal,
goal.predicate.alias,
);
return then(ecx, Certainty::Yes);

r? types

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. beta-nominated Nominated for backporting to the compiler in the beta channel. labels Feb 13, 2026
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the layout-error-to-delayed-bug branch from 53fe5ec to b3d9fbc Compare February 13, 2026 13:51
@jackh726
Copy link
Member

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 13, 2026

📌 Commit b3d9fbc has been approved by jackh726

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 14, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 14, 2026
Rollup of 11 pull requests

Successful merges:

 - #151998 (Set hidden visibility on naked functions in compiler-builtins)
 - #149460 (rustdoc: sort stable items first)
 - #152076 (Feed `ErrorGuaranteed` from late lifetime resolution errors through to bound variable resolution)
 - #152471 (improve associated-type suggestions from bounds)
 - #152573 (move `escape_symbol_name` to `cg_ssa`)
 - #152594 (c-variadic: implement `va_arg` for `wasm64`)
 - #151386 (rustdoc: more js cleanup)
 - #152567 (nix-dev-shell: fix a typo)
 - #152568 (Port `#[lang]` and `#[panic_handler]` to the new attribute parsers)
 - #152575 (layout_of unexpected rigid alias delayed bug)
 - #152587 (A couple of tiny polonius things)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: invalid rigid alias in layout_of after normalization

5 participants