-
Notifications
You must be signed in to change notification settings - Fork 13k
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
2 changed files
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![feature(const_raw_ptr_to_usize_cast)] | ||
|
||
fn main() { | ||
[(); &(static |x| {}) as *const _ as usize]; | ||
//~^ ERROR: closures cannot be static | ||
//~| ERROR: type annotations needed | ||
[(); &(static || {}) as *const _ as usize]; | ||
//~^ ERROR: closures cannot be static | ||
//~| ERROR: evaluation of constant value failed | ||
} |
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,28 @@ | ||
error[E0697]: closures cannot be static | ||
--> $DIR/issue-52432.rs:4:12 | ||
| | ||
LL | [(); &(static |x| {}) as *const _ as usize]; | ||
| ^^^^^^^^^^ | ||
|
||
error[E0697]: closures cannot be static | ||
--> $DIR/issue-52432.rs:7:12 | ||
| | ||
LL | [(); &(static || {}) as *const _ as usize]; | ||
| ^^^^^^^^^ | ||
|
||
error[E0282]: type annotations needed | ||
--> $DIR/issue-52432.rs:4:20 | ||
| | ||
LL | [(); &(static |x| {}) as *const _ as usize]; | ||
| ^ consider giving this closure parameter a type | ||
|
||
error[E0080]: evaluation of constant value failed | ||
--> $DIR/issue-52432.rs:7:10 | ||
| | ||
LL | [(); &(static || {}) as *const _ as usize]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0080, E0282, E0697. | ||
For more information about an error, try `rustc --explain E0080`. |