Skip to content

Commit db701c2

Browse files
committed
Auto merge of rust-lang#124166 - oli-obk:define_opaque_types11, r=compiler-errors
Let inherent associated types constrain opaque types during projection r? `@compiler-errors` The same test ICEs on master: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f4ff62663a5a3a0e16d00953ee7414d5
2 parents f9b1614 + dadece0 commit db701c2

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

compiler/rustc_trait_selection/src/traits/project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ pub fn compute_inherent_assoc_ty_args<'a, 'b, 'tcx>(
641641
);
642642
}
643643

644-
match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, impl_ty, self_ty) {
644+
match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::Yes, impl_ty, self_ty) {
645645
Ok(mut ok) => obligations.append(&mut ok.obligations),
646646
Err(_) => {
647647
tcx.dcx().span_bug(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ check-pass
2+
3+
#![feature(inherent_associated_types, type_alias_impl_trait)]
4+
#![allow(incomplete_features)]
5+
6+
struct Foo<T>(T);
7+
8+
impl Foo<i32> {
9+
type Assoc = u32;
10+
}
11+
12+
type Tait = impl Sized;
13+
14+
fn bar(_: Tait) {
15+
let x: Foo<Tait>::Assoc = 42;
16+
}
17+
18+
fn main() {}

0 commit comments

Comments
 (0)