Skip to content

Commit

Permalink
Add a regression test and fix it.
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Sep 27, 2023
1 parent 6ed1cc5 commit c8d3ed5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
mir::ProjectionElem::Field(ref field, _) => {
cg_base.project_field(bx, field.index())
}
mir::ProjectionElem::OpaqueCast(ty) => cg_base.project_type(bx, ty),
mir::ProjectionElem::OpaqueCast(ty) => {
cg_base.project_type(bx, self.monomorphize(ty))
}
mir::ProjectionElem::Index(index) => {
let index = &mir::Operand::Copy(mir::Place::from(index));
let index = self.codegen_operand(bx, index);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// build-pass
// edition: 2021

#![feature(type_alias_impl_trait)]

fn foo<T>(x: T) {
type Opaque<T> = impl Sized;
let foo: Opaque<T> = (x,);
let (a,): (T,) = foo;
}

fn main() {
foo::<u32>(1);
}

0 comments on commit c8d3ed5

Please sign in to comment.