File tree Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Expand file tree Collapse file tree 2 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -630,11 +630,8 @@ fn emit_vtable_methods(bcx: @Block,
630
630
debug ! ( "(making impl vtable) emitting method {} at subst {}" ,
631
631
m. repr( tcx) ,
632
632
substs. repr( tcx) ) ;
633
- let fty = ty:: subst_tps ( tcx,
634
- substs,
635
- None ,
636
- ty:: mk_bare_fn ( tcx, m. fty . clone ( ) ) ) ;
637
- if m. generics . has_type_params ( ) || ty:: type_has_self ( fty) {
633
+ if m. generics . has_type_params ( ) ||
634
+ ty:: type_has_self ( ty:: mk_bare_fn ( tcx, m. fty . clone ( ) ) ) {
638
635
debug ! ( "(making impl vtable) method has self or type params: {}" ,
639
636
tcx. sess. str_of( ident) ) ;
640
637
C_null ( Type :: nil ( ) . ptr_to ( ) )
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 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
+ // Testing casting of a generic Struct to a Trait with a generic method.
12
+ // This is test for issue 10955.
13
+ #[ allow( unused_variable) ] ;
14
+
15
+ trait Foo {
16
+ fn f < A > ( a : A ) -> A {
17
+ a
18
+ }
19
+ }
20
+
21
+ struct Bar < T > {
22
+ x : T ,
23
+ }
24
+
25
+ impl < T > Foo for Bar < T > { }
26
+
27
+ pub fn main ( ) {
28
+ let a = Bar { x : 1 } ;
29
+ let b = & a as & Foo ;
30
+ }
You can’t perform that action at this time.
0 commit comments