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 7 pull requests #73790

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
358dc1d
Added io forwarding methods to the stdio structs
Lucretiel May 28, 2020
b60cefe
Removed write_fmt forwarding, to fix recursive borrow issues
Lucretiel Jun 17, 2020
14d385b
Restore some write_fmts
Lucretiel Jun 17, 2020
5c20ef4
bootstrap: Configurable musl libdir
tmiasko Jun 17, 2020
50f20ec
[AVR] Update the rust-lang/llvm-project submodule to include AVR fixe…
dylanmckay Jun 23, 2020
5e28eb5
Adds a clearer message for when the async keyword is missing from a f…
nellshamrell Jun 18, 2020
3678e5c
errors: use `-Z terminal-width` in JSON emitter
davidtwco Jun 26, 2020
89e2c1d
Mark feature gate as accepted
ecstatic-morse May 21, 2020
0438e25
Remove `control_flow_destroyed` and properly lower `&&` and `||`
ecstatic-morse May 21, 2020
8660621
Remove `const_if_match` feature gate from libraries
ecstatic-morse May 21, 2020
23a907e
MIR const-checking
ecstatic-morse May 21, 2020
ff0096d
HIR const-checking
ecstatic-morse May 21, 2020
edd4b36
Update tests
ecstatic-morse May 21, 2020
23d93c3
Remove `const_if_match` from unstable book
ecstatic-morse May 21, 2020
088d036
Require `allow_internal_unstable` in HIR const-checker
ecstatic-morse May 21, 2020
e0d6ad2
Mark `const_loop` feature gate as accepted
ecstatic-morse Jun 26, 2020
839f9c0
Remove uses of `const_loop` in `rustc`
ecstatic-morse Jun 26, 2020
984e536
Stop checking for `while` and `loop` in a const context
ecstatic-morse Jun 26, 2020
df88972
Update psm version
nagisa Jun 26, 2020
8fe1b1d
Update tests
ecstatic-morse Jun 26, 2020
63078c3
Remove `ignore-tidy-filelength`
ecstatic-morse Jun 26, 2020
c091c5d
Rollup merge of #72437 - ecstatic-morse:stabilize-const-if-match, r=o…
Manishearth Jun 27, 2020
86d5e88
Rollup merge of #72705 - Lucretiel:stdio-forwarding, r=Amanieu
Manishearth Jun 27, 2020
73ef79b
Rollup merge of #73456 - tmiasko:musl-libdir, r=Mark-Simulacrum
Manishearth Jun 27, 2020
1fe4789
Rollup merge of #73658 - dylanmckay:avr-update-llvm-submodule-with-pi…
Manishearth Jun 27, 2020
6168396
Rollup merge of #73672 - nellshamrell:async-fix, r=estebank
Manishearth Jun 27, 2020
4d6f115
Rollup merge of #73763 - davidtwco:terminal-width-json-emitter, r=est…
Manishearth Jun 27, 2020
2a941c5
Rollup merge of #73781 - nagisa:psm-up, r=Mark-Simulacrum
Manishearth Jun 27, 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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2663,9 +2663,9 @@ dependencies = [

[[package]]
name = "psm"
version = "0.1.8"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "659ecfea2142a458893bb7673134bad50b752fea932349c213d6a23874ce3aa7"
checksum = "092d385624a084892d07374caa7b0994956692cf40650419a1f1a787a8d229cf"
dependencies = [
"cc",
]
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
6 changes: 3 additions & 3 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,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 @@ -266,8 +266,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
14 changes: 0 additions & 14 deletions src/doc/unstable-book/src/language-features/const-if-match.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#![feature(const_generic_impls_guard)]
#![feature(const_generics)]
#![feature(const_in_array_repeat_expressions)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(cow_is_borrowed)]
#![feature(dispatch_from_dyn)]
#![feature(core_intrinsics)]
Expand Down
1 change: 1 addition & 0 deletions src/libcore/future/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::task::{Context, Poll};
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[stable(feature = "futures_api", since = "1.36.0")]
#[lang = "future_trait"]
#[rustc_on_unimplemented(label = "`{Self}` is not a future", message = "`{Self}` is not a future")]
pub trait Future {
/// The type of value produced on completion.
#[stable(feature = "futures_api", since = "1.36.0")]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#![feature(const_ascii_ctype_on_intrinsics)]
#![feature(const_alloc_layout)]
#![feature(const_discriminant)]
#![feature(const_if_match)]
#![feature(const_loop)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![cfg_attr(bootstrap, feature(const_loop))]
#![feature(const_checked_int_methods)]
#![feature(const_euclidean_int_methods)]
#![feature(const_overflowing_int_methods)]
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ $EndFeature, "
#[stable(feature = "no_panic_abs", since = "1.13.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
pub const fn wrapping_abs(self) -> Self {
if self.is_negative() {
Expand Down Expand Up @@ -1867,7 +1867,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
#[stable(feature = "wrapping", since = "1.7.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
pub const fn overflowing_neg(self) -> (Self, bool) {
if self == Self::MIN {
(Self::MIN, true)
Expand Down Expand Up @@ -2160,7 +2160,7 @@ $EndFeature, "
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_int_methods", since = "1.32.0")]
#[allow(unused_attributes)]
#[allow_internal_unstable(const_if_match)]
#[cfg_attr(bootstrap, allow_internal_unstable(const_if_match))]
#[inline]
#[rustc_inherit_overflow_checks]
pub const fn abs(self) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_ast/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)] // For the `transmute` in `P::new`
#![feature(const_panic)]
#![feature(const_transmute)]
Expand Down
15 changes: 14 additions & 1 deletion src/librustc_errors/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct JsonEmitter {
pretty: bool,
ui_testing: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
}

Expand All @@ -45,6 +46,7 @@ impl JsonEmitter {
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
Expand All @@ -54,13 +56,15 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
macro_backtrace,
}
}

pub fn basic(
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
Expand All @@ -69,6 +73,7 @@ impl JsonEmitter {
Lrc::new(SourceMap::new(file_path_mapping)),
pretty,
json_rendered,
terminal_width,
macro_backtrace,
)
}
Expand All @@ -79,6 +84,7 @@ impl JsonEmitter {
source_map: Lrc<SourceMap>,
pretty: bool,
json_rendered: HumanReadableErrorType,
terminal_width: Option<usize>,
macro_backtrace: bool,
) -> JsonEmitter {
JsonEmitter {
Expand All @@ -88,6 +94,7 @@ impl JsonEmitter {
pretty,
ui_testing: false,
json_rendered,
terminal_width,
macro_backtrace,
}
}
Expand Down Expand Up @@ -247,7 +254,13 @@ impl Diagnostic {
let buf = BufWriter::default();
let output = buf.clone();
je.json_rendered
.new_emitter(Box::new(buf), Some(je.sm.clone()), false, None, je.macro_backtrace)
.new_emitter(
Box::new(buf),
Some(je.sm.clone()),
false,
je.terminal_width,
je.macro_backtrace,
)
.ui_testing(je.ui_testing)
.emit_diagnostic(diag);
let output = Arc::try_unwrap(output.0).unwrap().into_inner().unwrap();
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_feature/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ declare_features! (
(accepted, transparent_enums, "1.42.0", Some(60405), None),
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
(accepted, slice_patterns, "1.42.0", Some(62254), None),
/// Allows the use of `if` and `match` in constants.
(accepted, const_if_match, "1.45.0", Some(49146), None),
/// Allows the use of `loop` and `while` in constants.
(accepted, const_loop, "1.45.0", Some(52000), None),

// -------------------------------------------------------------------------
// feature-group-end: accepted features
Expand Down
6 changes: 0 additions & 6 deletions src/librustc_feature/active.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,6 @@ declare_features! (
/// Allows using the `#[register_tool]` attribute.
(active, register_tool, "1.41.0", Some(66079), None),

/// Allows the use of `if` and `match` in constants.
(active, const_if_match, "1.41.0", Some(49146), None),

/// Allows the use of `#[cfg(sanitize = "option")]`; set when -Zsanitizer is used.
(active, cfg_sanitize, "1.41.0", Some(39699), None),

Expand All @@ -530,9 +527,6 @@ declare_features! (
/// Allows using `&mut` in constant functions.
(active, const_mut_refs, "1.41.0", Some(57349), None),

/// Allows the use of `loop` and `while` in constants.
(active, const_loop, "1.41.0", Some(52000), None),

/// Allows bindings in the subpattern of a binding pattern.
/// For example, you can write `x @ Some(y)`.
(active, bindings_after_at, "1.41.0", Some(65490), None),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_hir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html

#![feature(crate_visibility_modifier)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)] // For the unsizing cast on `&[]`
#![feature(const_panic)]
#![feature(in_band_lifetimes)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_index/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![feature(allow_internal_unstable)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(extend_one)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_infer/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_panic)]
#![feature(extend_one)]
#![feature(never_type)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_if_match)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![feature(const_fn)]
#![feature(const_panic)]
#![feature(const_transmute)]
Expand Down
13 changes: 0 additions & 13 deletions src/librustc_middle/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//!
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/mir/index.html

// ignore-tidy-filelength

use crate::mir::interpret::{GlobalAlloc, Scalar};
use crate::mir::visit::MirVisitable;
use crate::ty::adjustment::PointerCast;
Expand Down Expand Up @@ -148,14 +146,6 @@ pub struct Body<'tcx> {
/// Debug information pertaining to user variables, including captures.
pub var_debug_info: Vec<VarDebugInfo<'tcx>>,

/// Mark this MIR of a const context other than const functions as having converted a `&&` or
/// `||` expression into `&` or `|` respectively. This is problematic because if we ever stop
/// this conversion from happening and use short circuiting, we will cause the following code
/// to change the value of `x`: `let mut x = 42; false && { x = 55; true };`
///
/// List of places where control flow was destroyed. Used for error reporting.
pub control_flow_destroyed: Vec<(Span, String)>,

/// A span representing this MIR, for error reporting.
pub span: Span,

Expand Down Expand Up @@ -185,7 +175,6 @@ impl<'tcx> Body<'tcx> {
arg_count: usize,
var_debug_info: Vec<VarDebugInfo<'tcx>>,
span: Span,
control_flow_destroyed: Vec<(Span, String)>,
generator_kind: Option<GeneratorKind>,
) -> Self {
// We need `arg_count` locals, and one for the return place.
Expand All @@ -212,7 +201,6 @@ impl<'tcx> Body<'tcx> {
span,
required_consts: Vec::new(),
ignore_interior_mut_in_const_validation: false,
control_flow_destroyed,
predecessor_cache: PredecessorCache::new(),
}
}
Expand All @@ -236,7 +224,6 @@ impl<'tcx> Body<'tcx> {
spread_arg: None,
span: DUMMY_SP,
required_consts: Vec::new(),
control_flow_destroyed: Vec::new(),
generator_kind: None,
var_debug_info: Vec::new(),
ignore_interior_mut_in_const_validation: false,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Rust MIR: a lowered representation of Rust.
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(const_if_match)]
#![feature(const_loop)]
#![cfg_attr(bootstrap, feature(const_if_match))]
#![cfg_attr(bootstrap, feature(const_loop))]
#![feature(const_panic)]
#![feature(crate_visibility_modifier)]
#![feature(decl_macro)]
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ fn new_body<'tcx>(
arg_count,
vec![],
span,
vec![],
None,
)
}
Expand Down
Loading