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 12 pull requests #52001

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e7c122c
Revert "Remove TryFrom impls that might become conditionally-infallib…
SimonSapin Jun 6, 2018
b4d64b7
Initialize LLVM's AMDGPU target machine, if available.
DiamondLovesYou Jun 14, 2018
7015dfd
Add read_exact_at and write_all_at methods to FileExt on unix
drrlvn Jun 26, 2018
6cc78bf
in which we plug the crack where `?`-desugaring leaked into errors
zackmdavis Jun 30, 2018
c613aa5
Improve error messages when assigning to a local that starts initialized
matthewjasper Jun 30, 2018
de2ecea
Provide llvm-strip in llvm-tools component
crlf0710 Jul 1, 2018
e89db30
Do not suggest changes to str literal if it isn't one
estebank Jul 2, 2018
6e5b9c1
Get rid of `TyImplTraitExistential`
oli-obk Jun 29, 2018
75a6fde
Update rustdoc
oli-obk Jul 2, 2018
ea806e7
Removed `uninitialized_statics` field from `Memory` struct in miri.
alexreg Jun 8, 2018
73166f7
Fill in tracking issue number for read_exact_at/write_all_at
drrlvn Jul 2, 2018
59f2edb
add outlives annotations to `BTreeMap`
nikomatsakis Feb 20, 2018
6660c25
Updated miri submodule.
alexreg Jul 2, 2018
ddc1d29
bootstrap: tests should use rustc from config.toml
mnd Jul 1, 2018
c6bbee8
Fix a bug with return in anonymous consts
varkor Jul 1, 2018
7ad1c62
Fix an ICE using break and continue as array lengths
varkor Jul 1, 2018
998141f
Fix another return-const ICE
varkor Jul 1, 2018
b00050f
Add more safeguards to "missing binding mode" errors
varkor Jul 1, 2018
30fde04
Clean up error messages regarding break/continue inside consts
varkor Jul 1, 2018
0195714
Fix ICEs with match/return expressions inside array lengths
varkor Jul 1, 2018
90eee7d
Remove early error abort
varkor Jul 1, 2018
4d66b65
Fix issue-50585 test
varkor Jul 1, 2018
adf4ef7
Use LitToConstError rather than bool for errors
varkor Jul 2, 2018
fdff278
Rollup merge of #51428 - alexreg:uninitialized-statics-simplification…
Mark-Simulacrum Jul 2, 2018
02cde65
Rollup merge of #51548 - DiamondLovesYou:amdgpu-target-machine, r=ale…
Mark-Simulacrum Jul 2, 2018
b7e6e18
Rollup merge of #51564 - SimonSapin:try-int, r=alexcrichton
Mark-Simulacrum Jul 2, 2018
980b799
Rollup merge of #51809 - drrlvn:rw_exact_all_at, r=alexcrichton
Mark-Simulacrum Jul 2, 2018
58e0cff
Rollup merge of #51914 - nikomatsakis:nll-fix-issue-issue-btreemap-an…
Mark-Simulacrum Jul 2, 2018
7cbe019
Rollup merge of #51926 - matthewjasper:Initialization-span, r=nikomat…
Mark-Simulacrum Jul 2, 2018
898882b
Rollup merge of #51938 - zackmdavis:and_the_case_of_the_leaking_desug…
Mark-Simulacrum Jul 2, 2018
7fc299e
Rollup merge of #51962 - crlf0710:patch-2, r=alexcrichton
Mark-Simulacrum Jul 2, 2018
7c9ba44
Rollup merge of #51967 - varkor:const-body-break-continue, r=estebank
Mark-Simulacrum Jul 2, 2018
2edff1d
Rollup merge of #51977 - mnd:fix-bootstrap-test-with-local-stage0, r=…
Mark-Simulacrum Jul 2, 2018
55caead
Rollup merge of #51978 - estebank:issue-48364, r=oli-obk
Mark-Simulacrum Jul 2, 2018
4dcaf90
Rollup merge of #51979 - oli-obk:lowering_cleanups4, r=nikomatsakis
Mark-Simulacrum Jul 2, 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
2 changes: 2 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,8 @@ def bootstrap(help_triggered):
env["BOOTSTRAP_PYTHON"] = sys.executable
env["BUILD_DIR"] = build.build_dir
env["RUSTC_BOOTSTRAP"] = '1'
env["CARGO"] = build.cargo()
env["RUSTC"] = build.rustc()
run(args, env=env, verbose=build.verbose)


Expand Down
6 changes: 2 additions & 4 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use std::cmp;

