Skip to content

Commit c8d3ed5

Browse files
committed
Add a regression test and fix it.
1 parent 6ed1cc5 commit c8d3ed5

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Diff for: compiler/rustc_codegen_ssa/src/mir/place.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
463463
mir::ProjectionElem::Field(ref field, _) => {
464464
cg_base.project_field(bx, field.index())
465465
}
466-
mir::ProjectionElem::OpaqueCast(ty) => cg_base.project_type(bx, ty),
466+
mir::ProjectionElem::OpaqueCast(ty) => {
467+
cg_base.project_type(bx, self.monomorphize(ty))
468+
}
467469
mir::ProjectionElem::Index(index) => {
468470
let index = &mir::Operand::Copy(mir::Place::from(index));
469471
let index = self.codegen_operand(bx, index);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-pass
2+
// edition: 2021
3+
4+
#![feature(type_alias_impl_trait)]
5+
6+
fn foo<T>(x: T) {
7+
type Opaque<T> = impl Sized;
8+
let foo: Opaque<T> = (x,);
9+
let (a,): (T,) = foo;
10+
}
11+
12+
fn main() {
13+
foo::<u32>(1);
14+
}

0 commit comments

Comments
 (0)