Skip to content

Rollup of 10 pull requests #63640

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

Merged
merged 29 commits into from
Aug 16, 2019
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7b6ad60
Add custom nth_back for Chain
acrrd May 2, 2019
f161efa
1. support crt-static
bpangWR Aug 12, 2019
66dc08a
Make sure that all file loading happens via SourceMap
matklad Aug 13, 2019
14bc998
Add regression test for include_str! normalization
matklad Aug 15, 2019
c01ba2f
add sparc64-unknown-openbsd target
semarie Aug 15, 2019
403e672
Merge pull request #1 from Wind-River/vxworks_bpang_static
BaoshanPang Aug 15, 2019
a9ecfd7
Hygienize use of built-in macros in the standard library
petrochenkov Aug 15, 2019
263e3c5
Remove `__rust_unstable_column`
petrochenkov Aug 15, 2019
170aced
Fix a comment for the def_path_table.
vext01 Aug 16, 2019
8e4d0ac
CrateStore comment fix.
vext01 Aug 16, 2019
b565ece
Remove redundant `ty` fields from `mir::Constant` and `hair::pattern:…
eddyb Aug 12, 2019
9107ec1
rustc_mir: add sanity asserts for the types of `ty::Const`s.
eddyb Aug 12, 2019
2ff337a
rustc_mir: use the right type for associated const literals.
eddyb Aug 12, 2019
45980e8
bless you nll
eddyb Aug 16, 2019
d50a9b1
ci: properly set the job name in CPU stats
pietroalbini Aug 16, 2019
9df2dac
ci: move linkcheck from mingw-2 to mingw-1
pietroalbini Aug 16, 2019
36b18a1
Rename CollectionAllocError to TryReserveError
SimonSapin Jun 12, 2019
a92c29b
Update hashbrown to 0.5.0
SimonSapin Jun 12, 2019
59a3409
Add the Layout of the failed allocation to TryReserveError::AllocError
SimonSapin Jun 12, 2019
e632daf
Rollup merge of #60492 - acrrd:issues/54054_chain, r=SimonSapin
Centril Aug 16, 2019
aec047e
Rollup merge of #61780 - SimonSapin:container-error, r=Amanieu
Centril Aug 16, 2019
db3bae0
Rollup merge of #63495 - eddyb:mir-constant-ty, r=oli-obk
Centril Aug 16, 2019
c83d3c3
Rollup merge of #63525 - matklad:centraliza-file-loading, r=petrochenkov
Centril Aug 16, 2019
c53ce3b
Rollup merge of #63595 - semarie:openbsd-sparc64, r=alexcrichton
Centril Aug 16, 2019
b731131
Rollup merge of #63604 - Wind-River:master, r=alexcrichton
Centril Aug 16, 2019
cd21715
Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichton
Centril Aug 16, 2019
f40a280
Rollup merge of #63632 - vext01:vext01-comment-fixes, r=eddyb
Centril Aug 16, 2019
4c3f21b
Rollup merge of #63634 - pietroalbini:cpu-stats-name, r=alexcrichton
Centril Aug 16, 2019
6b0a838
Rollup merge of #63636 - pietroalbini:ci-mingw, r=alexcrichton
Centril Aug 16, 2019
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
12 changes: 2 additions & 10 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -1138,19 +1138,12 @@ dependencies = [

[[package]]
name = "hashbrown"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-std-workspace-alloc 1.0.0",
"rustc-std-workspace-core 1.0.0",
]

[[package]]
name = "hashbrown"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -3534,7 +3527,7 @@ dependencies = [
"core 0.0.0",
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_abort 0.0.0",
"panic_unwind 0.0.0",
@@ -4450,7 +4443,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum globset 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4feaabe24a0a658fd9cf4a9acf6ed284f045c77df0f49020ba3245cfb7b454"
"checksum h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "a539b63339fbbb00e081e84b6e11bd1d9634a82d91da2984a18ac74a8823f392"
"checksum handlebars 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "df044dd42cdb7e32f28557b661406fc0f2494be75199779998810dbc35030e0d"
"checksum hashbrown 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9529213c67695ca2d146e6f263b7b72df8fa973368beadf767e8ed80c03f2f36"
"checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353"
"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82"
"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
2 changes: 1 addition & 1 deletion src/bootstrap/cc_detect.rs
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
} else if target.contains("openbsd") {
Some(PathBuf::from("ar"))
} else if target.contains("vxworks") {
Some(PathBuf::from("vx-ar"))
Some(PathBuf::from("wr-ar"))
} else {
let parent = cc.parent().unwrap();
let file = cc.file_name().unwrap().to_str().unwrap();
9 changes: 9 additions & 0 deletions src/bootstrap/mk/Makefile.in
Original file line number Diff line number Diff line change
@@ -81,5 +81,14 @@ ci-subset-1:
ci-subset-2:
$(Q)$(BOOTSTRAP) test $(TESTS_IN_2)

TESTS_IN_MINGW_2 := \
src/test/ui \
src/test/compile-fail

ci-mingw-subset-1:
$(Q)$(BOOTSTRAP) test $(TESTS_IN_MINGW_2:%=--exclude %)
ci-mingw-subset-2:
$(Q)$(BOOTSTRAP) test $(TESTS_IN_MINGW_2)


.PHONY: dist
8 changes: 4 additions & 4 deletions src/ci/azure-pipelines/auto.yml
Original file line number Diff line number Diff line change
@@ -272,7 +272,7 @@ jobs:
i686-mingw-1:
MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make ci-subset-1
SCRIPT: make ci-mingw-subset-1
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
MINGW_DIR: mingw32
@@ -282,13 +282,13 @@ jobs:
i686-mingw-2:
MSYS_BITS: 32
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
SCRIPT: make ci-subset-2
SCRIPT: make ci-mingw-subset-2
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
MINGW_ARCHIVE: i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z
MINGW_DIR: mingw32
x86_64-mingw-1:
MSYS_BITS: 64
SCRIPT: make ci-subset-1
SCRIPT: make ci-mingw-subset-1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
@@ -298,7 +298,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
x86_64-mingw-2:
MSYS_BITS: 64
SCRIPT: make ci-subset-2
SCRIPT: make ci-mingw-subset-2
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu
MINGW_URL: https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc
MINGW_ARCHIVE: x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z
2 changes: 1 addition & 1 deletion src/ci/azure-pipelines/steps/run.yml
Original file line number Diff line number Diff line change
@@ -199,7 +199,7 @@ steps:
# Upload CPU usage statistics that we've been gathering this whole time. Always
# execute this step in case we want to inspect failed builds, but don't let
# errors here ever fail the build since this is just informational.
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$SYSTEM_JOBNAME.csv
- bash: aws s3 cp --acl public-read cpu-usage.csv s3://$DEPLOY_BUCKET/rustc-builds/$BUILD_SOURCEVERSION/cpu-$CI_JOB_NAME.csv
env:
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
condition: variables['AWS_SECRET_ACCESS_KEY']
31 changes: 17 additions & 14 deletions src/liballoc/collections/mod.rs
Original file line number Diff line number Diff line change
@@ -41,32 +41,35 @@ pub use linked_list::LinkedList;
#[doc(no_inline)]
pub use vec_deque::VecDeque;

use crate::alloc::{AllocErr, LayoutErr};
use crate::alloc::{Layout, LayoutErr};

/// Augments `AllocErr` with a CapacityOverflow variant.
/// The error type for `try_reserve` methods.
#[derive(Clone, PartialEq, Eq, Debug)]
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub enum CollectionAllocErr {
pub enum TryReserveError {
/// Error due to the computed capacity exceeding the collection's maximum
/// (usually `isize::MAX` bytes).
CapacityOverflow,
/// Error due to the allocator (see the `AllocErr` type's docs).
AllocErr,
}

#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
impl From<AllocErr> for CollectionAllocErr {
#[inline]
fn from(AllocErr: AllocErr) -> Self {
CollectionAllocErr::AllocErr
}
/// The memory allocator returned an error
AllocError {
/// The layout of allocation request that failed
layout: Layout,

#[doc(hidden)]
#[unstable(feature = "container_error_extra", issue = "0", reason = "\
Enable exposing the allocator’s custom error value \
if an associated type is added in the future: \
https://github.com/rust-lang/wg-allocators/issues/23")]
non_exhaustive: (),
},
}

#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
impl From<LayoutErr> for CollectionAllocErr {
impl From<LayoutErr> for TryReserveError {
#[inline]
fn from(_: LayoutErr) -> Self {
CollectionAllocErr::CapacityOverflow
TryReserveError::CapacityOverflow
}
}

16 changes: 8 additions & 8 deletions src/liballoc/collections/vec_deque.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ use core::ptr::{self, NonNull};
use core::slice;
use core::hash::{Hash, Hasher};

use crate::collections::CollectionAllocErr;
use crate::collections::TryReserveError;
use crate::raw_vec::RawVec;
use crate::vec::Vec;

@@ -576,10 +576,10 @@ impl<T> VecDeque<T> {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
/// use std::collections::VecDeque;
///
/// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, CollectionAllocErr> {
/// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
/// let mut output = VecDeque::new();
///
/// // Pre-reserve the memory, exiting if we can't
@@ -595,7 +595,7 @@ impl<T> VecDeque<T> {
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.try_reserve(additional)
}

@@ -614,10 +614,10 @@ impl<T> VecDeque<T> {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
/// use std::collections::VecDeque;
///
/// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, CollectionAllocErr> {
/// fn process_data(data: &[u32]) -> Result<VecDeque<u32>, TryReserveError> {
/// let mut output = VecDeque::new();
///
/// // Pre-reserve the memory, exiting if we can't
@@ -633,12 +633,12 @@ impl<T> VecDeque<T> {
/// # process_data(&[1, 2, 3]).expect("why is the test harness OOMing on 12 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
let old_cap = self.cap();
let used_cap = self.len() + 1;
let new_cap = used_cap.checked_add(additional)
.and_then(|needed_cap| needed_cap.checked_next_power_of_two())
.ok_or(CollectionAllocErr::CapacityOverflow)?;
.ok_or(TryReserveError::CapacityOverflow)?;

if new_cap > old_cap {
self.buf.try_reserve_exact(used_cap, new_cap - used_cap)?;
1 change: 1 addition & 0 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
@@ -87,6 +87,7 @@
#![feature(const_in_array_repeat_expressions)]
#![feature(dispatch_from_dyn)]
#![feature(core_intrinsics)]
#![feature(container_error_extra)]
#![feature(dropck_eyepatch)]
#![feature(exact_size_is_empty)]
#![feature(fmt_internals)]
2 changes: 1 addition & 1 deletion src/liballoc/macros.rs
Original file line number Diff line number Diff line change
@@ -98,5 +98,5 @@ macro_rules! vec {
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
macro_rules! format {
($($arg:tt)*) => ($crate::fmt::format(format_args!($($arg)*)))
($($arg:tt)*) => ($crate::fmt::format(::core::format_args!($($arg)*)))
}
32 changes: 17 additions & 15 deletions src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ use core::ops::Drop;
use core::ptr::{self, NonNull, Unique};
use core::slice;

use crate::alloc::{Alloc, Layout, Global, handle_alloc_error};
use crate::collections::CollectionAllocErr::{self, *};
use crate::alloc::{Alloc, Layout, Global, AllocErr, handle_alloc_error};
use crate::collections::TryReserveError::{self, *};
use crate::boxed::Box;

#[cfg(test)]
@@ -385,7 +385,7 @@ impl<T, A: Alloc> RawVec<T, A> {

/// The same as `reserve_exact`, but returns on errors instead of panicking or aborting.
pub fn try_reserve_exact(&mut self, used_capacity: usize, needed_extra_capacity: usize)
-> Result<(), CollectionAllocErr> {
-> Result<(), TryReserveError> {

self.reserve_internal(used_capacity, needed_extra_capacity, Fallible, Exact)
}
@@ -413,7 +413,7 @@ impl<T, A: Alloc> RawVec<T, A> {
pub fn reserve_exact(&mut self, used_capacity: usize, needed_extra_capacity: usize) {
match self.reserve_internal(used_capacity, needed_extra_capacity, Infallible, Exact) {
Err(CapacityOverflow) => capacity_overflow(),
Err(AllocErr) => unreachable!(),
Err(AllocError { .. }) => unreachable!(),
Ok(()) => { /* yay */ }
}
}
@@ -422,7 +422,7 @@ impl<T, A: Alloc> RawVec<T, A> {
/// needed_extra_capacity` elements. This logic is used in amortized reserve methods.
/// Returns `(new_capacity, new_alloc_size)`.
fn amortized_new_size(&self, used_capacity: usize, needed_extra_capacity: usize)
-> Result<usize, CollectionAllocErr> {
-> Result<usize, TryReserveError> {

// Nothing we can really do about these checks :(
let required_cap = used_capacity.checked_add(needed_extra_capacity)
@@ -435,7 +435,7 @@ impl<T, A: Alloc> RawVec<T, A> {

/// The same as `reserve`, but returns on errors instead of panicking or aborting.
pub fn try_reserve(&mut self, used_capacity: usize, needed_extra_capacity: usize)
-> Result<(), CollectionAllocErr> {
-> Result<(), TryReserveError> {
self.reserve_internal(used_capacity, needed_extra_capacity, Fallible, Amortized)
}

@@ -494,7 +494,7 @@ impl<T, A: Alloc> RawVec<T, A> {
pub fn reserve(&mut self, used_capacity: usize, needed_extra_capacity: usize) {
match self.reserve_internal(used_capacity, needed_extra_capacity, Infallible, Amortized) {
Err(CapacityOverflow) => capacity_overflow(),
Err(AllocErr) => unreachable!(),
Err(AllocError { .. }) => unreachable!(),
Ok(()) => { /* yay */ }
}
}
@@ -640,10 +640,8 @@ impl<T, A: Alloc> RawVec<T, A> {
needed_extra_capacity: usize,
fallibility: Fallibility,
strategy: ReserveStrategy,
) -> Result<(), CollectionAllocErr> {
) -> Result<(), TryReserveError> {
unsafe {
use crate::alloc::AllocErr;

// NOTE: we don't early branch on ZSTs here because we want this
// to actually catch "asking for more than usize::MAX" in that case.
// If we make it past the first branch then we are guaranteed to
@@ -672,12 +670,16 @@ impl<T, A: Alloc> RawVec<T, A> {
None => self.a.alloc(new_layout),
};

match (&res, fallibility) {
let ptr = match (res, fallibility) {
(Err(AllocErr), Infallible) => handle_alloc_error(new_layout),
_ => {}
}
(Err(AllocErr), Fallible) => return Err(TryReserveError::AllocError {
layout: new_layout,
non_exhaustive: (),
}),
(Ok(ptr), _) => ptr,
};

self.ptr = res?.cast().into();
self.ptr = ptr.cast().into();
self.cap = new_cap;

Ok(())
@@ -737,7 +739,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec<T, A> {
// all 4GB in user-space. e.g., PAE or x32

#[inline]
fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
if mem::size_of::<usize>() < 8 && alloc_size > core::isize::MAX as usize {
Err(CapacityOverflow)
} else {
14 changes: 7 additions & 7 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ use core::ptr;
use core::str::{pattern::Pattern, lossy};

use crate::borrow::{Cow, ToOwned};
use crate::collections::CollectionAllocErr;
use crate::collections::TryReserveError;
use crate::boxed::Box;
use crate::str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
use crate::vec::Vec;
@@ -937,9 +937,9 @@ impl String {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
///
/// fn process_data(data: &str) -> Result<String, CollectionAllocErr> {
/// fn process_data(data: &str) -> Result<String, TryReserveError> {
/// let mut output = String::new();
///
/// // Pre-reserve the memory, exiting if we can't
@@ -953,7 +953,7 @@ impl String {
/// # process_data("rust").expect("why is the test harness OOMing on 4 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.vec.try_reserve(additional)
}

@@ -975,9 +975,9 @@ impl String {
///
/// ```
/// #![feature(try_reserve)]
/// use std::collections::CollectionAllocErr;
/// use std::collections::TryReserveError;
///
/// fn process_data(data: &str) -> Result<String, CollectionAllocErr> {
/// fn process_data(data: &str) -> Result<String, TryReserveError> {
/// let mut output = String::new();
///
/// // Pre-reserve the memory, exiting if we can't
@@ -991,7 +991,7 @@ impl String {
/// # process_data("rust").expect("why is the test harness OOMing on 4 bytes?");
/// ```
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
self.vec.try_reserve_exact(additional)
}

Loading