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

Rollup of 10 pull requests #54790

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fcda7b2
Add doc for impl From for Std Error
phungleson Sep 5, 2018
a7cc1fc
Examples for docs
phungleson Sep 25, 2018
53254a8
Add enable-missing-tools option
pvdrz Sep 28, 2018
0724ed6
Add DIST_REQUIRE_ALL_TOOLS to CI scripts
pvdrz Sep 28, 2018
2765575
Fix conditions to allow missing tools in CI
pvdrz Sep 30, 2018
922b9d8
[NFC] `getopts` is used by `librustc` and `librustc_driver`, but isn'…
DiamondLovesYou Sep 30, 2018
ec59188
Make spec_extend use for_each()
Lucretiel Oct 2, 2018
8da08c0
Run debuginfo tests against rust-enabled lldb, when possible
tromey Oct 2, 2018
84f75f0
Fix typo in CONTRIBUTING.md
Oct 2, 2018
30f2e96
Remove main() in examples
phungleson Oct 2, 2018
d686896
Update a FIXME in memory.rs
wesleywiser Oct 3, 2018
187bcb9
rustc/ty: whitespace fixes
ljedrz Oct 2, 2018
f8cacca
rustc/ty: simplify some patterns
ljedrz Oct 2, 2018
774881d
rustc/ty: mark a comment as FIXME
ljedrz Oct 2, 2018
db17164
rustc/ty: calculate span after a possible early continue
ljedrz Oct 2, 2018
04b99bc
rustc/ty: improve allocations
ljedrz Oct 2, 2018
f0de294
A handful of cleanups for rustc/mir
ljedrz Oct 3, 2018
c2c8f8a
Update clippy
Manishearth Oct 3, 2018
3c22127
Rollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=Gu…
kennytm Oct 3, 2018
72aad24
Rollup merge of #54638 - christianpoveda:master, r=kennytm
kennytm Oct 3, 2018
f66f01e
Rollup merge of #54698 - DiamondLovesYou:getopts-deps, r=davidtwco
kennytm Oct 3, 2018
8b9145e
Rollup merge of #54743 - ljedrz:cleanup_ty_p2, r=zackmdavis
kennytm Oct 3, 2018
2b84507
Rollup merge of #54761 - Lucretiel:patch-1, r=cramertj
kennytm Oct 3, 2018
61a5a51
Rollup merge of #54764 - tromey:test-rust-lldb, r=alexcrichton
kennytm Oct 3, 2018
09b4913
Rollup merge of #54769 - jacobherrington:patch-1, r=kennytm
kennytm Oct 3, 2018
0ba5d74
Rollup merge of #54773 - rust-lang:wesleywiser-patch-1, r=oli-obk
kennytm Oct 3, 2018
a42a4d6
Rollup merge of #54784 - Manishearth:clippyup, r=oli-obk
kennytm Oct 3, 2018
94508ca
Rollup merge of #54788 - ljedrz:cleanup_rustc_mir, r=oli-obk
kennytm Oct 3, 2018
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
Prev Previous commit
Next Next commit
A handful of cleanups for rustc/mir
  • Loading branch information
ljedrz committed Oct 3, 2018
commit f0de294a9b6d09b9933c1a22419831ac4bc49ca9
4 changes: 2 additions & 2 deletions src/librustc/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl<'tcx> Scalar {
pub fn from_uint(i: impl Into<u128>, size: Size) -> Self {
let i = i.into();
debug_assert_eq!(truncate(i, size), i,
"Unsigned value {} does not fit in {} bits", i, size.bits());
"Unsigned value {} does not fit in {} bits", i, size.bits());
Scalar::Bits { bits: i, size: size.bytes() as u8 }
}

Expand All @@ -181,7 +181,7 @@ impl<'tcx> Scalar {
// `into` performed sign extension, we have to truncate
let truncated = truncate(i as u128, size);
debug_assert_eq!(sign_extend(truncated, size) as i128, i,
"Signed value {} does not fit in {} bits", i, size.bits());
"Signed value {} does not fit in {} bits", i, size.bits());
Scalar::Bits { bits: truncated, size: size.bytes() as u8 }
}

Expand Down
31 changes: 13 additions & 18 deletions src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
//!
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html

