From 5cd8a2addaf4aae55c52fb9af5fdb36243295070 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Thu, 10 Mar 2022 16:19:33 +0100 Subject: debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments. --- src/test/debuginfo/type-names.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/test/debuginfo') diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index c9692128562..e6ec6ef62b8 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -122,6 +122,9 @@ // gdb-command:whatis has_associated_type_trait // gdb-check:type = &(dyn type_names::Trait3 + core::marker::Send) +// gdb-command:whatis has_associated_type_but_no_generics_trait +// gdb-check:type = &dyn type_names::TraitNoGenericsButWithAssocType + // BARE FUNCTIONS // gdb-command:whatis rust_fn // gdb-check:type = (fn(core::option::Option, core::option::Option<&type_names::mod1::Struct2>), usize) @@ -228,6 +231,7 @@ // cdb-check:struct ref_mut$ > mut_ref_trait = [...] // cdb-check:struct alloc::boxed::Box,alloc::alloc::Global> no_principal_trait = [...] // cdb-check:struct ref$ >,core::marker::Send> > has_associated_type_trait = struct ref$ >,core::marker::Send> > +// cdb-check:struct ref$ > > > has_associated_type_but_no_generics_trait = struct ref$ > > > // BARE FUNCTIONS // cdb-command:dv /t *_fn* @@ -318,12 +322,22 @@ trait Trait3 { panic!() } } +trait TraitNoGenericsButWithAssocType { + type Output; + fn foo(&self) -> Self::Output; +} impl Trait1 for isize {} impl Trait2 for isize {} impl Trait3 for isize { type AssocType = isize; } +impl TraitNoGenericsButWithAssocType for isize { + type Output = isize; + fn foo(&self) -> Self::Output { + *self + } +} fn rust_fn(_: Option, _: Option<&mod1::Struct2>) {} extern "C" fn extern_c_fn(_: isize) {} @@ -414,6 +428,8 @@ fn main() { let mut_ref_trait = (&mut mut_int1) as &mut dyn Trait1; let no_principal_trait = Box::new(0_isize) as Box<(dyn Send + Sync)>; let has_associated_type_trait = &0_isize as &(dyn Trait3 + Send); + let has_associated_type_but_no_generics_trait = + &0_isize as &dyn TraitNoGenericsButWithAssocType; let generic_box_trait = Box::new(0_isize) as Box>; let generic_ref_trait = (&0_isize) as &dyn Trait2; -- cgit 1.4.1-3-g733a5