diff --git a/.azure-pipelines/steps/run.yml b/.azure-pipelines/steps/run.yml index cfa28a6a1d70f..a646b34fe7d02 100644 --- a/.azure-pipelines/steps/run.yml +++ b/.azure-pipelines/steps/run.yml @@ -50,6 +50,7 @@ steps: # on since libstd tests require it - bash: | set -e + sudo mkdir -p /etc/docker echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json sudo service docker restart displayName: Enable IPv6 @@ -101,6 +102,10 @@ steps: - bash: | set -e + # Remove any preexisting rustup installation since it can interfere + # with the cargotest step and its auto-detection of things like Clippy in + # the environment + rustup self uninstall -y || true if [ "$IMAGE" = "" ]; then src/ci/run.sh else diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index fe94181047fcd..8696291e05875 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1304,7 +1304,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } } - if self.mode == Mode::Fn { + // No need to do anything in constants and statics, as everything is "constant" anyway + // so promotion would be useless. + if self.mode != Mode::Static && self.mode != Mode::Const { let constant_args = callee_def_id.and_then(|id| { args_required_const(self.tcx, id) }).unwrap_or_default(); diff --git a/src/librustc_target/spec/netbsd_base.rs b/src/librustc_target/spec/netbsd_base.rs index e9cd98c0e7151..72e2fd59cf8d6 100644 --- a/src/librustc_target/spec/netbsd_base.rs +++ b/src/librustc_target/spec/netbsd_base.rs @@ -9,9 +9,6 @@ pub fn opts() -> TargetOptions { // libraries which follow this flag. Thus, use it before // specifying libraries to link to. "-Wl,--as-needed".to_string(), - - // Always enable NX protection when it is available - "-Wl,-z,noexecstack".to_string(), ]); TargetOptions { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e044b46e0d076..a3356e6be2c3f 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -223,7 +223,8 @@ #![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"), feature(global_asm, slice_index_methods, decl_macro, coerce_unsized, sgx_platform, ptr_wrapping_offset_from))] -#![cfg_attr(all(test, target_vendor = "fortanix", target_env = "sgx"), feature(fixed_size_array))] +#![cfg_attr(all(test, target_vendor = "fortanix", target_env = "sgx"), + feature(fixed_size_array, maybe_uninit_extra))] // std is implemented with unstable features, many of which are internal // compiler details that will never be stable diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 6e4c6e4c366e4..a568f46663730 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1153,10 +1153,13 @@ impl From for Stdio { /// /// This `struct` is used to represent the exit status of a child process. /// Child processes are created via the [`Command`] struct and their exit -/// status is exposed through the [`status`] method. +/// status is exposed through the [`status`] method, or the [`wait`] method +/// of a [`Child`] process. /// /// [`Command`]: struct.Command.html +/// [`Child`]: struct.Child.html /// [`status`]: struct.Command.html#method.status +/// [`wait`]: struct.Child.html#method.wait #[derive(PartialEq, Eq, Clone, Copy, Debug)] #[stable(feature = "process", since = "1.0.0")] pub struct ExitStatus(imp::ExitStatus); diff --git a/src/test/ui/consts/const_arg_promotable2.rs b/src/test/ui/consts/const_arg_promotable2.rs new file mode 100644 index 0000000000000..3399e51ed4edb --- /dev/null +++ b/src/test/ui/consts/const_arg_promotable2.rs @@ -0,0 +1,18 @@ +// This test is a regression test for a bug where we only checked function calls in no-const +// functions for `rustc_args_required_const` arguments. This meant that even though `bar` needs its +// argument to be const, inside a const fn (callable at runtime), the value for it may come from a +// non-constant (namely an argument to the const fn). + +#![feature(rustc_attrs)] +const fn foo(a: i32) { + bar(a); //~ ERROR argument 1 is required to be a constant +} + +#[rustc_args_required_const(0)] +const fn bar(_: i32) {} + +fn main() { + // this function call will pass a runtime-value (number of program arguments) to `foo`, which + // will in turn forward it to `bar`, which expects a compile-time argument + foo(std::env::args().count() as i32); +} diff --git a/src/test/ui/consts/const_arg_promotable2.stderr b/src/test/ui/consts/const_arg_promotable2.stderr new file mode 100644 index 0000000000000..149d1ce89408d --- /dev/null +++ b/src/test/ui/consts/const_arg_promotable2.stderr @@ -0,0 +1,8 @@ +error: argument 1 is required to be a constant + --> $DIR/const_arg_promotable2.rs:8:5 + | +LL | bar(a); + | ^^^^^^ + +error: aborting due to previous error +