use graphviz::IntoCow;
use hir::def::CtorKind;
use hir::def_id::DefId;
use hir::{self, HirId, InlineAsm};
Expand Down Expand Up @@ -327,22 +326,20 @@ impl<'tcx> Mir<'tcx> {
if idx < stmts.len() {
&stmts[idx].source_info
} else {
assert!(idx == stmts.len());
assert_eq!(idx, stmts.len());
&block.terminator().source_info
}
}

/// Check if `sub` is a sub scope of `sup`
pub fn is_sub_scope(&self, mut sub: SourceScope, sup: SourceScope) -> bool {
loop {
if sub == sup {
return true;
}
while sub != sup {
match self.source_scopes[sub].parent_scope {
None => return false,
Some(p) => sub = p,
}
}
true
}

/// Return the return type, it always return first element from `local_decls` array
Expand Down Expand Up @@ -526,9 +523,7 @@ impl BorrowKind {
pub fn allows_two_phase_borrow(&self) -> bool {
match *self {
BorrowKind::Shared | BorrowKind::Shallow | BorrowKind::Unique => false,
BorrowKind::Mut {
allow_two_phase_borrow,
} => allow_two_phase_borrow,
BorrowKind::Mut { allow_two_phase_borrow } => allow_two_phase_borrow,
}
}
}
Expand Down Expand Up @@ -1551,42 +1546,42 @@ impl<'tcx> TerminatorKind<'tcx> {
};
fmt_const_val(&mut s, &c).unwrap();
s.into()
}).chain(iter::once(String::from("otherwise").into()))
}).chain(iter::once("otherwise".into()))
.collect()
}
Call {
destination: Some(_),
cleanup: Some(_),
..
} => vec!["return".into_cow(), "unwind".into_cow()],
} => vec!["return".into(), "unwind".into()],
Call {
destination: Some(_),
cleanup: None,
..
} => vec!["return".into_cow()],
} => vec!["return".into()],
Call {
destination: None,
cleanup: Some(_),
..
} => vec!["unwind".into_cow()],
} => vec!["unwind".into()],
Call {
destination: None,
cleanup: None,
..
} => vec![],
Yield { drop: Some(_), .. } => vec!["resume".into_cow(), "drop".into_cow()],
Yield { drop: None, .. } => vec!["resume".into_cow()],
Yield { drop: Some(_), .. } => vec!["resume".into(), "drop".into()],
Yield { drop: None, .. } => vec!["resume".into()],
DropAndReplace { unwind: None, .. } | Drop { unwind: None, .. } => {
vec!["return".into_cow()]
vec!["return".into()]
}
DropAndReplace {
unwind: Some(_), ..
}
| Drop {
unwind: Some(_), ..
} => vec!["return".into_cow(), "unwind".into_cow()],
} => vec!["return".into(), "unwind".into()],
Assert { cleanup: None, .. } => vec!["".into()],
Assert { .. } => vec!["success".into_cow(), "unwind".into_cow()],
Assert { .. } => vec!["success".into(), "unwind".into()],
FalseEdges {
ref imaginary_targets,
..
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mono.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
String::new()
};

let crate_disambiguator = format!("{}", tcx.crate_disambiguator(cnum));
let crate_disambiguator = tcx.crate_disambiguator(cnum).to_string();
// Using a shortened disambiguator of about 40 bits
format!("{}.{}{}",
tcx.crate_name(cnum),
Expand Down
12 changes: 6 additions & 6 deletions src/librustc/mir/tcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> {
assert!(index < adt_def.variants.len());
assert_eq!(adt_def, adt_def1);
PlaceTy::Downcast { adt_def,
substs,
variant_index: index }
substs,
variant_index: index }
}
_ => {
bug!("cannot downcast non-ADT type: `{:?}`", self)
Expand Down Expand Up @@ -151,7 +151,7 @@ impl<'tcx> Place<'tcx> {
}
},
_ => None,
}
}
_ => None,
}
}
Expand Down Expand Up @@ -255,9 +255,9 @@ impl<'tcx> Operand<'tcx> {

impl<'tcx> BinOp {
pub fn ty<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>)
-> Ty<'tcx> {
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>)
-> Ty<'tcx> {
// FIXME: handle SIMD correctly
match self {
&BinOp::Add | &BinOp::Sub | &BinOp::Mul | &BinOp::Div | &BinOp::Rem |
Expand Down