-
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.
- Loading branch information
1 parent
02b1be1
commit 027a557
Showing
26 changed files
with
86 additions
and
133 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
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
1 change: 0 additions & 1 deletion
1
src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const_with_const_extern_fn.fixed
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
1 change: 0 additions & 1 deletion
1
src/tools/clippy/tests/ui/missing_const_for_fn/could_be_const_with_const_extern_fn.rs
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
2 changes: 0 additions & 2 deletions
2
tests/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![feature(const_extern_fn)] | ||
|
||
extern "C" { | ||
fn regular_in_block(); | ||
} | ||
|
4 changes: 2 additions & 2 deletions
4
tests/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr
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
9 changes: 4 additions & 5 deletions
9
tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
#![feature(const_extern_fn)] | ||
|
||
const extern "C" fn ptr_cast(val: *const u8) { val as usize; } | ||
//~^ ERROR pointers cannot be cast to integers | ||
|
||
const extern "C" fn ptr_cast(val: *const u8) { | ||
val as usize; | ||
//~^ ERROR pointers cannot be cast to integers | ||
} | ||
|
||
fn main() {} |
6 changes: 3 additions & 3 deletions
6
tests/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr
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
10 changes: 8 additions & 2 deletions
10
tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
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 |
---|---|---|
@@ -1,12 +1,18 @@ | ||
#![feature(const_extern_fn)] | ||
|
||
const unsafe extern "C" fn foo() -> usize { | ||
5 | ||
} | ||
|
||
const unsafe extern "C-unwind" fn bar() -> usize { | ||
5 | ||
} | ||
|
||
fn main() { | ||
let a: [u8; foo()]; | ||
//~^ call to unsafe function `foo` is unsafe and requires unsafe function or block | ||
foo(); | ||
//~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block | ||
let b: [u8; bar()]; | ||
//~^ call to unsafe function `bar` is unsafe and requires unsafe function or block | ||
bar(); | ||
//~^ ERROR call to unsafe function `bar` is unsafe and requires unsafe function or block | ||
} |
22 changes: 19 additions & 3 deletions
22
tests/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.stderr
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 |
---|---|---|
@@ -1,19 +1,35 @@ | ||
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:10:5 | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:12:5 | ||
| | ||
LL | foo(); | ||
| ^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function `bar` is unsafe and requires unsafe function or block | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:16:5 | ||
| | ||
LL | bar(); | ||
| ^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:8:17 | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:10:17 | ||
| | ||
LL | let a: [u8; foo()]; | ||
| ^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error: aborting due to 2 previous errors | ||
error[E0133]: call to unsafe function `bar` is unsafe and requires unsafe function or block | ||
--> $DIR/const-extern-fn-requires-unsafe.rs:14:17 | ||
| | ||
LL | let b: [u8; bar()]; | ||
| ^^^^^ call to unsafe function | ||
| | ||
= note: consult the function's documentation for information on how to avoid undefined behavior | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0133`. |
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
13 changes: 0 additions & 13 deletions
13
tests/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
tests/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.