Skip to content

Structurally resolve in probe_adt #133558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _)
if !ty.has_escaping_bound_vars() =>
Copy link
Member Author

Choose a reason for hiding this comment

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

this is scuffed lol

Copy link
Contributor

Choose a reason for hiding this comment

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

yes :3, we could try to use with_replaced_escaping_bound_vars, but also, I dislike the fact that we're normalizing here in the first place :<

Copy link
Member Author

Choose a reason for hiding this comment

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

well, we need to normalize here so we can determine the adt. but yeah, i'm gonna leave it.

{
self.normalize(span, ty).ty_adt_def()
if self.next_trait_solver() {
self.try_structurally_resolve_type(span, ty).ty_adt_def()
} else {
self.normalize(span, ty).ty_adt_def()
}
}
_ => None,
}
Expand Down
15 changes: 0 additions & 15 deletions tests/crashes/132320.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ check-pass
//@ compile-flags: -Znext-solver

trait Mirror {
type Assoc;
}
impl<T> Mirror for T {
type Assoc = T;
}

type Foo<T> = <Option<T> as Mirror>::Assoc;

fn main() {
let x = Foo::<i32>::None;
}
Loading