-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
7 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|