mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #72502 - RalfJung:generator-discr-ty, r=jonas-schievink
fix discriminant type in generator transform The generator transform assumed that the discriminant type is always `isize`, which is not correct, leading to [ICEs in Miri](https://github.com/rust-lang/rust/pull/72419/files#r429543536) when some extra sanity checking got enabled. r? @jonas-schievink @eddyb
This commit is contained in:
commit
1e7914467a
@ -266,7 +266,7 @@ impl TransformVisitor<'tcx> {
|
||||
|
||||
// Create a statement which reads the discriminant into a temporary
|
||||
fn get_discr(&self, body: &mut Body<'tcx>) -> (Statement<'tcx>, Place<'tcx>) {
|
||||
let temp_decl = LocalDecl::new(self.tcx.types.isize, body.span).internal();
|
||||
let temp_decl = LocalDecl::new(self.discr_ty, body.span).internal();
|
||||
let local_decls_len = body.local_decls.push(temp_decl);
|
||||
let temp = Place::from(local_decls_len);
|
||||
|
||||
|
@ -9,7 +9,7 @@ fn main::{{closure}}#0(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15:
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:12:9: 12:14
|
||||
let mut _7: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:18: 10:18
|
||||
let mut _8: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
let mut _9: isize; // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
let mut _9: u32; // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
scope 1 {
|
||||
debug _s => (((*_1) as variant#3).0: std::string::String); // in scope 1 at $DIR/generator-drop-cleanup.rs:11:13: 11:15
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs:
|
||||
let _8: (); // in scope 0 at $DIR/generator-tiny.rs:23:13: 23:21
|
||||
let mut _9: (); // in scope 0 at $DIR/generator-tiny.rs:19:25: 19:25
|
||||
let _10: u8; // in scope 0 at $DIR/generator-tiny.rs:19:17: 19:19
|
||||
let mut _11: isize; // in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
let mut _11: u32; // in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
scope 1 {
|
||||
debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:20:13: 20:15
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user