File tree 2 files changed +29
-1
lines changed
librustc_mir/monomorphize
2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -1166,8 +1166,13 @@ fn create_mono_items_for_default_impls<'tcx>(
1166
1166
}
1167
1167
} ) ;
1168
1168
1169
+ let param_env = ty:: ParamEnv :: reveal_all ( ) ;
1170
+ let substs = tcx. normalize_erasing_regions (
1171
+ param_env,
1172
+ substs,
1173
+ ) ;
1169
1174
let instance = ty:: Instance :: resolve ( tcx,
1170
- ty :: ParamEnv :: reveal_all ( ) ,
1175
+ param_env ,
1171
1176
method. def_id ,
1172
1177
substs) . unwrap ( ) ;
1173
1178
Original file line number Diff line number Diff line change
1
+ // Make sure that the mono-item collector does not crash when trying to
2
+ // instantiate a default impl for DecodeUtf16<<u8 as A>::Item>
3
+ // See https://github.com/rust-lang/rust/issues/58375
4
+ // compile-flags:-C link-dead-code
5
+
6
+ #![ crate_type = "rlib" ]
7
+
8
+ pub struct DecodeUtf16 < I > ( I ) ;
9
+
10
+ pub trait Arbitrary {
11
+ fn arbitrary ( ) { }
12
+ }
13
+
14
+ pub trait A {
15
+ type Item ;
16
+ }
17
+
18
+ impl A for u8 {
19
+ type Item = char ;
20
+ }
21
+
22
+ impl Arbitrary for DecodeUtf16 < <u8 as A >:: Item > {
23
+ }
You can’t perform that action at this time.
0 commit comments