use num_cpus;
use toml;
use util::exe;
use cache::{INTERNER, Interned};
use flags::Flags;
pub use flags::Subcommand;
Expand Down Expand Up @@ -367,9 +366,8 @@ impl Config {
config.src = Config::path_from_python("SRC");
config.out = Config::path_from_python("BUILD_DIR");

let stage0_root = config.out.join(&config.build).join("stage0/bin");
config.initial_rustc = stage0_root.join(exe("rustc", &config.build));
config.initial_cargo = stage0_root.join(exe("cargo", &config.build));
config.initial_rustc = Config::path_from_python("RUSTC");
config.initial_cargo = Config::path_from_python("CARGO");

config
}
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ const LLVM_TOOLS: &[&str] = &[
"llvm-objcopy", // used to transform ELFs into binary format which flashing tools consume
"llvm-objdump", // used to disassemble programs
"llvm-profdata", // used to inspect and merge files generated by profiles
"llvm-size", // prints the size of the linker sections of a program
"llvm-size", // used to prints the size of the linker sections of a program
"llvm-strip", // used to discard symbols from binary files to reduce their size
];

/// A structure representing a Rust compiler.
Expand Down
17 changes: 10 additions & 7 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
fn clone(&self) -> BTreeMap<K, V> {
fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
K,
V,
marker::LeafOrInternal>)
-> BTreeMap<K, V> {

fn clone_subtree<'a, K: Clone, V: Clone>(
node: node::NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
) -> BTreeMap<K, V>
where K: 'a, V: 'a,
{
match node.force() {
Leaf(leaf) => {
let mut out_tree = BTreeMap {
Expand Down Expand Up @@ -1080,7 +1079,11 @@ impl<K: Ord, V> BTreeMap<K, V> {

/// Calculates the number of elements if it is incorrect.
fn recalc_length(&mut self) {
fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
fn dfs<'a, K, V>(
node: NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
) -> usize
where K: 'a, V: 'a
{
let mut res = node.len();

if let Internal(node) = node.force() {
Expand Down
75 changes: 2 additions & 73 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ macro_rules! step_impl_unsigned {
#[inline]
#[allow(unreachable_patterns)]
fn add_usize(&self, n: usize) -> Option<Self> {
match <$t>::private_try_from(n) {
match <$t>::try_from(n) {
Ok(n_as_t) => self.checked_add(n_as_t),
Err(_) => None,
}
Expand Down Expand Up @@ -123,7 +123,7 @@ macro_rules! step_impl_signed {
#[inline]
#[allow(unreachable_patterns)]
fn add_usize(&self, n: usize) -> Option<Self> {
match <$unsigned>::private_try_from(n) {
match <$unsigned>::try_from(n) {
Ok(n_as_unsigned) => {
// Wrapping in unsigned space handles cases like
// `-120_i8.add_usize(200) == Some(80_i8)`,
Expand Down Expand Up @@ -461,74 +461,3 @@ impl<A: Step> DoubleEndedIterator for ops::RangeInclusive<A> {

#[stable(feature = "fused", since = "1.26.0")]
impl<A: Step> FusedIterator for ops::RangeInclusive<A> {}

/// Compensate removal of some impls per
/// https://github.com/rust-lang/rust/pull/49305#issuecomment-376293243
trait PrivateTryFromUsize: Sized {
fn private_try_from(n: usize) -> Result<Self, ()>;
}

impl<T> PrivateTryFromUsize for T where T: TryFrom<usize> {
#[inline]
fn private_try_from(n: usize) -> Result<Self, ()> {
T::try_from(n).map_err(|_| ())
}
}

// no possible bounds violation
macro_rules! try_from_unbounded {
($($target:ty),*) => {$(
impl PrivateTryFromUsize for $target {
#[inline]
fn private_try_from(value: usize) -> Result<Self, ()> {
Ok(value as $target)
}
}
)*}
}

// unsigned to signed (only positive bound)
#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
macro_rules! try_from_upper_bounded {
($($target:ty),*) => {$(
impl PrivateTryFromUsize for $target {
#[inline]
fn private_try_from(u: usize) -> Result<$target, ()> {
if u > (<$target>::max_value() as usize) {
Err(())
} else {
Ok(u as $target)
}
}
}
)*}
}


#[cfg(target_pointer_width = "16")]
mod ptr_try_from_impls {
use super::PrivateTryFromUsize;

try_from_unbounded!(u16, u32, u64, u128);
try_from_unbounded!(i32, i64, i128);
}

#[cfg(target_pointer_width = "32")]
mod ptr_try_from_impls {
use super::PrivateTryFromUsize;

try_from_upper_bounded!(u16);
try_from_unbounded!(u32, u64, u128);
try_from_upper_bounded!(i32);
try_from_unbounded!(i64, i128);
}

#[cfg(target_pointer_width = "64")]
mod ptr_try_from_impls {
use super::PrivateTryFromUsize;

try_from_upper_bounded!(u16, u32);
try_from_unbounded!(u64, u128);
try_from_upper_bounded!(i32, i64);
try_from_unbounded!(i128);
}
70 changes: 60 additions & 10 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4213,6 +4213,21 @@ impl From<!> for TryFromIntError {
}
}

// no possible bounds violation
macro_rules! try_from_unbounded {
($source:ty, $($target:ty),*) => {$(
#[unstable(feature = "try_from", issue = "33417")]
impl TryFrom<$source> for $target {
type Error = TryFromIntError;

#[inline]
fn try_from(value: $source) -> Result<Self, Self::Error> {
Ok(value as $target)
}
}
)*}
}

// only negative bounds
macro_rules! try_from_lower_bounded {
($source:ty, $($target:ty),*) => {$(
Expand Down Expand Up @@ -4311,44 +4326,79 @@ try_from_both_bounded!(i128, u64, u32, u16, u8);
try_from_upper_bounded!(usize, isize);
try_from_lower_bounded!(isize, usize);

try_from_upper_bounded!(usize, u8);
try_from_upper_bounded!(usize, i8, i16);
try_from_both_bounded!(isize, u8);
try_from_both_bounded!(isize, i8);

#[cfg(target_pointer_width = "16")]
mod ptr_try_from_impls {
use super::TryFromIntError;
use convert::TryFrom;

// Fallible across platfoms, only implementation differs
try_from_upper_bounded!(usize, u8);
try_from_unbounded!(usize, u16, u32, u64, u128);
try_from_upper_bounded!(usize, i8, i16);
try_from_unbounded!(usize, i32, i64, i128);

try_from_both_bounded!(isize, u8);
try_from_lower_bounded!(isize, u16, u32, u64, u128);
try_from_both_bounded!(isize, i8);
try_from_unbounded!(isize, i16, i32, i64, i128);

rev!(try_from_upper_bounded, usize, u32, u64, u128);
rev!(try_from_lower_bounded, usize, i8, i16);
rev!(try_from_both_bounded, usize, i32, i64, i128);

rev!(try_from_upper_bounded, isize, u16, u32, u64, u128);
rev!(try_from_both_bounded, isize, i32, i64, i128);
}

#[cfg(target_pointer_width = "32")]
mod ptr_try_from_impls {
use super::TryFromIntError;
use convert::TryFrom;

// Fallible across platfoms, only implementation differs
try_from_both_bounded!(isize, u16);
try_from_upper_bounded!(usize, u8, u16);
try_from_unbounded!(usize, u32, u64, u128);
try_from_upper_bounded!(usize, i8, i16, i32);
try_from_unbounded!(usize, i64, i128);

try_from_both_bounded!(isize, u8, u16);
try_from_lower_bounded!(isize, u32, u64, u128);
try_from_both_bounded!(isize, i8, i16);
try_from_unbounded!(isize, i32, i64, i128);

rev!(try_from_unbounded, usize, u32);
rev!(try_from_upper_bounded, usize, u64, u128);
rev!(try_from_lower_bounded, usize, i8, i16, i32);
rev!(try_from_both_bounded, usize, i64, i128);

rev!(try_from_unbounded, isize, u16);
rev!(try_from_upper_bounded, isize, u32, u64, u128);
rev!(try_from_unbounded, isize, i32);
rev!(try_from_both_bounded, isize, i64, i128);
}

#[cfg(target_pointer_width = "64")]
mod ptr_try_from_impls {
use super::TryFromIntError;
use convert::TryFrom;

// Fallible across platfoms, only implementation differs
try_from_both_bounded!(isize, u16, u32);
try_from_upper_bounded!(usize, u8, u16, u32);
try_from_unbounded!(usize, u64, u128);
try_from_upper_bounded!(usize, i8, i16, i32, i64);
try_from_unbounded!(usize, i128);

try_from_both_bounded!(isize, u8, u16, u32);
try_from_lower_bounded!(isize, u64, u128);
try_from_both_bounded!(isize, i8, i16, i32);
try_from_unbounded!(isize, i64, i128);

rev!(try_from_unbounded, usize, u32, u64);
rev!(try_from_upper_bounded, usize, u128);
rev!(try_from_lower_bounded, usize, i8, i16, i32, i64);
rev!(try_from_both_bounded, usize, i128);

rev!(try_from_unbounded, isize, u16, u32);
rev!(try_from_upper_bounded, isize, u64, u128);
rev!(try_from_unbounded, isize, i32, i64);
rev!(try_from_both_bounded, isize, i128);
}

#[doc(hidden)]
Expand Down
Loading