-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
62 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![crate_type = "lib"] | ||
|
||
const A: std::fmt::Arguments = format_args!("literal"); | ||
|
||
const B: std::fmt::Arguments = format_args!("{}", 123); | ||
//~^ ERROR calls in constants are limited to | ||
//~| ERROR calls in constants are limited to | ||
//~| ERROR temporary value |
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,32 @@ | ||
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants | ||
--> $DIR/format_args.rs:5:32 | ||
| | ||
LL | const B: std::fmt::Arguments = format_args!("{}", 123); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants | ||
--> $DIR/format_args.rs:5:32 | ||
| | ||
LL | const B: std::fmt::Arguments = format_args!("{}", 123); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/format_args.rs:5:32 | ||
| | ||
LL | const B: std::fmt::Arguments = format_args!("{}", 123); | ||
| ^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | | ||
| | temporary value is freed at the end of this statement | ||
| creates a temporary which is freed while still in use | ||
| using this value as a constant requires that borrow lasts for `'static` | ||
| | ||
= note: this error originates in the macro `format_args` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0015, E0716. | ||
For more information about an error, try `rustc --explain E0015`. |