File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -59,15 +59,16 @@ TypeCastRules::cast_rules ()
59
59
// https://github.com/rust-lang/rust/blob/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/compiler/rustc_typeck/src/check/cast.rs#L596
60
60
// https://github.com/rust-lang/rust/blob/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/compiler/rustc_typeck/src/check/cast.rs#L654
61
61
62
- rust_debug (" cast_rules from={%s} to={%s}" ,
63
- from.get_ty ()->debug_str ().c_str (),
62
+ TyTy::BaseType *from_type = from.get_ty ()->destructure ();
63
+
64
+ rust_debug (" cast_rules from={%s} to={%s}" , from_type->debug_str ().c_str (),
64
65
to.get_ty ()->debug_str ().c_str ());
65
66
66
- switch (from. get_ty () ->get_kind ())
67
+ switch (from_type ->get_kind ())
67
68
{
68
69
case TyTy::TypeKind::INFER: {
69
70
TyTy::InferType *from_infer
70
- = static_cast <TyTy::InferType *> (from. get_ty () );
71
+ = static_cast <TyTy::InferType *> (from_type );
71
72
switch (from_infer->get_infer_kind ())
72
73
{
73
74
case TyTy::InferType::InferTypeKind::GENERAL:
@@ -289,4 +290,4 @@ TypeCastRules::emit_cast_error () const
289
290
}
290
291
291
292
} // namespace Resolver
292
- } // namespace Rust
293
+ } // namespace Rust
Original file line number Diff line number Diff line change
1
+ fn test < T > ( a : T ) -> T {
2
+ a
3
+ }
4
+
5
+ fn main ( ) {
6
+ let t: i32 = test ( 123 as i32 ) as i32 ;
7
+ // { dg-warning "unused name" "" { target *-*-* } .-1 }
8
+ }
You can’t perform that action at this time.
0 commit comments