@@ -128,6 +128,61 @@ mod default_method_using_associated_type {
128128 }
129129}
130130
131+ mod concrete_type_access_associated_type {
132+ use super :: * ;
133+
134+ fn using_as (
135+ a : <S as GetSet >:: Output ,
136+ b : <Wrapper < i32 > as GetSet >:: Output ,
137+ c : <Odd < i32 > as GetSet >:: Output ,
138+ d : <Odd < bool > as GetSet >:: Output ,
139+ ) {
140+ let _a = a; // $ MISSING: type=_a:S3
141+ let _b = b; // $ MISSING: type=_b:i32
142+ let _c = c; // $ MISSING: type=_c:bool
143+ let _d = d; // $ MISSING: type=_d:char
144+ }
145+
146+ // NOTE: The below seems like it should work, but is currently rejected by
147+ // the Rust compiler. This behavior does not seem to be documented and
148+ // there's an open issue about it:
149+ // https://github.com/rust-lang/rust/issues/104119
150+ // fn without_as(
151+ // a: S::Output,
152+ // b: Wrapper<i32>::Output,
153+ // c: Odd<i32>::Output,
154+ // d: Odd<bool>::Output,
155+ // ) {
156+ // let _a = a; // $ type=_a:S3
157+ // let _b = b; // $ type=_b:i32
158+ // let _c = c; // $ type=_c:bool
159+ // let _d = d; // $ type=_d:char
160+ // }
161+
162+ impl Odd < i32 > {
163+ // Odd<i32>::proj
164+ fn proj ( & self ) -> <Self as GetSet >:: Output {
165+ let x = Default :: default ( ) ; // $ MISSING: target=default
166+ x // $ MISSING: type=x:bool
167+ }
168+ }
169+
170+ impl Odd < bool > {
171+ // Odd<bool>::proj
172+ fn proj ( & self ) -> <Self as GetSet >:: Output {
173+ let x = Default :: default ( ) ; // $ MISSING: target=default
174+ x // $ MISSING: type=x:char
175+ }
176+ }
177+
178+ pub fn test ( ) {
179+ using_as ( S3 , 1 , true , 'a' ) ; // $ target=using_as
180+
181+ let _a = Odd ( 42i32 ) . proj ( ) ; // $ target=Odd<i32>::proj MISSING: type=_a:bool
182+ let _b = Odd ( true ) . proj ( ) ; // $ target=Odd<bool>::proj MISSING: type=_b:char
183+ }
184+ }
185+
131186// Tests for signatures that access associated types from type parameters
132187mod type_param_access_associated_type {
133188 use super :: * ;
@@ -392,6 +447,7 @@ mod dyn_trait {
392447
393448pub fn test ( ) {
394449 default_method_using_associated_type:: test ( ) ; // $ target=test
450+ concrete_type_access_associated_type:: test ( ) ; // $ target=test
395451 type_param_access_associated_type:: test ( ) ; // $ target=test
396452 generic_associated_type:: test ( ) ; // $ target=test
397453 multiple_associated_types:: test ( ) ; // $ target=test
0 commit comments