-
Notifications
You must be signed in to change notification settings - Fork 346
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
3 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,11 @@ | ||
//@only-target-x86_64: uses x86 target features | ||
|
||
fn main() { | ||
assert!(!is_x86_feature_detected!("ssse3")); | ||
unsafe { | ||
ssse3_fn(); //~ ERROR: calling a function that requires unavailable target features: ssse3 | ||
} | ||
} | ||
|
||
#[target_feature(enable = "ssse3")] | ||
unsafe fn ssse3_fn() {} |
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,15 @@ | ||
error: Undefined Behavior: calling a function that requires unavailable target features: ssse3 | ||
--> $DIR/target_feature.rs:LL:CC | ||
| | ||
LL | ssse3_fn(); | ||
| ^^^^^^^^^^ calling a function that requires unavailable target features: ssse3 | ||
| | ||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior | ||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information | ||
= note: BACKTRACE: | ||
= note: inside `main` at $DIR/target_feature.rs:LL:CC | ||
|
||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace | ||
|
||
error: aborting due to previous error | ||
|
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,12 @@ | ||
//@only-target-x86_64: uses x86 target features | ||
//@compile-flags: -C target-feature=+ssse3 | ||
|
||
fn main() { | ||
assert!(is_x86_feature_detected!("ssse3")); | ||
unsafe { | ||
ssse3_fn(); | ||
} | ||
} | ||
|
||
#[target_feature(enable = "ssse3")] | ||
unsafe fn ssse3_fn() {} |