File tree 3 files changed +56
-1
lines changed
3 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -1395,7 +1395,11 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
1395
1395
// Self in impl (we know the concrete type).
1396
1396
check_path_args ( tcx, base_segments, NO_TPS | NO_REGIONS ) ;
1397
1397
if let Some ( & ty) = tcx. ast_ty_to_ty_cache . borrow ( ) . get ( & self_ty_id) {
1398
- ty
1398
+ if let Some ( free_substs) = this. get_free_substs ( ) {
1399
+ ty. subst ( tcx, free_substs)
1400
+ } else {
1401
+ ty
1402
+ }
1399
1403
} else {
1400
1404
tcx. sess . span_bug ( span, "self type has not been fully resolved" )
1401
1405
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ pub trait Foo {
12
+ fn method1 ( ) { }
13
+ fn method2 ( ) ;
14
+ }
15
+
16
+ struct Slice < ' a , T : ' a > ( & ' a [ T ] ) ;
17
+
18
+ impl < ' a , T : ' a > Foo for Slice < ' a , T > {
19
+ fn method2 ( ) {
20
+ <Self as Foo >:: method1 ( ) ;
21
+ }
22
+ }
23
+
24
+ fn main ( ) {
25
+ <Slice < ( ) > as Foo >:: method2 ( ) ;
26
+ }
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ struct S < ' a > ( & ' a ( ) ) ;
12
+
13
+ impl < ' a > S < ' a > {
14
+ fn foo ( self ) -> & ' a ( ) {
15
+ <Self >:: bar ( self )
16
+ }
17
+
18
+ fn bar ( self ) -> & ' a ( ) {
19
+ self . 0
20
+ }
21
+ }
22
+
23
+ fn main ( ) {
24
+ S ( & ( ) ) . foo ( ) ;
25
+ }
You can’t perform that action at this time.
0 commit comments