diff options
| author | bors <bors@rust-lang.org> | 2019-06-05 18:29:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-06-05 18:29:39 +0000 |
| commit | 7cdaffd7962c4aae0cadd82baa241901b03f9458 (patch) | |
| tree | f053afdeb0cc36faa2d4c419cbf370e467c6d854 | |
| parent | 47f4975cd751a03c941431b35cd7a6cba6201730 (diff) | |
| parent | 694b0486371752cd75270788f30e19a16601f88d (diff) | |
| download | rust-7cdaffd7962c4aae0cadd82baa241901b03f9458.tar.gz rust-7cdaffd7962c4aae0cadd82baa241901b03f9458.zip | |
Auto merge of #61548 - Centril:rollup-5t6cvbk, r=Centril
Rollup of 5 pull requests Successful merges: - #61503 (Fix cfg(test) build for x86_64-fortanix-unknown-sgx) - #61534 (Edit docs of ExitStatus) - #61536 (Don't allow using const fn arguments as "args_required_const") - #61538 (Don't use GNU noexec stack note) - #61546 (azure: Fix some minor issues which have broken our configuration ) Failed merges: r? @ghost
| -rw-r--r-- | .azure-pipelines/steps/run.yml | 5 | ||||
| -rw-r--r-- | src/librustc_mir/transform/qualify_consts.rs | 4 | ||||
| -rw-r--r-- | src/librustc_target/spec/netbsd_base.rs | 3 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 3 | ||||
| -rw-r--r-- | src/libstd/process.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/consts/const_arg_promotable2.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/consts/const_arg_promotable2.stderr | 8 |
7 files changed, 40 insertions, 6 deletions
diff --git a/.azure-pipelines/steps/run.yml b/.azure-pipelines/steps/run.yml index cfa28a6a1d7..a646b34fe7d 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 fe94181047f..8696291e058 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 e9cd98c0e71..72e2fd59cf8 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 e044b46e0d0..a3356e6be2c 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 6e4c6e4c366..a568f466637 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1153,10 +1153,13 @@ impl From<fs::File> 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 00000000000..3399e51ed4e --- /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 00000000000..149d1ce8940 --- /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 + |
