-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ffi_const and ffi_pure extern fn attributes
- Loading branch information
Showing
18 changed files
with
170 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
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
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,16 @@ | ||
// compile-flags: -C no-prepopulate-passes | ||
#![crate_type = "lib"] | ||
#![feature(ffi_const)] | ||
|
||
// CHECK-LABEL: @bar() | ||
#[no_mangle] | ||
pub fn bar() { unsafe { foo() } } | ||
|
||
|
||
extern { | ||
// CHECK-LABEL: @foo() unnamed_addr #1 | ||
// CHECK: attributes #1 = { {{.*}}readnone{{.*}} } | ||
#[no_mangle] | ||
#[ffi_const] | ||
pub fn foo(); | ||
} |
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,13 @@ | ||
// compile-flags: -C no-prepopulate-passes | ||
#![crate_type = "lib"] | ||
#![feature(ffi_pure)] | ||
|
||
// CHECK-LABEL: @bar() | ||
#[no_mangle] | ||
pub fn bar() { unsafe { foo() } } | ||
|
||
extern { | ||
// CHECK-LABEL: @foo() unnamed_addr #1 | ||
// CHECK: attributes #1 = { {{.*}}readonly{{.*}} } | ||
#[ffi_pure] pub fn foo(); | ||
} |
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,7 @@ | ||
// ignore-tidy-linelength | ||
#![crate_type = "lib"] | ||
|
||
extern { | ||
#[ffi_const] //~ ERROR the `#[ffi_const]` attribute is an experimental feature (see issue #58314) | ||
pub fn foo(); | ||
} |
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,11 @@ | ||
error[E0658]: the `#[ffi_const]` attribute is an experimental feature (see issue #58314) | ||
--> $DIR/feature-gate-ffi_const.rs:5:5 | ||
| | ||
LL | #[ffi_const] //~ ERROR the `#[ffi_const]` attribute is an experimental feature (see issue #58314) | ||
| ^^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(ffi_const)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
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,7 @@ | ||
// ignore-tidy-linelength | ||
#![crate_type = "lib"] | ||
|
||
extern { | ||
#[ffi_pure] //~ ERROR the `#[ffi_pure]` attribute is an experimental feature (see issue #58314) | ||
pub fn foo(); | ||
} |
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,11 @@ | ||
error[E0658]: the `#[ffi_pure]` attribute is an experimental feature (see issue #58314) | ||
--> $DIR/feature-gate-ffi_pure.rs:5:5 | ||
| | ||
LL | #[ffi_pure] //~ ERROR the `#[ffi_pure]` attribute is an experimental feature (see issue #58314) | ||
| ^^^^^^^^^^^ | ||
| | ||
= help: add #![feature(ffi_pure)] to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
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,6 @@ | ||
// ignore-tidy-linelength | ||
#![feature(ffi_const)] | ||
#![crate_type = "lib"] | ||
|
||
#[ffi_const] //~ ERROR `#[ffi_const]` may only be used on `extern fn`s [E0725] | ||
pub fn foo() {} |
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,9 @@ | ||
error[E0725]: `#[ffi_const]` may only be used on `extern fn`s | ||
--> $DIR/ffi_const.rs:5:1 | ||
| | ||
LL | #[ffi_const] //~ ERROR `#[ffi_const]` may only be used on `extern fn`s [E0725] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0725`. |
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,6 @@ | ||
// ignore-tidy-linelength | ||
#![feature(ffi_pure)] | ||
#![crate_type = "lib"] | ||
|
||
#[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on `extern fn`s [E0724] | ||
pub fn foo() {} |
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,9 @@ | ||
error[E0724]: `#[ffi_pure]` may only be used on `extern fn`s | ||
--> $DIR/ffi_pure.rs:5:1 | ||
| | ||
LL | #[ffi_pure] //~ ERROR `#[ffi_pure]` may only be used on `extern fn`s [E0724] | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0724`. |