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 9 pull requests #73768

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
260d5cf
rustbuild: Move compiler-builtins build logic to manifest
alexcrichton Jun 15, 2020
5c20ef4
bootstrap: Configurable musl libdir
tmiasko Jun 17, 2020
7cac209
add missing doc links
RalfJung Jun 21, 2020
55d207a
tweak wording
RalfJung Jun 21, 2020
cb8c94c
improve grammar
RalfJung Jun 21, 2020
f44b8b9
Document the Self keyword
poliorcetics Jun 24, 2020
5232e20
Document the super keyword
poliorcetics Jun 25, 2020
8b368db
Bootstrap: fallback detection of Windows
ajpaverd Jun 25, 2020
1a355a2
Document some invariants correctly/more
oli-obk Jun 25, 2020
42062a5
Shortcuts for min/max on ordinary BTreeMap/BTreeSet iterators
ssomers Jun 22, 2020
cb152ea
Remove blank line
kraai Jun 26, 2020
386637b
Rollup merge of #73374 - alexcrichton:compiler-bulitins-debug-asserti…
Manishearth Jun 26, 2020
442e9c8
Rollup merge of #73456 - tmiasko:musl-libdir, r=Mark-Simulacrum
Manishearth Jun 26, 2020
67401e1
Rollup merge of #73579 - RalfJung:doc-missing-links, r=shepmaster
Manishearth Jun 26, 2020
85ffead
Rollup merge of #73627 - ssomers:btree_iter_min_max, r=Mark-Simulacrum
Manishearth Jun 26, 2020
a611a42
Rollup merge of #73691 - ajpaverd:bootstrap-windows-73689, r=Mark-Sim…
Manishearth Jun 26, 2020
8769d89
Rollup merge of #73694 - poliorcetics:self-upper-keyword, r=Mark-Simu…
Manishearth Jun 26, 2020
87c1c0a
Rollup merge of #73718 - poliorcetics:super-keyword, r=shepmaster
Manishearth Jun 26, 2020
3d349f6
Rollup merge of #73728 - oli-obk:const_prop_cleanup, r=wesleywiser
Manishearth Jun 26, 2020
30948f8
Rollup merge of #73765 - kraai:remove-blank-line, r=jonas-schievink
Manishearth Jun 26, 2020
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
15 changes: 8 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ exclude = [
"obj",
]

# These options are controlled from our rustc wrapper script, so turn them off
# here and have them controlled elsewhere.
[profile.dev]
debug = false
debug-assertions = false
[profile.test]
debug = false
[profile.release.package.compiler_builtins]
# The compiler-builtins crate cannot reference libcore, and it's own CI will
# verify that this is the case. This requires, however, that the crate is built
# without overflow checks and debug assertions. Forcefully disable debug
# assertions and overflow checks here which should ensure that even if these
# assertions are enabled for libstd we won't enable then for compiler_builtins
# which should ensure we still link everything correctly.
debug-assertions = false
overflow-checks = false

[profile.release.package.compiler_builtins]
# For compiler-builtins we always use a high number of codegen units.
Expand Down
9 changes: 6 additions & 3 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
# nightly features
#channel = "dev"

# The root location of the MUSL installation directory.
# The root location of the musl installation directory.
#musl-root = "..."

# By default the `rustc` executable is built with `-Wl,-rpath` flags on Unix
Expand Down Expand Up @@ -521,12 +521,15 @@
# only use static libraries. If unset, the target's default linkage is used.
#crt-static = false

# The root location of the MUSL installation directory. The library directory
# The root location of the musl installation directory. The library directory
# will also need to contain libunwind.a for an unwinding implementation. Note
# that this option only makes sense for MUSL targets that produce statically
# that this option only makes sense for musl targets that produce statically
# linked binaries
#musl-root = "..."

# The full path to the musl libdir.
#musl-libdir = musl-root/lib

# The root location of the `wasm32-wasi` sysroot.
#wasi-root = "..."

