Skip to content

Commit dadece0

Browse files
committed
Let inherent associated types constrain opaque types during projection
1 parent 07d0d7c commit dadece0

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)