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
This commit is contained in:
bors 2019-06-05 18:29:39 +00:00
commit 7cdaffd796
7 changed files with 40 additions and 6 deletions

View File

@ -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

View File

@ -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();

View File

@ -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 {

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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