Skip to content
/ rust Public
forked from rust-lang/rust

Commit dd03d84

Browse files
authored
Rollup merge of rust-lang#133558 - compiler-errors:structurally-resolve-probe-adt, r=lcnr
Structurally resolve in `probe_adt` fixes rust-lang#132320 r? lcnr
2 parents 90b30d4 + 0609b99 commit dd03d84

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,11 @@ impl<'tcx> HirTyLowerer<'tcx> for FnCtxt<'_, 'tcx> {
307307
ty::Alias(ty::Projection | ty::Inherent | ty::Weak, _)
308308
if !ty.has_escaping_bound_vars() =>
309309
{
310-
self.normalize(span, ty).ty_adt_def()
310+
if self.next_trait_solver() {
311+
self.try_structurally_resolve_type(span, ty).ty_adt_def()
312+
} else {
313+
self.normalize(span, ty).ty_adt_def()
314+
}
311315
}
312316
_ => None,
313317
}

tests/crashes/132320.rs

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ check-pass
2+
//@ compile-flags: -Znext-solver
3+
4+
trait Mirror {
5+
type Assoc;
6+
}
7+
impl<T> Mirror for T {
8+
type Assoc = T;
9+
}
10+
11+
type Foo<T> = <Option<T> as Mirror>::Assoc;
12+
13+
fn main() {
14+
let x = Foo::<i32>::None;
15+
}

0 commit comments

Comments
 (0)