Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIR drive-by cleanups #111501

Merged
merged 4 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,29 @@ pub enum TerminatorKind<'tcx> {
},
}

impl TerminatorKind<'_> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this in a different file? This one's mostly for type definitions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are similar functions in this file though, like MirPhase::name...

Not sure where to best put this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, ok. We should probably move those out too, don't worry about it for this PR though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mir::terminator file looks like a proper place.

/// Returns a simple string representation of a `TerminatorKind` variant, independent of any
/// values it might hold (e.g. `TerminatorKind::Call` always returns `"Call"`).
pub const fn name(&self) -> &'static str {
match self {
TerminatorKind::Goto { .. } => "Goto",
TerminatorKind::SwitchInt { .. } => "SwitchInt",
TerminatorKind::Resume => "Resume",
TerminatorKind::Terminate => "Terminate",
TerminatorKind::Return => "Return",
TerminatorKind::Unreachable => "Unreachable",
TerminatorKind::Drop { .. } => "Drop",
TerminatorKind::Call { .. } => "Call",
TerminatorKind::Assert { .. } => "Assert",
TerminatorKind::Yield { .. } => "Yield",
TerminatorKind::GeneratorDrop => "GeneratorDrop",
TerminatorKind::FalseEdge { .. } => "FalseEdge",
TerminatorKind::FalseUnwind { .. } => "FalseUnwind",
TerminatorKind::InlineAsm { .. } => "InlineAsm",
}
}
}

/// Action to be taken when a stack unwind happens.
#[derive(Copy, Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
#[derive(TypeFoldable, TypeVisitable)]
Expand Down
27 changes: 15 additions & 12 deletions compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,24 +644,27 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
};

if let Some(destination) = destination {
if let Some(value) = value {
match (destination, value) {
(Some(destination), Some(value)) => {
debug!("stmt_expr Break val block_context.push(SubExpr)");
self.block_context.push(BlockFrame::SubExpr);
unpack!(block = self.expr_into_dest(destination, block, value));
self.block_context.pop();
} else {
}
(Some(destination), None) => {
self.cfg.push_assign_unit(block, source_info, destination, self.tcx)
}
} else {
assert!(value.is_none(), "`return` and `break` should have a destination");
if self.tcx.sess.instrument_coverage() {
(None, Some(_)) => {
panic!("`return`, `become` and `break` with value and must have a destination")
}
(None, None) if self.tcx.sess.instrument_coverage() => {
// Unlike `break` and `return`, which push an `Assign` statement to MIR, from which
// a Coverage code region can be generated, `continue` needs no `Assign`; but
// without one, the `InstrumentCoverage` MIR pass cannot generate a code region for
// `continue`. Coverage will be missing unless we add a dummy `Assign` to MIR.
self.add_dummy_assignment(span, block, source_info);
}
(None, None) => {}
}

let region_scope = self.scopes.breakable_scopes[break_index].region_scope;
Expand All @@ -671,12 +674,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} else {
self.scopes.breakable_scopes[break_index].continue_drops.as_mut().unwrap()
};
let mut drop_idx = ROOT_NODE;
for scope in &self.scopes.scopes[scope_index + 1..] {
for drop in &scope.drops {
drop_idx = drops.add_drop(*drop, drop_idx);
}
}

let drop_idx = self.scopes.scopes[scope_index + 1..]
.iter()
.flat_map(|scope| &scope.drops)
.fold(ROOT_NODE, |drop_idx, &drop| drops.add_drop(drop, drop_idx));

drops.add_entry(block, drop_idx);

// `build_drop_trees` doesn't have access to our source_info, so we
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_mir_build/src/thir/cx/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl<'tcx> Cx<'tcx> {
ExprKind::Pointer { cast: PointerCast::Unsize, source: self.thir.exprs.push(expr) }
}
Adjust::Pointer(cast) => ExprKind::Pointer { cast, source: self.thir.exprs.push(expr) },
Adjust::NeverToAny if adjustment.target.is_never() => return expr,
oli-obk marked this conversation as resolved.
Show resolved Hide resolved
Adjust::NeverToAny => ExprKind::NeverToAny { source: self.thir.exprs.push(expr) },
Adjust::Deref(None) => {
adjust_span(&mut expr);
Expand Down
27 changes: 3 additions & 24 deletions compiler/rustc_mir_transform/src/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ use rustc_middle::mir::spanview::{self, SpanViewable};

use rustc_data_structures::fx::FxHashMap;
use rustc_middle::mir::coverage::*;
use rustc_middle::mir::{self, BasicBlock, TerminatorKind};
use rustc_middle::mir::{self, BasicBlock};
use rustc_middle::ty::TyCtxt;
use rustc_span::Span;

Expand Down Expand Up @@ -796,36 +796,15 @@ fn bcb_to_string_sections<'tcx>(
}
let non_term_blocks = bcb_data.basic_blocks[0..len - 1]
.iter()
.map(|&bb| format!("{:?}: {}", bb, term_type(&mir_body[bb].terminator().kind)))
.map(|&bb| format!("{:?}: {}", bb, mir_body[bb].terminator().kind.name()))
.collect::<Vec<_>>();
if non_term_blocks.len() > 0 {
sections.push(non_term_blocks.join("\n"));
}
sections.push(format!(
"{:?}: {}",
bcb_data.basic_blocks.last().unwrap(),
term_type(&bcb_data.terminator(mir_body).kind)
bcb_data.terminator(mir_body).kind.name(),
));
sections
}

/// Returns a simple string representation of a `TerminatorKind` variant, independent of any
/// values it might hold.
pub(super) fn term_type(kind: &TerminatorKind<'_>) -> &'static str {
match kind {
TerminatorKind::Goto { .. } => "Goto",
TerminatorKind::SwitchInt { .. } => "SwitchInt",
TerminatorKind::Resume => "Resume",
TerminatorKind::Terminate => "Terminate",
TerminatorKind::Return => "Return",
TerminatorKind::Unreachable => "Unreachable",
TerminatorKind::Drop { .. } => "Drop",
TerminatorKind::Call { .. } => "Call",
TerminatorKind::Assert { .. } => "Assert",
TerminatorKind::Yield { .. } => "Yield",
TerminatorKind::GeneratorDrop => "GeneratorDrop",
TerminatorKind::FalseEdge { .. } => "FalseEdge",
TerminatorKind::FalseUnwind { .. } => "FalseUnwind",
TerminatorKind::InlineAsm { .. } => "InlineAsm",
}
}
3 changes: 1 addition & 2 deletions compiler/rustc_mir_transform/src/coverage/spans.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use super::debug::term_type;
use super::graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph, START_BCB};

use itertools::Itertools;
Expand Down Expand Up @@ -40,7 +39,7 @@ impl CoverageStatement {
"{}: @{}.{}: {:?}",
source_range_no_file(tcx, span),
bb.index(),
term_type(&term.kind),
term.kind.name(),
term.kind
)
}
Expand Down
11 changes: 5 additions & 6 deletions compiler/rustc_mir_transform/src/coverage/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
//! to: `rustc_span::create_default_session_globals_then(|| { test_here(); })`.

