-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
There seems to be no way currently to dump at least some of the MIR that rustc generates itself, e.g. for drop.
In the following code
struct Bar(u16); // ZSTs are tested separately
static mut DROP_COUNT: usize = 0;
impl Drop for Bar {
fn drop(&mut self) {
assert_eq!(self.0 as usize, unsafe { DROP_COUNT }); // tests whether we are called at a valid address
unsafe { DROP_COUNT += 1; }
}
}
fn main() {
let b = [Bar(0), Bar(1), Bar(2), Bar(3)];
assert_eq!(unsafe { DROP_COUNT }, 0);
drop(b);
assert_eq!(unsafe { DROP_COUNT }, 4);
// check empty case
let b : [Bar; 0] = [];
drop(b);
assert_eq!(unsafe { DROP_COUNT }, 4);
}
I can clearly see miri execute an Offset
binop (a binop which is only ever emitted by the auto-generated drop glue), but grepping the entire dump directory for Offset
shows no hit.
Metadata
Metadata
Assignees
Labels
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.