Skip to content

Commit 7cdaffd

Browse files
committed
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
2 parents 47f4975 + 694b048 commit 7cdaffd

File tree

7 files changed

+40
-6
lines changed

7 files changed

+40
-6
lines changed

.azure-pipelines/steps/run.yml

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ steps:
5050
# on since libstd tests require it
5151
- bash: |
5252
set -e
53+
sudo mkdir -p /etc/docker
5354
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
5455
sudo service docker restart
5556
displayName: Enable IPv6
@@ -101,6 +102,10 @@ steps:
101102

102103
- bash: |
103104
set -e
105+
# Remove any preexisting rustup installation since it can interfere
106+
# with the cargotest step and its auto-detection of things like Clippy in
107+
# the environment
108+
rustup self uninstall -y || true
104109
if [ "$IMAGE" = "" ]; then
105110
src/ci/run.sh
106111
else

src/librustc_mir/transform/qualify_consts.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
13041304
}
13051305
}
13061306

1307-
if self.mode == Mode::Fn {
1307+
// No need to do anything in constants and statics, as everything is "constant" anyway
1308+
// so promotion would be useless.
1309+
if self.mode != Mode::Static && self.mode != Mode::Const {
13081310
let constant_args = callee_def_id.and_then(|id| {
13091311
args_required_const(self.tcx, id)
13101312
}).unwrap_or_default();

src/librustc_target/spec/netbsd_base.rs

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ pub fn opts() -> TargetOptions {
99
// libraries which follow this flag. Thus, use it before
1010
// specifying libraries to link to.
1111
"-Wl,--as-needed".to_string(),
12-
13-
// Always enable NX protection when it is available
14-
"-Wl,-z,noexecstack".to_string(),
1512
]);
1613

1714
TargetOptions {

src/libstd/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@
223223
#![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"),
224224
feature(global_asm, slice_index_methods,
225225
decl_macro, coerce_unsized, sgx_platform, ptr_wrapping_offset_from))]
226-
#![cfg_attr(all(test, target_vendor = "fortanix", target_env = "sgx"), feature(fixed_size_array))]
226+
#![cfg_attr(all(test, target_vendor = "fortanix", target_env = "sgx"),
227+
feature(fixed_size_array, maybe_uninit_extra))]
227228

228229
// std is implemented with unstable features, many of which are internal
229230
// compiler details that will never be stable

src/libstd/process.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1153,10 +1153,13 @@ impl From<fs::File> for Stdio {
11531153
///
11541154
/// This `struct` is used to represent the exit status of a child process.
11551155
/// Child processes are created via the [`Command`] struct and their exit
1156-
/// status is exposed through the [`status`] method.
1156+
/// status is exposed through the [`status`] method, or the [`wait`] method
1157+
/// of a [`Child`] process.
11571158
///
11581159
/// [`Command`]: struct.Command.html
1160+
/// [`Child`]: struct.Child.html
11591161
/// [`status`]: struct.Command.html#method.status
1162+
/// [`wait`]: struct.Child.html#method.wait
11601163
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
11611164
#[stable(feature = "process", since = "1.0.0")]
11621165
pub struct ExitStatus(imp::ExitStatus);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This test is a regression test for a bug where we only checked function calls in no-const
2+
// functions for `rustc_args_required_const` arguments. This meant that even though `bar` needs its
3+
// argument to be const, inside a const fn (callable at runtime), the value for it may come from a
4+
// non-constant (namely an argument to the const fn).
5+
6+
#![feature(rustc_attrs)]
7+
const fn foo(a: i32) {
8+
bar(a); //~ ERROR argument 1 is required to be a constant
9+
}
10+
11+
#[rustc_args_required_const(0)]
12+
const fn bar(_: i32) {}
13+
14+
fn main() {
15+
// this function call will pass a runtime-value (number of program arguments) to `foo`, which
16+
// will in turn forward it to `bar`, which expects a compile-time argument
17+
foo(std::env::args().count() as i32);
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: argument 1 is required to be a constant
2+
--> $DIR/const_arg_promotable2.rs:8:5
3+
|
4+
LL | bar(a);
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)