Expand Down
24 changes: 0 additions & 24 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,30 +101,6 @@ fn main() {
{
cmd.arg("-C").arg("panic=abort");
}

// Set various options from config.toml to configure how we're building
// code.
let debug_assertions = match env::var("RUSTC_DEBUG_ASSERTIONS") {
Ok(s) => {
if s == "true" {
"y"
} else {
"n"
}
}
Err(..) => "n",
};

// The compiler builtins are pretty sensitive to symbols referenced in
// libcore and such, so we never compile them with debug assertions.
//
// FIXME(rust-lang/cargo#7253) we should be doing this in `builder.rs`
// with env vars instead of doing it here in this script.
if crate_name == Some("compiler_builtins") {
cmd.arg("-C").arg("debug-assertions=no");
} else {
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
}
} else {
// FIXME(rust-lang/cargo#5754) we shouldn't be using special env vars
// here, but rather Cargo should know what flags to pass rustc itself.
Expand Down
6 changes: 6 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ def default_build_triple():
ostype = require(["uname", "-s"], exit=required)
cputype = require(['uname', '-m'], exit=required)

# If we do not have `uname`, assume Windows.
if ostype is None or cputype is None:
return 'x86_64-pc-windows-msvc'

Expand Down Expand Up @@ -236,6 +237,11 @@ def default_build_triple():
if ostype.endswith('WOW64'):
cputype = 'x86_64'
ostype = 'pc-windows-gnu'
elif sys.platform == 'win32':
# Some Windows platforms might have a `uname` command that returns a
# non-standard string (e.g. gnuwin32 tools returns `windows32`). In
# these cases, fall back to using sys.platform.
return 'x86_64-pc-windows-msvc'
else:
err = "unknown OS type: {}".format(ostype)
sys.exit(err)
Expand Down
16 changes: 8 additions & 8 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,14 +950,6 @@ impl<'a> Builder<'a> {
.env("RUSTC", self.out.join("bootstrap/debug/rustc"))
.env("RUSTC_REAL", self.rustc(compiler))
.env("RUSTC_STAGE", stage.to_string())
.env(
"RUSTC_DEBUG_ASSERTIONS",
if mode == Mode::Std {
self.config.rust_debug_assertions_std.to_string()
} else {
self.config.rust_debug_assertions.to_string()
},
)
.env("RUSTC_SYSROOT", &sysroot)
.env("RUSTC_LIBDIR", &libdir)
.env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc"))
Expand Down Expand Up @@ -1041,6 +1033,14 @@ impl<'a> Builder<'a> {
}
};
cargo.env(profile_var("DEBUG"), debuginfo_level.to_string());
cargo.env(
profile_var("DEBUG_ASSERTIONS"),
if mode == Mode::Std {
self.config.rust_debug_assertions_std.to_string()
} else {
self.config.rust_debug_assertions.to_string()
},
);

if !mode.is_tool() {
cargo.env("RUSTC_FORCE_UNSTABLE", "1");
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn copy_self_contained_objects(
// To do that we have to distribute musl startup objects as a part of Rust toolchain
// and link with them manually in the self-contained mode.
if target.contains("musl") {
let srcdir = builder.musl_root(target).unwrap().join("lib");
let srcdir = builder.musl_libdir(target).unwrap();
for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
copy_and_stamp(
builder,
Expand Down Expand Up @@ -279,8 +279,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: Interned<String>, stage: u32, ca
// Help the libc crate compile by assisting it in finding various
// sysroot native libraries.
if target.contains("musl") {
if let Some(p) = builder.musl_root(target) {
let root = format!("native={}/lib", p.to_str().unwrap());
if let Some(p) = builder.musl_libdir(target) {
let root = format!("native={}", p.to_str().unwrap());
cargo.rustflag("-L").rustflag(&root);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ pub struct Target {
pub ndk: Option<PathBuf>,
pub crt_static: Option<bool>,
pub musl_root: Option<PathBuf>,
pub musl_libdir: Option<PathBuf>,
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
Expand Down Expand Up @@ -363,6 +364,7 @@ struct TomlTarget {
android_ndk: Option<String>,
crt_static: Option<bool>,
musl_root: Option<String>,
musl_libdir: Option<String>,
wasi_root: Option<String>,
qemu_rootfs: Option<String>,
no_std: Option<bool>,
Expand Down Expand Up @@ -631,6 +633,7 @@ impl Config {
target.linker = cfg.linker.clone().map(PathBuf::from);
target.crt_static = cfg.crt_static;
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
target.musl_libdir = cfg.musl_libdir.clone().map(PathBuf::from);
target.wasi_root = cfg.wasi_root.clone().map(PathBuf::from);
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);

Expand Down
9 changes: 9 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,15 @@ impl Build {
.map(|p| &**p)
}

/// Returns the "musl libdir" for this `target`.
fn musl_libdir(&self, target: Interned<String>) -> Option<PathBuf> {
let t = self.config.target_config.get(&target)?;
if let libdir @ Some(_) = &t.musl_libdir {
return libdir.clone();
}
self.musl_root(target).map(|root| root.join("lib"))
}

/// Returns the sysroot for the wasi target, if defined
fn wasi_root(&self, target: Interned<String>) -> Option<&Path> {
self.config.target_config.get(&target).and_then(|t| t.wasi_root.as_ref()).map(|p| &**p)
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ pub fn check(build: &mut Build) {
let target = build.config.target_config.entry(target.clone()).or_default();
target.musl_root = Some("/usr".into());
}
match build.musl_root(*target) {
Some(root) => {
if fs::metadata(root.join("lib/libc.a")).is_err() {
panic!("couldn't find libc.a in musl dir: {}", root.join("lib").display());
match build.musl_libdir(*target) {
Some(libdir) => {
if fs::metadata(libdir.join("libc.a")).is_err() {
panic!("couldn't find libc.a in musl libdir: {}", libdir.display());
}
}
None => panic!(
Expand Down
40 changes: 40 additions & 0 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,14 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
fn last(mut self) -> Option<(&'a K, &'a V)> {
self.next_back()
}

fn min(mut self) -> Option<(&'a K, &'a V)> {
self.next()
}

fn max(mut self) -> Option<(&'a K, &'a V)> {
self.next_back()
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand Down Expand Up @@ -1458,6 +1466,14 @@ impl<'a, K: 'a, V: 'a> Iterator for IterMut<'a, K, V> {
fn last(mut self) -> Option<(&'a K, &'a mut V)> {
self.next_back()
}

fn min(mut self) -> Option<(&'a K, &'a mut V)> {
self.next()
}

fn max(mut self) -> Option<(&'a K, &'a mut V)> {
self.next_back()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1595,6 +1611,14 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
fn last(mut self) -> Option<&'a K> {
self.next_back()
}

fn min(mut self) -> Option<&'a K> {
self.next()
}

fn max(mut self) -> Option<&'a K> {
self.next_back()
}
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1768,6 +1792,14 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
fn last(mut self) -> Option<(&'a K, &'a V)> {
self.next_back()
}

fn min(mut self) -> Option<(&'a K, &'a V)> {
self.next()
}

fn max(mut self) -> Option<(&'a K, &'a V)> {
self.next_back()
}
}

#[stable(feature = "map_values_mut", since = "1.10.0")]
Expand Down Expand Up @@ -1853,6 +1885,14 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
fn last(mut self) -> Option<(&'a K, &'a mut V)> {
self.next_back()
}

fn min(mut self) -> Option<(&'a K, &'a mut V)> {
self.next()
}

fn max(mut self) -> Option<(&'a K, &'a mut V)> {
self.next_back()
}
}

impl<'a, K, V> RangeMut<'a, K, V> {
Expand Down
35 changes: 35 additions & 0 deletions src/liballoc/collections/btree/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1291,12 +1291,22 @@ impl<'a, T> Iterator for Iter<'a, T> {
fn next(&mut self) -> Option<&'a T> {
self.iter.next()
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}

fn last(mut self) -> Option<&'a T> {
self.next_back()
}

fn min(mut self) -> Option<&'a T> {
self.next()
}

fn max(mut self) -> Option<&'a T> {
self.next_back()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
Expand All @@ -1321,6 +1331,7 @@ impl<T> Iterator for IntoIter<T> {
fn next(&mut self) -> Option<T> {
self.iter.next().map(|(k, _)| k)
}

fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
Expand Down Expand Up @@ -1359,6 +1370,14 @@ impl<'a, T> Iterator for Range<'a, T> {
fn last(mut self) -> Option<&'a T> {
self.next_back()
}

fn min(mut self) -> Option<&'a T> {
self.next()
}

fn max(mut self) -> Option<&'a T> {
self.next_back()
}
}

#[stable(feature = "btree_range", since = "1.17.0")]
Expand Down Expand Up @@ -1429,6 +1448,10 @@ impl<'a, T: Ord> Iterator for Difference<'a, T> {
};
(self_len.saturating_sub(other_len), Some(self_len))
}

fn min(mut self) -> Option<&'a T> {
self.next()
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand Down Expand Up @@ -1460,6 +1483,10 @@ impl<'a, T: Ord> Iterator for SymmetricDifference<'a, T> {
// the number of elements to less than half the range of usize.
(0, Some(a_len + b_len))
}

fn min(mut self) -> Option<&'a T> {
self.next()
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand Down Expand Up @@ -1516,6 +1543,10 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> {
IntersectionInner::Answer(Some(_)) => (1, Some(1)),
}
}

fn min(mut self) -> Option<&'a T> {
self.next()
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand All @@ -1541,6 +1572,10 @@ impl<'a, T: Ord> Iterator for Union<'a, T> {
// No checked_add - see SymmetricDifference::size_hint.
(max(a_len, b_len), Some(a_len + b_len))
}

fn min(mut self) -> Option<&'a T> {
self.next()
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand Down
1 change: 0 additions & 1 deletion src/liballoc/raw_vec/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ fn allocator_param() {
//
// Instead, this just checks that the `RawVec` methods do at
// least go through the Allocator API when it reserves

// storage.

// A dumb allocator that consumes a fixed amount of fuel
Expand Down
Loading