@@ -25,22 +25,25 @@ fn eval_goal(ra_fixture: &str, minicore: &str) -> Result<Layout, LayoutError> {
2525 "{minicore}//- /main.rs crate:test target_data_layout:{target_data_layout}\n {ra_fixture}" ,
2626 ) ;
2727
28- let ( db, file_id) = TestDB :: with_single_file ( & ra_fixture) ;
29- let module_id = db. module_for_file ( file_id) ;
30- let def_map = module_id. def_map ( & db) ;
31- let scope = & def_map[ module_id. local_id ] . scope ;
32- let adt_id = scope
33- . declarations ( )
34- . find_map ( |x| match x {
35- hir_def:: ModuleDefId :: AdtId ( x) => {
36- let name = match x {
37- hir_def:: AdtId :: StructId ( x) => db. struct_data ( x) . name . to_smol_str ( ) ,
38- hir_def:: AdtId :: UnionId ( x) => db. union_data ( x) . name . to_smol_str ( ) ,
39- hir_def:: AdtId :: EnumId ( x) => db. enum_data ( x) . name . to_smol_str ( ) ,
40- } ;
41- ( name == "Goal" ) . then_some ( x)
42- }
43- _ => None ,
28+ let ( db, file_ids) = TestDB :: with_many_files ( & ra_fixture) ;
29+ let ( adt_id, module_id) = file_ids
30+ . into_iter ( )
31+ . find_map ( |file_id| {
32+ let module_id = db. module_for_file ( file_id) ;
33+ let def_map = module_id. def_map ( & db) ;
34+ let scope = & def_map[ module_id. local_id ] . scope ;
35+ let adt_id = scope. declarations ( ) . find_map ( |x| match x {
36+ hir_def:: ModuleDefId :: AdtId ( x) => {
37+ let name = match x {
38+ hir_def:: AdtId :: StructId ( x) => db. struct_data ( x) . name . to_smol_str ( ) ,
39+ hir_def:: AdtId :: UnionId ( x) => db. union_data ( x) . name . to_smol_str ( ) ,
40+ hir_def:: AdtId :: EnumId ( x) => db. enum_data ( x) . name . to_smol_str ( ) ,
41+ } ;
42+ ( name == "Goal" ) . then_some ( x)
43+ }
44+ _ => None ,
45+ } ) ?;
46+ Some ( ( adt_id, module_id) )
4447 } )
4548 . unwrap ( ) ;
4649 let goal_ty = TyKind :: Adt ( AdtId ( adt_id) , Substitution :: empty ( Interner ) ) . intern ( Interner ) ;
@@ -232,6 +235,27 @@ fn associated_types() {
232235 struct Foo <A : Tr >( <A as Tr >:: Ty ) ;
233236 struct Goal ( Foo <i32 >) ;
234237 }
238+ check_size_and_align (
239+ r#"
240+ //- /b/mod.rs crate:b
241+ pub trait Tr {
242+ type Ty;
243+ }
244+ pub struct Foo<A: Tr>(<A as Tr>::Ty);
245+
246+ //- /a/mod.rs crate:a deps:b
247+ use b::{Tr, Foo};
248+
249+ struct S;
250+ impl Tr for S {
251+ type Ty = i64;
252+ }
253+ struct Goal(Foo<S>);
254+ "# ,
255+ "" ,
256+ 8 ,
257+ 8 ,
258+ ) ;
235259}
236260
237261#[ test]
0 commit comments