use super::counters;
use super::debug;
use super::graph;
use super::spans;

Expand Down Expand Up @@ -188,12 +187,12 @@ fn debug_basic_blocks(mir_body: &Body<'_>) -> String {
| TerminatorKind::Goto { target }
| TerminatorKind::InlineAsm { destination: Some(target), .. }
| TerminatorKind::Yield { resume: target, .. } => {
format!("{}{:?}:{} -> {:?}", sp, bb, debug::term_type(kind), target)
format!("{}{:?}:{} -> {:?}", sp, bb, kind.name(), target)
}
TerminatorKind::SwitchInt { targets, .. } => {
format!("{}{:?}:{} -> {:?}", sp, bb, debug::term_type(kind), targets)
format!("{}{:?}:{} -> {:?}", sp, bb, kind.name(), targets)
}
_ => format!("{}{:?}:{}", sp, bb, debug::term_type(kind)),
_ => format!("{}{:?}:{}", sp, bb, kind.name()),
}
})
.collect::<Vec<_>>()
Expand All @@ -215,7 +214,7 @@ fn print_mir_graphviz(name: &str, mir_body: &Body<'_>) {
" {:?} [label=\"{:?}: {}\"];\n{}",
bb,
bb,
debug::term_type(&data.terminator().kind),
data.terminator().kind.name(),
mir_body
.basic_blocks
.successors(bb)
Expand Down Expand Up @@ -244,7 +243,7 @@ fn print_coverage_graphviz(
" {:?} [label=\"{:?}: {}\"];\n{}",
bcb,
bcb,
debug::term_type(&bcb_data.terminator(mir_body).kind),
bcb_data.terminator(mir_body).kind.name(),
basic_coverage_blocks
.successors(bcb)
.map(|successor| { format!(" {:?} -> {:?};", bcb, successor) })
Expand Down
6 changes: 2 additions & 4 deletions src/tools/miri/tests/fail/never_say_never.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

fn main() {
let y = &5;
let x: ! = unsafe {
*(y as *const _ as *const !) //~ ERROR: entering unreachable code
};
f(x)
let x: ! = unsafe { *(y as *const _ as *const !) };
f(x) //~ ERROR: entering unreachable code
}
Comment on lines 7 to 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is surprising. How does the MIR change here? The previous MIR didn't even contain an f call, even with -Zmir-opt-level=0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is essentially

  1. f now has return, not unreachable
  2. main now has additional _3: !
  3. main now has _3 = f(const ZeroSized: !);, not unreachable;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, it looks like the difference is already present after building MIR:

--- ./nightly_mir_dump/t.f.001-000.built.after.mir      2023-05-15 14:25:01.537195340 +0000
+++ ./b_mir_dump/t.f.001-000.built.after.mir    2023-05-15 14:25:07.469143513 +0000
@@ -3,23 +3,9 @@
 fn f(_1: !) -> ! {
     debug x => _1;                       // in scope 0 at ./t.rs:9:6: 9:7
     let mut _0: !;                       // return place in scope 0 at ./t.rs:9:15: 9:16
-    let mut _2: !;                       // in scope 0 at ./t.rs:9:17: 11:2
-    let mut _3: !;                       // in scope 0 at ./t.rs:10:5: 10:6
 
     bb0: {
-        StorageLive(_2);                 // scope 0 at ./t.rs:9:17: 11:2
-        StorageLive(_3);                 // scope 0 at ./t.rs:10:5: 10:6
-        _3 = _1;                         // scope 0 at ./t.rs:10:5: 10:6
-        unreachable;                     // scope 0 at ./t.rs:10:5: 10:6
-    }
-
-    bb1: {
-        StorageDead(_3);                 // scope 0 at ./t.rs:10:5: 10:6
-        unreachable;                     // scope 0 at ./t.rs:9:17: 11:2
-    }
-
-    bb2: {
-        StorageDead(_2);                 // scope 0 at ./t.rs:11:1: 11:2
+        _0 = _1;                         // scope 0 at ./t.rs:10:5: 10:6
         return;                          // scope 0 at ./t.rs:11:2: 11:2
     }
 }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why NeverToAny should get a special case for ! -> !, but I also don't mind the change in diagnostics here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is "existence of identity coercions makes my other work harder" 😄

Copy link
Member

@RalfJung RalfJung May 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's somewhat surprising but well, I am not familiar with those parts of the compiler at all.^^ If this is an invariant we want to enforce, should it be checked somewhere so that we notice when identity coercions come back?

Still, @rust-lang/types should probably take a look.


fn f(x: !) -> ! {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/tests/fail/never_say_never.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: entering unreachable code
--> $DIR/never_say_never.rs:LL:CC
|
LL | *(y as *const _ as *const !)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ entering unreachable code
LL | f(x)
| ^^^^ entering unreachable code
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@

fn unreachable_box() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
let _2: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
scope 1 {
debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _2 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _2 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x00000001)) }
StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@

fn unreachable_box() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
let _2: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
let _1: std::boxed::Box<Never>; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
scope 1 {
debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _2 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _2 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
- _1 = const 1_usize as std::boxed::Box<Never> (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _1 = const Box::<Never>(Unique::<Never> {{ pointer: NonNull::<Never> {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData::<Never> }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: Box<Never>, val: Value(Scalar(0x0000000000000001)) }
StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@

fn unreachable_direct() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:41: +3:2
let _2: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _3: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:15
let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
scope 1 {
debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:41: +3:2
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_3); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_3 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_2 = move _3 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@

fn unreachable_direct() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40
let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:41: +3:2
let _2: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _3: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:15
let _1: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _2: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41
scope 1 {
debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:41: +3:2
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_3); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_3 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_2 = move _3 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_2); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_2 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41
_1 = move _2 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42
unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@

fn unreachable_mut() -> ! {
let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37
let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2
let _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _3: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16
let _1: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10
let mut _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52
scope 1 {
debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
debug x => _1; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10
}
scope 2 {
}

bb0: {
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _3 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
StorageLive(_1); // scope 0 at $DIR/transmute.rs:+1:9: +1:10
StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
- _2 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ _2 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52
+ // mir::Constant
+ // + span: no-location
+ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x00000001)) }
_2 = &mut (*_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
StorageDead(_3); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
StorageLive(_4); // scope 1 at $DIR/transmute.rs:+2:5: +2:16
_1 = &mut (*_2); // scope 0 at $DIR/transmute.rs:+1:34: +1:52
StorageDead(_2); // scope 0 at $DIR/transmute.rs:+1:54: +1:55
unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13
}
}
Expand Down
Loading