Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
108293d
Added Default impl to PathBuf
Jan 1, 2017
87dcbca
add From<[u8; n]> impls for IpAddr
seanmonstar Jan 28, 2017
1747ce2
Add support for test suites emulated in QEMU
alexcrichton Jan 28, 2017
6d9f359
Add i686-unknown-netbsdelf target
jakllsch Jan 23, 2017
cd603e4
add From<(I, u16)> for SocketAddr where I: Into<IpAddr>
seanmonstar Jan 28, 2017
897029d
Update grammar struct field init shorthand
Jan 16, 2017
3388855
Add explain struct field init shorthand
Jan 16, 2017
a7b65f1
Add doc field init shorthand
Jan 16, 2017
c4cd4e1
Wrap 80 columns
phungleson Feb 2, 2017
5c9fdd1
doc comment rewording
king6cong Feb 3, 2017
4ddb56b
Simplify wording & fix test src/doc
phungleson Feb 3, 2017
e866d07
lint/ctypes: Don't warn on non-unsized structs with PhantomData.
emilio Feb 2, 2017
f98f6c7
Pass -fPIC to native compiles on 32-bit
alexcrichton Feb 4, 2017
8579218
Improve error message for uninferrable types #38812
cengiz-io Jan 24, 2017
89ae2ca
Remove extra newlines from expectation files
cengiz-io Jan 24, 2017
7aff6ad
Remove extra note and revert name in message
cengiz-io Jan 25, 2017
3fa28cb
Add a new ui test and update existing ones
cengiz-io Feb 2, 2017
c68e963
Add Rvalue::Discriminant to retrieve discriminant
nagisa Jan 30, 2017
caf9f95
If is now always a SwitchInt in MIR
nagisa Jan 31, 2017
6849985
Move type of discriminant to AdtDef
nagisa Feb 1, 2017
a8075a4
AdtDef now contains discr_ty same as layouted
nagisa Feb 1, 2017
1355a57
SwitchInt over Switch
nagisa Feb 2, 2017
94e587e
Only SwitchInt over integers, not all consts
nagisa Feb 2, 2017
3393584
Fix build on further stages
nagisa Feb 2, 2017
76bc6c3
Reimplement simplify_cfg for SwitchInt
nagisa Feb 2, 2017
cd41479
Fix the IntTypeExt::to_ty() lifetime bounds
nagisa Feb 2, 2017
ff167a6
Fix SwitchInt building in ElaborateDrops pass
nagisa Feb 2, 2017
4e7770e
Prefer switching on false for boolean switches
nagisa Feb 2, 2017
d3f704a
Fix codegen test
nagisa Feb 2, 2017
5e465d5
Inspect now does not force on-stack Lvalue
nagisa Feb 2, 2017
1fee722
Revert use of layout code in typeck::collect
nagisa Feb 3, 2017
832d7e0
Add TerminatorKind::if_ convenience constructor
nagisa Feb 3, 2017
4e29e81
Fix build
nagisa Feb 3, 2017
cdd4aad
Fix tests
nagisa Feb 3, 2017
1e8c855
Rebase fixups
nagisa Feb 4, 2017
1246779
Inline open_drop_for_variant & clean matches::test
nagisa Feb 4, 2017
380ba6d
go back to use //
king6cong Feb 6, 2017
7c8c45e
Extract collections benchmarks to libcollections/benches
phungleson Feb 6, 2017
b975786
regr test
nikomatsakis Feb 6, 2017
78f542b
Rename i686-unknown-netbsdelf target to i686-unknown-netbsd
jakllsch Feb 6, 2017
fa0a728
back: Limit the number of LLVM worker threads.
michaelwoerister Feb 6, 2017
4f5fc4e
fix case where some edges can't be recreated by expanding the graph
nikomatsakis Feb 6, 2017
9ab8090
Delete the `mk` folder
alexcrichton Jan 23, 2017
9b0e6af
Delete swaths of the configure script
alexcrichton Jan 23, 2017
ce4abc3
Delete Travis/AppVeyor makefile builders
alexcrichton Jan 23, 2017
77c3bfa
std: Remove cfg(cargobuild) annotations
alexcrichton Jan 23, 2017
ffd3070
Clean our src/etc of old files
alexcrichton Jan 23, 2017
9ad13c8
rustbuild: Fix a few locations with makefiles gone
alexcrichton Jan 27, 2017
c8e0d04
compiletest: Add caching of test results
alexcrichton Feb 1, 2017
7c2752a
rustbuild: support setting verbosity in config.toml
Keruspe Feb 6, 2017
1ee88e5
A few documentation improvements for `syntax::print::pp`
bjorn3 Feb 5, 2017
4268872
rustbuild: add verbose to config.toml.example
Keruspe Feb 6, 2017
acd84c2
Re-write the doc index page
steveklabnik Feb 6, 2017
b0803d4
Display correct filename with --test option
GuillaumeGomez Feb 6, 2017
19bbd85
Fix branch name Cargo's downloaded from
alexcrichton Feb 5, 2017
bf126d2
Fix a manifest-generation bug on beta
alexcrichton Feb 6, 2017
d92abb3
Add more test for rustdoc --test
GuillaumeGomez Feb 6, 2017
235741f
liblibc: Update to include aarch64-unknown-freebsd support
dumbbell Feb 6, 2017
550373b
Direct conversions between slices and boxes.
Feb 1, 2017
ddb0a78
Unignore u128 test for stage 0,1
est31 Feb 7, 2017
df73bc9
Fix ICE when accessing mutably an immutable enum
estebank Feb 6, 2017
2a345bb
make Child::try_wait return io::Result<Option<ExitStatus>>
oconnor663 Feb 3, 2017
b74e668
Change deprecation warning to indicate custom derive support was remo…
JordiPolo Feb 4, 2017
2ba0b65
Improve fmt float
phungleson Feb 7, 2017
e5396e0
Choose different name for metadata obj-file to avoid clashes with use…
michaelwoerister Feb 7, 2017
ffea076
add missing comma
gheoan Feb 7, 2017
78dd2ec
review nits
steveklabnik Feb 7, 2017
87b8c9e
Add Emscripten-specific linker
RReverser Feb 3, 2017
d037808
Add missing urls for current_dir
GuillaumeGomez Feb 7, 2017
37887fc
rustbuild: Clean build/dist on `make clean`
alexcrichton Feb 7, 2017
7916e00
Bump stable release date
brson Feb 7, 2017
620074d
reference: clarify #[cfg] section
durka Jan 28, 2017
cc452f6
Rollup merge of #38764 - Aaronepower:master, r=aturon
frewsxcv Feb 8, 2017
f144122
Rollup merge of #39361 - cengizIO:master, r=arielb1
frewsxcv Feb 8, 2017
3769fc8
Rollup merge of #39372 - seanmonstar:more-addr-froms, r=alexcrichton
frewsxcv Feb 8, 2017
73bb2d1
Rollup merge of #39374 - durka:patch-34, r=steveklabnik
frewsxcv Feb 8, 2017
a6d3620
Rollup merge of #39400 - alexcrichton:arm-cross-test, r=brson
frewsxcv Feb 8, 2017
12a21c5
Rollup merge of #39426 - jakllsch:netbsd-c, r=alexcrichton
frewsxcv Feb 8, 2017
caf3bc5
Rollup merge of #39431 - alexcrichton:no-more-makefiles, r=brson
frewsxcv Feb 8, 2017
916e368
Rollup merge of #39438 - clarcharr:box_from, r=alexcrichton
frewsxcv Feb 8, 2017
e49ec1c
Rollup merge of #39456 - nagisa:mir-switchint-everywhere, r=nikomatsakis
frewsxcv Feb 8, 2017
071f6de
Rollup merge of #39459 - phungleson:fix-short-hand-struct-doc, r=stev…
frewsxcv Feb 8, 2017
67e8473
Rollup merge of #39462 - emilio:improper-ctypes, r=nikomatsakis
frewsxcv Feb 8, 2017
493917e
Rollup merge of #39482 - king6cong:master, r=frewsxcv
frewsxcv Feb 8, 2017
48c220b
Rollup merge of #39490 - RReverser:em-linker, r=alexcrichton
frewsxcv Feb 8, 2017
8a2f328
Rollup merge of #39512 - oconnor663:try_wait, r=alexcrichton
frewsxcv Feb 8, 2017
6cd834a
Rollup merge of #39523 - alexcrichton:fpic, r=aturon
frewsxcv Feb 8, 2017
94e6011
Rollup merge of #39545 - JordiPolo:fix/1_15_released, r=jseyfried
frewsxcv Feb 8, 2017
4215d3e
Rollup merge of #39557 - bjorn3:pp-docs, r=jseyfried
frewsxcv Feb 8, 2017
8098c98
Rollup merge of #39561 - phungleson:libcollectionsbench, r=alexcrichton
frewsxcv Feb 8, 2017
3189ee3
Rollup merge of #39582 - nikomatsakis:incr-comp-issue-39569, r=michae…
frewsxcv Feb 8, 2017
17679c7
Rollup merge of #39583 - michaelwoerister:limit-llvm-threads, r=nikom…
frewsxcv Feb 8, 2017
cff9175
Rollup merge of #39587 - Keruspe:master, r=alexcrichton
frewsxcv Feb 8, 2017
8997a51
Rollup merge of #39593 - steveklabnik:bookshelf-landing-page, r=frewsxcv
frewsxcv Feb 8, 2017
472494a
Rollup merge of #39597 - GuillaumeGomez:correct_rustdoc_test_file, r=…
frewsxcv Feb 8, 2017
0dd60ae
Rollup merge of #39598 - alexcrichton:cargo-branch, r=brson
frewsxcv Feb 8, 2017
5e08fa7
Rollup merge of #39599 - alexcrichton:cargo-tarball-name, r=brson
frewsxcv Feb 8, 2017
4d2aa65
Rollup merge of #39601 - dumbbell:update-liblibc-to-include-aarch64-u…
frewsxcv Feb 8, 2017
650b88d
Rollup merge of #39602 - estebank:fix-39544, r=eddyb
frewsxcv Feb 8, 2017
ba808c3
Rollup merge of #39604 - est31:i128_tests, r=alexcrichton
frewsxcv Feb 8, 2017
530aee8
Rollup merge of #39615 - phungleson:corefloat, r=alexcrichton
frewsxcv Feb 8, 2017
9a9fe17
Rollup merge of #39619 - michaelwoerister:rename-crate-metadata, r=al…
frewsxcv Feb 8, 2017
f6480ff
Rollup merge of #39620 - Gheoan:patch-1, r=steveklabnik
frewsxcv Feb 8, 2017
8499f52
Rollup merge of #39621 - GuillaumeGomez:current_dir_docs, r=steveklabnik
frewsxcv Feb 8, 2017
51b436b
Rollup merge of #39622 - alexcrichton:clean-dist, r=brson
frewsxcv Feb 8, 2017
48cab72
Rollup merge of #39624 - brson:relnotes-master, r=alexcrichton
frewsxcv Feb 8, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
If is now always a SwitchInt in MIR
  • Loading branch information
nagisa committed Feb 6, 2017
commit caf9f95f4699b7c1a83b7567b01870365e52e20c
12 changes: 1 addition & 11 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,6 @@ pub enum TerminatorKind<'tcx> {
target: BasicBlock,
},

/// jump to branch 0 if this lvalue evaluates to true
If {
cond: Operand<'tcx>,
targets: (BasicBlock, BasicBlock),
},

/// lvalue evaluates to some enum; jump depending on the branch
Switch {
discr: Lvalue<'tcx>,
Expand All @@ -470,7 +464,7 @@ pub enum TerminatorKind<'tcx> {
/// to one of the targets, and otherwise fallback to `otherwise`
SwitchInt {
/// discriminant value being tested
discr: Lvalue<'tcx>,
discr: Operand<'tcx>,

/// type of value being tested
switch_ty: Ty<'tcx>,
Expand Down Expand Up @@ -550,7 +544,6 @@ impl<'tcx> TerminatorKind<'tcx> {
use self::TerminatorKind::*;
match *self {
Goto { target: ref b } => slice::ref_slice(b).into_cow(),
If { targets: (b1, b2), .. } => vec![b1, b2].into_cow(),
Switch { targets: ref b, .. } => b[..].into_cow(),
SwitchInt { targets: ref b, .. } => b[..].into_cow(),
Resume => (&[]).into_cow(),
Expand Down Expand Up @@ -580,7 +573,6 @@ impl<'tcx> TerminatorKind<'tcx> {
use self::TerminatorKind::*;
match *self {
Goto { target: ref mut b } => vec![b],
If { targets: (ref mut b1, ref mut b2), .. } => vec![b1, b2],
Switch { targets: ref mut b, .. } => b.iter_mut().collect(),
SwitchInt { targets: ref mut b, .. } => b.iter_mut().collect(),
Resume => Vec::new(),
Expand Down Expand Up @@ -659,7 +651,6 @@ impl<'tcx> TerminatorKind<'tcx> {
use self::TerminatorKind::*;
match *self {
Goto { .. } => write!(fmt, "goto"),
If { cond: ref lv, .. } => write!(fmt, "if({:?})", lv),
Switch { discr: ref lv, .. } => write!(fmt, "switch({:?})", lv),
SwitchInt { discr: ref lv, .. } => write!(fmt, "switchInt({:?})", lv),
Return => write!(fmt, "return"),
Expand Down Expand Up @@ -710,7 +701,6 @@ impl<'tcx> TerminatorKind<'tcx> {
match *self {
Return | Resume | Unreachable => vec![],
Goto { .. } => vec!["".into()],
If { .. } => vec!["true".into(), "false".into()],
Switch { ref adt_def, .. } => {
adt_def.variants
.iter()
Expand Down
11 changes: 1 addition & 10 deletions src/librustc/mir/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use ty::subst::Substs;
use ty::{ClosureSubsts, Region, Ty};
use mir::*;
use rustc_const_math::ConstUsize;
use rustc_data_structures::tuple_slice::TupleSlice;
use rustc_data_structures::indexed_vec::Idx;
use syntax_pos::Span;

Expand Down Expand Up @@ -363,14 +362,6 @@ macro_rules! make_mir_visitor {
self.visit_branch(block, target);
}

TerminatorKind::If { ref $($mutability)* cond,
ref $($mutability)* targets } => {
self.visit_operand(cond, source_location);
for &target in targets.as_slice() {
self.visit_branch(block, target);
}
}

TerminatorKind::Switch { ref $($mutability)* discr,
adt_def: _,
ref targets } => {
Expand All @@ -384,7 +375,7 @@ macro_rules! make_mir_visitor {
ref $($mutability)* switch_ty,
ref $($mutability)* values,
ref targets } => {
self.visit_lvalue(discr, LvalueContext::Inspect, source_location);
self.visit_operand(discr, source_location);
self.visit_ty(switch_ty);
for value in values {
self.visit_const_val(value, source_location);
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_borrowck/borrowck/mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,6 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D>
self.propagate_bits_into_entry_set_for(in_out, changed, target);
self.propagate_bits_into_entry_set_for(in_out, changed, unwind);
}
mir::TerminatorKind::If { ref targets, .. } => {
self.propagate_bits_into_entry_set_for(in_out, changed, &targets.0);
self.propagate_bits_into_entry_set_for(in_out, changed, &targets.1);
}
mir::TerminatorKind::Switch { ref targets, .. } |
mir::TerminatorKind::SwitchInt { ref targets, .. } => {
for target in targets {
Expand Down
9 changes: 6 additions & 3 deletions src/librustc_borrowck/borrowck/mir/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,12 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
(true, false) => on_set,
(true, true) => {
let flag = self.drop_flag(c.path).unwrap();
self.new_block(c, is_cleanup, TerminatorKind::If {
cond: Operand::Consume(flag),
targets: (on_set, on_unset)
let boolty = self.tcx.types.bool;
self.new_block(c, is_cleanup, TerminatorKind::SwitchInt {
discr: Operand::Consume(flag),
switch_ty: boolty,
values: vec![ConstVal::Bool(true)],
targets: vec![on_set, on_unset],
})
}
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc_borrowck/borrowck/mir/gather_moves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> {
self.gather_move(loc, &Lvalue::Local(RETURN_POINTER));
}

TerminatorKind::If { .. } |
TerminatorKind::Assert { .. } |
TerminatorKind::SwitchInt { .. } |
TerminatorKind::Switch { .. } => {
Expand Down
37 changes: 24 additions & 13 deletions src/librustc_mir/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use build::expr::category::{Category, RvalueFunc};
use hair::*;
use rustc::ty;
use rustc::mir::*;
use rustc::middle::const_val::ConstVal;

impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// Compile `expr`, storing the result into `destination`, which
Expand Down Expand Up @@ -69,9 +70,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

let mut then_block = this.cfg.start_new_block();
let mut else_block = this.cfg.start_new_block();
this.cfg.terminate(block, source_info, TerminatorKind::If {
cond: operand,
targets: (then_block, else_block)
this.cfg.terminate(block, source_info, TerminatorKind::SwitchInt {
discr: operand,
switch_ty: this.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![then_block, else_block],
});

unpack!(then_block = this.into(destination, then_block, then_expr));
Expand Down Expand Up @@ -111,16 +114,22 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

let lhs = unpack!(block = this.as_operand(block, lhs));
let blocks = match op {
LogicalOp::And => (else_block, false_block),
LogicalOp::Or => (true_block, else_block),
LogicalOp::And => vec![else_block, false_block],
LogicalOp::Or => vec![true_block, else_block],
};
this.cfg.terminate(block, source_info,
TerminatorKind::If { cond: lhs, targets: blocks });
this.cfg.terminate(block, source_info, TerminatorKind::SwitchInt {
discr: lhs,
switch_ty: this.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: blocks,
});

let rhs = unpack!(else_block = this.as_operand(else_block, rhs));
this.cfg.terminate(else_block, source_info, TerminatorKind::If {
cond: rhs,
targets: (true_block, false_block)
this.cfg.terminate(else_block, source_info, TerminatorKind::SwitchInt {
discr: rhs,
switch_ty: this.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![true_block, false_block],
});

this.cfg.push_assign_constant(
Expand Down Expand Up @@ -180,9 +189,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
loop_block_end = this.as_operand(loop_block, cond_expr));
body_block = this.cfg.start_new_block();
this.cfg.terminate(loop_block_end, source_info,
TerminatorKind::If {
cond: cond,
targets: (body_block, exit_block)
TerminatorKind::SwitchInt {
discr: cond,
switch_ty: this.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![body_block, exit_block],
});

// if the test is false, there's no `break` to assign `destination`, so
Expand Down
9 changes: 6 additions & 3 deletions src/librustc_mir/build/matches/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
let source_info = self.source_info(guard.span);
let cond = unpack!(block = self.as_operand(block, guard));
let otherwise = self.cfg.start_new_block();
self.cfg.terminate(block, source_info,
TerminatorKind::If { cond: cond,
targets: (arm_block, otherwise)});
self.cfg.terminate(block, source_info, TerminatorKind::SwitchInt {
discr: cond,
switch_ty: self.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![arm_block, otherwise],
});
Some(otherwise)
} else {
let source_info = self.source_info(candidate.span);
Expand Down
35 changes: 21 additions & 14 deletions src/librustc_mir/build/matches/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
v => span_bug!(test.span, "expected boolean value but got {:?}", v)
};

(targets,
TerminatorKind::If {
cond: Operand::Consume(lvalue.clone()),
targets: (true_bb, else_bb)
(targets, TerminatorKind::SwitchInt {
discr: Operand::Consume(lvalue.clone()),
switch_ty: self.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![true_bb, else_bb]
})

}
Expand All @@ -240,7 +241,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

(targets.clone(),
TerminatorKind::SwitchInt {
discr: lvalue.clone(),
discr: Operand::Consume(lvalue.clone()),
switch_ty: switch_ty,
values: options.clone(),
targets: targets
Expand Down Expand Up @@ -314,9 +315,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

// check the result
let block = self.cfg.start_new_block();
self.cfg.terminate(eq_block, source_info, TerminatorKind::If {
cond: Operand::Consume(eq_result),
targets: (block, fail),
self.cfg.terminate(eq_block, source_info, TerminatorKind::SwitchInt {
discr: Operand::Consume(eq_result),
switch_ty: self.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![block, fail],
});

vec![block, fail]
Expand Down Expand Up @@ -362,9 +365,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// branch based on result
let target_blocks: Vec<_> = vec![self.cfg.start_new_block(),
self.cfg.start_new_block()];
self.cfg.terminate(block, source_info, TerminatorKind::If {
cond: Operand::Consume(result),
targets: (target_blocks[0], target_blocks[1])
self.cfg.terminate(block, source_info, TerminatorKind::SwitchInt {
discr: Operand::Consume(result),
switch_ty: self.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: target_blocks.clone(),
});

target_blocks
Expand All @@ -389,9 +394,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

// branch based on result
let target_block = self.cfg.start_new_block();
self.cfg.terminate(block, source_info, TerminatorKind::If {
cond: Operand::Consume(result),
targets: (target_block, fail_block)
self.cfg.terminate(block, source_info, TerminatorKind::SwitchInt {
discr: Operand::Consume(result),
switch_ty: self.hir.bool_ty(),
values: vec![ConstVal::Bool(true)],
targets: vec![target_block, fail_block]
});

target_block
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/hair/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ pub enum ExprKind<'tcx> {
op: LogicalOp,
lhs: ExprRef<'tcx>,
rhs: ExprRef<'tcx>,
},
}, // NOT overloaded!
// LogicalOp is distinct from BinaryOp because of lazy evaluation of the operands.
Unary {
op: UnOp,
arg: ExprRef<'tcx>,
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/transform/no_landing_pads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ impl<'tcx> MutVisitor<'tcx> for NoLandingPads {
TerminatorKind::Resume |
TerminatorKind::Return |
TerminatorKind::Unreachable |
TerminatorKind::If { .. } |
TerminatorKind::Switch { .. } |
TerminatorKind::SwitchInt { .. } => {
/* nothing to do */
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
return Qualif::empty();
}

TerminatorKind::If {..} |
TerminatorKind::Switch {..} |
TerminatorKind::SwitchInt {..} |
TerminatorKind::DropAndReplace { .. } |
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/transform/simplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> {
// turn a branch with all successors identical to a goto
fn simplify_branch(&mut self, terminator: &mut Terminator<'tcx>) -> bool {
match terminator.kind {
TerminatorKind::If { .. } |
TerminatorKind::Switch { .. } |
TerminatorKind::SwitchInt { .. } => {},
_ => return false
Expand Down
22 changes: 11 additions & 11 deletions src/librustc_mir/transform/simplify_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ impl<'l, 'tcx> MirPass<'tcx> for SimplifyBranches<'l> {
for block in mir.basic_blocks_mut() {
let terminator = block.terminator_mut();
terminator.kind = match terminator.kind {
TerminatorKind::If { ref targets, cond: Operand::Constant(Constant {
literal: Literal::Value {
value: ConstVal::Bool(cond)
}, ..
}) } => {
if cond {
TerminatorKind::Goto { target: targets.0 }
} else {
TerminatorKind::Goto { target: targets.1 }
}
}
// TerminatorKind::If { ref targets, cond: Operand::Constant(Constant {
// literal: Literal::Value {
// value: ConstVal::Bool(cond)
// }, ..
// }) } => {
// if cond {
// TerminatorKind::Goto { target: targets.0 }
// } else {
// TerminatorKind::Goto { target: targets.1 }
// }
// }

TerminatorKind::Assert { target, cond: Operand::Constant(Constant {
literal: Literal::Value {
Expand Down
16 changes: 1 addition & 15 deletions src/librustc_mir/transform/type_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,8 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
lv_ty, rv_ty, terr);
}
}

TerminatorKind::If { ref cond, .. } => {
let cond_ty = cond.ty(mir, tcx);
match cond_ty.sty {
ty::TyBool => {}
_ => {
span_mirbug!(self, term, "bad If ({:?}, not bool", cond_ty);
}
}
}
TerminatorKind::SwitchInt { ref discr, switch_ty, .. } => {
let discr_ty = discr.ty(mir, tcx).to_ty(tcx);
let discr_ty = discr.ty(mir, tcx);
if let Err(terr) = self.sub_types(discr_ty, switch_ty) {
span_mirbug!(self, term, "bad SwitchInt ({:?} on {:?}): {:?}",
switch_ty, discr_ty, terr);
Expand Down Expand Up @@ -603,10 +593,6 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
match block.terminator().kind {
TerminatorKind::Goto { target } =>
self.assert_iscleanup(mir, block, target, is_cleanup),
TerminatorKind::If { targets: (on_true, on_false), .. } => {
self.assert_iscleanup(mir, block, on_true, is_cleanup);
self.assert_iscleanup(mir, block, on_false, is_cleanup);
}
TerminatorKind::Switch { ref targets, .. } |
TerminatorKind::SwitchInt { ref targets, .. } => {
for target in targets {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_passes/mir_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ impl<'a, 'tcx> mir_visit::Visitor<'tcx> for StatCollector<'a, 'tcx> {
self.record("TerminatorKind", kind);
self.record(match *kind {
TerminatorKind::Goto { .. } => "TerminatorKind::Goto",
TerminatorKind::If { .. } => "TerminatorKind::If",
TerminatorKind::Switch { .. } => "TerminatorKind::Switch",
TerminatorKind::SwitchInt { .. } => "TerminatorKind::SwitchInt",
TerminatorKind::Resume => "TerminatorKind::Resume",
Expand Down
1 change: 0 additions & 1 deletion src/librustc_trans/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec<mir::BasicBlock
TerminatorKind::Resume |
TerminatorKind::Return |
TerminatorKind::Unreachable |
TerminatorKind::If { .. } |
TerminatorKind::Switch { .. } |
TerminatorKind::SwitchInt { .. } => {
/* nothing to do */
Expand Down
Loading