mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Auto merge of #108654 - LeSeulArtichaut:revert-99767, r=compiler-errors
Revert stabilization of `#![feature(target_feature_11)]` This reverts #99767 due to the presence of bugs #108645 and #108646. cc `@joshtriplett` cc tracking issue #69098 r? `@ghost`
This commit is contained in:
commit
13471d3b20
@ -224,23 +224,34 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
|
|||||||
if !tcx.is_closure(did.to_def_id())
|
if !tcx.is_closure(did.to_def_id())
|
||||||
&& tcx.fn_sig(did).skip_binder().unsafety() == hir::Unsafety::Normal
|
&& tcx.fn_sig(did).skip_binder().unsafety() == hir::Unsafety::Normal
|
||||||
{
|
{
|
||||||
// The `#[target_feature]` attribute is allowed on
|
if tcx.sess.target.is_like_wasm || tcx.sess.opts.actually_rustdoc {
|
||||||
// WebAssembly targets on all functions, including safe
|
// The `#[target_feature]` attribute is allowed on
|
||||||
// ones. Other targets have conditions on the usage of
|
// WebAssembly targets on all functions, including safe
|
||||||
// `#[target_feature]` because on most targets
|
// ones. Other targets require that `#[target_feature]` is
|
||||||
// execution of instructions that are not supported is
|
// only applied to unsafe functions (pending the
|
||||||
// considered undefined behavior. For WebAssembly which is a
|
// `target_feature_11` feature) because on most targets
|
||||||
// 100% safe target at execution time it's not possible to
|
// execution of instructions that are not supported is
|
||||||
// execute undefined instructions, and even if a future
|
// considered undefined behavior. For WebAssembly which is a
|
||||||
// feature was added in some form for this it would be a
|
// 100% safe target at execution time it's not possible to
|
||||||
// deterministic trap. There is no undefined behavior when
|
// execute undefined instructions, and even if a future
|
||||||
// executing WebAssembly so `#[target_feature]` is allowed
|
// feature was added in some form for this it would be a
|
||||||
// on safe functions (but again, only for WebAssembly)
|
// deterministic trap. There is no undefined behavior when
|
||||||
//
|
// executing WebAssembly so `#[target_feature]` is allowed
|
||||||
// Note that this is also allowed if `actually_rustdoc` so
|
// on safe functions (but again, only for WebAssembly)
|
||||||
// if a target is documenting some wasm-specific code then
|
//
|
||||||
// it's not spuriously denied.
|
// Note that this is also allowed if `actually_rustdoc` so
|
||||||
if !(tcx.sess.target.is_like_wasm || tcx.sess.opts.actually_rustdoc) {
|
// if a target is documenting some wasm-specific code then
|
||||||
|
// it's not spuriously denied.
|
||||||
|
} else if !tcx.features().target_feature_11 {
|
||||||
|
let mut err = feature_err(
|
||||||
|
&tcx.sess.parse_sess,
|
||||||
|
sym::target_feature_11,
|
||||||
|
attr.span,
|
||||||
|
"`#[target_feature(..)]` can only be applied to `unsafe` functions",
|
||||||
|
);
|
||||||
|
err.span_label(tcx.def_span(did), "not an `unsafe` function");
|
||||||
|
err.emit();
|
||||||
|
} else {
|
||||||
check_target_feature_trait_unsafe(tcx, did, attr.span);
|
check_target_feature_trait_unsafe(tcx, did, attr.span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -467,7 +478,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: DefId) -> CodegenFnAttrs {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// #73631: closures inherit `#[target_feature]` annotations
|
// #73631: closures inherit `#[target_feature]` annotations
|
||||||
if tcx.is_closure(did.to_def_id()) {
|
if tcx.features().target_feature_11 && tcx.is_closure(did.to_def_id()) {
|
||||||
let owner_id = tcx.parent(did.to_def_id());
|
let owner_id = tcx.parent(did.to_def_id());
|
||||||
if tcx.def_kind(owner_id).has_codegen_attrs() {
|
if tcx.def_kind(owner_id).has_codegen_attrs() {
|
||||||
codegen_fn_attrs
|
codegen_fn_attrs
|
||||||
|
@ -314,8 +314,6 @@ declare_features! (
|
|||||||
(accepted, struct_variant, "1.0.0", None, None),
|
(accepted, struct_variant, "1.0.0", None, None),
|
||||||
/// Allows `#[target_feature(...)]`.
|
/// Allows `#[target_feature(...)]`.
|
||||||
(accepted, target_feature, "1.27.0", None, None),
|
(accepted, target_feature, "1.27.0", None, None),
|
||||||
/// Allows the use of `#[target_feature]` on safe functions.
|
|
||||||
(accepted, target_feature_11, "CURRENT_RUSTC_VERSION", Some(69098), None),
|
|
||||||
/// Allows `fn main()` with return types which implements `Termination` (RFC 1937).
|
/// Allows `fn main()` with return types which implements `Termination` (RFC 1937).
|
||||||
(accepted, termination_trait, "1.26.0", Some(43301), None),
|
(accepted, termination_trait, "1.26.0", Some(43301), None),
|
||||||
/// Allows `#[test]` functions where the return type implements `Termination` (RFC 1937).
|
/// Allows `#[test]` functions where the return type implements `Termination` (RFC 1937).
|
||||||
|
@ -510,6 +510,8 @@ declare_features! (
|
|||||||
(active, strict_provenance, "1.61.0", Some(95228), None),
|
(active, strict_provenance, "1.61.0", Some(95228), None),
|
||||||
/// Allows string patterns to dereference values to match them.
|
/// Allows string patterns to dereference values to match them.
|
||||||
(active, string_deref_patterns, "1.67.0", Some(87121), None),
|
(active, string_deref_patterns, "1.67.0", Some(87121), None),
|
||||||
|
/// Allows the use of `#[target_feature]` on safe functions.
|
||||||
|
(active, target_feature_11, "1.45.0", Some(69098), None),
|
||||||
/// Allows using `#[thread_local]` on `static` items.
|
/// Allows using `#[thread_local]` on `static` items.
|
||||||
(active, thread_local, "1.0.0", Some(29594), None),
|
(active, thread_local, "1.0.0", Some(29594), None),
|
||||||
/// Allows defining `trait X = A + B;` alias items.
|
/// Allows defining `trait X = A + B;` alias items.
|
||||||
|
@ -233,6 +233,7 @@
|
|||||||
#![feature(simd_ffi)]
|
#![feature(simd_ffi)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(stmt_expr_attributes)]
|
#![feature(stmt_expr_attributes)]
|
||||||
|
#![feature(target_feature_11)]
|
||||||
#![feature(trait_alias)]
|
#![feature(trait_alias)]
|
||||||
#![feature(transparent_unions)]
|
#![feature(transparent_unions)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
fn inlined_no_sanitize() -> () {
|
fn inlined_no_sanitize() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:37: +0:37
|
let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:37: +0:37
|
||||||
let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
||||||
+ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:23:5: 23:18
|
+ scope 1 (inlined no_sanitize) { // at $DIR/inline_compatibility.rs:24:5: 24:18
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
||||||
- _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
- _1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
||||||
- // mir::Constant
|
- // mir::Constant
|
||||||
- // + span: $DIR/inline_compatibility.rs:23:5: 23:16
|
- // + span: $DIR/inline_compatibility.rs:24:5: 24:16
|
||||||
- // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
|
- // + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
fn inlined_target_feature() -> () {
|
fn inlined_target_feature() -> () {
|
||||||
let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40
|
let mut _0: (); // return place in scope 0 at $DIR/inline_compatibility.rs:+0:40: +0:40
|
||||||
let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
let _1: (); // in scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
||||||
+ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:12:5: 12:21
|
+ scope 1 (inlined target_feature) { // at $DIR/inline_compatibility.rs:13:5: 13:21
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
||||||
- _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
- _1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
||||||
- // mir::Constant
|
- // mir::Constant
|
||||||
- // + span: $DIR/inline_compatibility.rs:12:5: 12:19
|
- // + span: $DIR/inline_compatibility.rs:13:5: 13:19
|
||||||
- // + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
|
- // + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10
|
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:9: +1:10
|
||||||
_1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:13: +1:52
|
_1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:13: +1:52
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/inline_compatibility.rs:41:13: 41:16
|
// + span: $DIR/inline_compatibility.rs:42:13: 42:16
|
||||||
// + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value(<ZST>) }
|
// + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value(<ZST>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
||||||
_1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
_1 = no_sanitize() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:18
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/inline_compatibility.rs:28:5: 28:16
|
// + span: $DIR/inline_compatibility.rs:29:5: 29:16
|
||||||
// + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
|
// + literal: Const { ty: unsafe fn() {no_sanitize}, val: Value(<ZST>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
StorageLive(_1); // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
||||||
_1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
_1 = target_feature() -> bb1; // scope 0 at $DIR/inline_compatibility.rs:+1:5: +1:21
|
||||||
// mir::Constant
|
// mir::Constant
|
||||||
// + span: $DIR/inline_compatibility.rs:17:5: 17:19
|
// + span: $DIR/inline_compatibility.rs:18:5: 18:19
|
||||||
// + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
|
// + literal: Const { ty: unsafe fn() {target_feature}, val: Value(<ZST>) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(no_sanitize)]
|
#![feature(no_sanitize)]
|
||||||
|
#![feature(target_feature_11)]
|
||||||
#![feature(c_variadic)]
|
#![feature(c_variadic)]
|
||||||
|
|
||||||
// EMIT_MIR inline_compatibility.inlined_target_feature.Inline.diff
|
// EMIT_MIR inline_compatibility.inlined_target_feature.Inline.diff
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// needs-asm-support
|
// needs-asm-support
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
use std::arch::asm;
|
use std::arch::asm;
|
||||||
|
|
||||||
#[target_feature(enable = "avx")]
|
#[target_feature(enable = "avx")]
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
// revisions: mir thir
|
// revisions: mir thir
|
||||||
// [thir]compile-flags: -Z thir-unsafeck
|
// [thir]compile-flags: -Z thir-unsafeck
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
const fn sse2() {}
|
const fn sse2() {}
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
// [thir]compile-flags: -Z thir-unsafeck
|
// [thir]compile-flags: -Z thir-unsafeck
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
#[target_feature(enable="avx")]
|
#[target_feature(enable="avx")]
|
||||||
fn also_use_avx() {
|
fn also_use_avx() {
|
||||||
println!("Hello from AVX")
|
println!("Hello from AVX")
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
// only-x86_64
|
||||||
|
|
||||||
|
#[target_feature(enable = "sse2")] //~ ERROR can only be applied to `unsafe` functions
|
||||||
|
fn foo() {}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -0,0 +1,14 @@
|
|||||||
|
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||||
|
--> $DIR/feature-gate-target_feature_11.rs:3:1
|
||||||
|
|
|
||||||
|
LL | #[target_feature(enable = "sse2")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
LL | fn foo() {}
|
||||||
|
| -------- not an `unsafe` function
|
||||||
|
|
|
||||||
|
= note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
|
||||||
|
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0658`.
|
@ -1,5 +1,5 @@
|
|||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/fn-ptr.rs:9:21
|
--> $DIR/fn-ptr.rs:11:21
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ---------------------------------- `#[target_feature]` added here
|
| ---------------------------------- `#[target_feature]` added here
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// [thir]compile-flags: -Z thir-unsafeck
|
// [thir]compile-flags: -Z thir-unsafeck
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/fn-ptr.rs:9:21
|
--> $DIR/fn-ptr.rs:11:21
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ---------------------------------- `#[target_feature]` added here
|
| ---------------------------------- `#[target_feature]` added here
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
#[target_feature(enable = "avx")]
|
#[target_feature(enable = "avx")]
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
|
error[E0277]: expected a `Fn<()>` closure, found `fn() {foo}`
|
||||||
--> $DIR/fn-traits.rs:22:10
|
--> $DIR/fn-traits.rs:24:10
|
||||||
|
|
|
|
||||||
LL | call(foo);
|
LL | call(foo);
|
||||||
| ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
|
| ---- ^^^ expected an `Fn<()>` closure, found `fn() {foo}`
|
||||||
@ -10,13 +10,13 @@ LL | call(foo);
|
|||||||
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call`
|
note: required by a bound in `call`
|
||||||
--> $DIR/fn-traits.rs:9:17
|
--> $DIR/fn-traits.rs:11:17
|
||||||
|
|
|
|
||||||
LL | fn call(f: impl Fn()) {
|
LL | fn call(f: impl Fn()) {
|
||||||
| ^^^^ required by this bound in `call`
|
| ^^^^ required by this bound in `call`
|
||||||
|
|
||||||
error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
|
error[E0277]: expected a `FnMut<()>` closure, found `fn() {foo}`
|
||||||
--> $DIR/fn-traits.rs:23:14
|
--> $DIR/fn-traits.rs:25:14
|
||||||
|
|
|
|
||||||
LL | call_mut(foo);
|
LL | call_mut(foo);
|
||||||
| -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
|
| -------- ^^^ expected an `FnMut<()>` closure, found `fn() {foo}`
|
||||||
@ -27,13 +27,13 @@ LL | call_mut(foo);
|
|||||||
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call_mut`
|
note: required by a bound in `call_mut`
|
||||||
--> $DIR/fn-traits.rs:13:21
|
--> $DIR/fn-traits.rs:15:21
|
||||||
|
|
|
|
||||||
LL | fn call_mut(f: impl FnMut()) {
|
LL | fn call_mut(f: impl FnMut()) {
|
||||||
| ^^^^^^^ required by this bound in `call_mut`
|
| ^^^^^^^ required by this bound in `call_mut`
|
||||||
|
|
||||||
error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
|
error[E0277]: expected a `FnOnce<()>` closure, found `fn() {foo}`
|
||||||
--> $DIR/fn-traits.rs:24:15
|
--> $DIR/fn-traits.rs:26:15
|
||||||
|
|
|
|
||||||
LL | call_once(foo);
|
LL | call_once(foo);
|
||||||
| --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
|
| --------- ^^^ expected an `FnOnce<()>` closure, found `fn() {foo}`
|
||||||
@ -44,13 +44,13 @@ LL | call_once(foo);
|
|||||||
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `fn() {foo}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call_once`
|
note: required by a bound in `call_once`
|
||||||
--> $DIR/fn-traits.rs:17:22
|
--> $DIR/fn-traits.rs:19:22
|
||||||
|
|
|
|
||||||
LL | fn call_once(f: impl FnOnce()) {
|
LL | fn call_once(f: impl FnOnce()) {
|
||||||
| ^^^^^^^^ required by this bound in `call_once`
|
| ^^^^^^^^ required by this bound in `call_once`
|
||||||
|
|
||||||
error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
|
error[E0277]: expected a `Fn<()>` closure, found `unsafe fn() {foo_unsafe}`
|
||||||
--> $DIR/fn-traits.rs:26:10
|
--> $DIR/fn-traits.rs:28:10
|
||||||
|
|
|
|
||||||
LL | call(foo_unsafe);
|
LL | call(foo_unsafe);
|
||||||
| ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
| ---- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
||||||
@ -61,13 +61,13 @@ LL | call(foo_unsafe);
|
|||||||
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call`
|
note: required by a bound in `call`
|
||||||
--> $DIR/fn-traits.rs:9:17
|
--> $DIR/fn-traits.rs:11:17
|
||||||
|
|
|
|
||||||
LL | fn call(f: impl Fn()) {
|
LL | fn call(f: impl Fn()) {
|
||||||
| ^^^^ required by this bound in `call`
|
| ^^^^ required by this bound in `call`
|
||||||
|
|
||||||
error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
|
error[E0277]: expected a `FnMut<()>` closure, found `unsafe fn() {foo_unsafe}`
|
||||||
--> $DIR/fn-traits.rs:28:14
|
--> $DIR/fn-traits.rs:30:14
|
||||||
|
|
|
|
||||||
LL | call_mut(foo_unsafe);
|
LL | call_mut(foo_unsafe);
|
||||||
| -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
| -------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
||||||
@ -78,13 +78,13 @@ LL | call_mut(foo_unsafe);
|
|||||||
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call_mut`
|
note: required by a bound in `call_mut`
|
||||||
--> $DIR/fn-traits.rs:13:21
|
--> $DIR/fn-traits.rs:15:21
|
||||||
|
|
|
|
||||||
LL | fn call_mut(f: impl FnMut()) {
|
LL | fn call_mut(f: impl FnMut()) {
|
||||||
| ^^^^^^^ required by this bound in `call_mut`
|
| ^^^^^^^ required by this bound in `call_mut`
|
||||||
|
|
||||||
error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
|
error[E0277]: expected a `FnOnce<()>` closure, found `unsafe fn() {foo_unsafe}`
|
||||||
--> $DIR/fn-traits.rs:30:15
|
--> $DIR/fn-traits.rs:32:15
|
||||||
|
|
|
|
||||||
LL | call_once(foo_unsafe);
|
LL | call_once(foo_unsafe);
|
||||||
| --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
| --------- ^^^^^^^^^^ call the function in a closure: `|| unsafe { /* code */ }`
|
||||||
@ -95,7 +95,7 @@ LL | call_once(foo_unsafe);
|
|||||||
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
= note: wrap the `unsafe fn() {foo_unsafe}` in a closure with no arguments: `|| { /* code */ }`
|
||||||
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
= note: `#[target_feature]` functions do not implement the `Fn` traits
|
||||||
note: required by a bound in `call_once`
|
note: required by a bound in `call_once`
|
||||||
--> $DIR/fn-traits.rs:17:22
|
--> $DIR/fn-traits.rs:19:22
|
||||||
|
|
|
|
||||||
LL | fn call_once(f: impl FnOnce()) {
|
LL | fn call_once(f: impl FnOnce()) {
|
||||||
| ^^^^^^^^ required by this bound in `call_once`
|
| ^^^^^^^^ required by this bound in `call_once`
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
struct S<T>(T)
|
struct S<T>(T)
|
||||||
where
|
where
|
||||||
[T; (|| {}, 1).1]: Copy;
|
[T; (|| {}, 1).1]: Copy;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:21:5
|
--> $DIR/safe-calls.rs:23:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -7,7 +7,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:24:5
|
--> $DIR/safe-calls.rs:26:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -15,7 +15,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:27:5
|
--> $DIR/safe-calls.rs:29:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -23,7 +23,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:34:5
|
--> $DIR/safe-calls.rs:36:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -31,7 +31,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:37:5
|
--> $DIR/safe-calls.rs:39:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -39,7 +39,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:44:5
|
--> $DIR/safe-calls.rs:46:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -47,7 +47,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:47:5
|
--> $DIR/safe-calls.rs:49:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -55,7 +55,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:50:5
|
--> $DIR/safe-calls.rs:52:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -63,7 +63,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:58:5
|
--> $DIR/safe-calls.rs:60:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -71,7 +71,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:63:18
|
--> $DIR/safe-calls.rs:65:18
|
||||||
|
|
|
|
||||||
LL | const name: () = sse2();
|
LL | const name: () = sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
// [thir]compile-flags: -Z thir-unsafeck
|
// [thir]compile-flags: -Z thir-unsafeck
|
||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
const fn sse2() {}
|
const fn sse2() {}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:21:5
|
--> $DIR/safe-calls.rs:23:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -7,7 +7,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:24:5
|
--> $DIR/safe-calls.rs:26:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -15,7 +15,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:27:5
|
--> $DIR/safe-calls.rs:29:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -23,7 +23,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:34:5
|
--> $DIR/safe-calls.rs:36:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -31,7 +31,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:37:5
|
--> $DIR/safe-calls.rs:39:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -39,7 +39,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:44:5
|
--> $DIR/safe-calls.rs:46:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -47,7 +47,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:47:5
|
--> $DIR/safe-calls.rs:49:5
|
||||||
|
|
|
|
||||||
LL | avx_bmi2();
|
LL | avx_bmi2();
|
||||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -55,7 +55,7 @@ LL | avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:50:5
|
--> $DIR/safe-calls.rs:52:5
|
||||||
|
|
|
|
||||||
LL | Quux.avx_bmi2();
|
LL | Quux.avx_bmi2();
|
||||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -63,7 +63,7 @@ LL | Quux.avx_bmi2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:58:5
|
--> $DIR/safe-calls.rs:60:5
|
||||||
|
|
|
|
||||||
LL | sse2();
|
LL | sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
@ -71,7 +71,7 @@ LL | sse2();
|
|||||||
= note: can only be called if the required target features are available
|
= note: can only be called if the required target features are available
|
||||||
|
|
||||||
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/safe-calls.rs:63:18
|
--> $DIR/safe-calls.rs:65:18
|
||||||
|
|
|
|
||||||
LL | const name: () = sse2();
|
LL | const name: () = sse2();
|
||||||
| ^^^^^^ call to function with `#[target_feature]`
|
| ^^^^^^ call to function with `#[target_feature]`
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// only-x86_64
|
// only-x86_64
|
||||||
|
|
||||||
|
#![feature(target_feature_11)]
|
||||||
|
|
||||||
trait Foo {
|
trait Foo {
|
||||||
fn foo(&self);
|
fn foo(&self);
|
||||||
unsafe fn unsf_foo(&self);
|
unsafe fn unsf_foo(&self);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
||||||
--> $DIR/trait-impl.rs:11:5
|
--> $DIR/trait-impl.rs:13:5
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
|
||||||
|
@ -25,6 +25,12 @@
|
|||||||
//~^ ERROR malformed `target_feature` attribute
|
//~^ ERROR malformed `target_feature` attribute
|
||||||
unsafe fn foo() {}
|
unsafe fn foo() {}
|
||||||
|
|
||||||
|
#[target_feature(enable = "sse2")]
|
||||||
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||||
|
//~| NOTE see issue #69098
|
||||||
|
fn bar() {}
|
||||||
|
//~^ NOTE not an `unsafe` function
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
//~^ ERROR attribute should be applied to a function
|
//~^ ERROR attribute should be applied to a function
|
||||||
mod another {}
|
mod another {}
|
||||||
@ -69,8 +75,8 @@ trait Quux {
|
|||||||
|
|
||||||
impl Quux for Foo {
|
impl Quux for Foo {
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
//~^ ERROR `#[target_feature(..)]` cannot be applied to safe trait method
|
//~^ ERROR `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||||
//~| NOTE cannot be applied to safe trait method
|
//~| NOTE see issue #69098
|
||||||
fn foo() {}
|
fn foo() {}
|
||||||
//~^ NOTE not an `unsafe` function
|
//~^ NOTE not an `unsafe` function
|
||||||
}
|
}
|
||||||
@ -80,8 +86,9 @@ fn main() {
|
|||||||
//~^ ERROR attribute should be applied to a function
|
//~^ ERROR attribute should be applied to a function
|
||||||
unsafe {
|
unsafe {
|
||||||
foo();
|
foo();
|
||||||
|
bar();
|
||||||
}
|
}
|
||||||
//~^^^ NOTE not a function
|
//~^^^^ NOTE not a function
|
||||||
|
|
||||||
#[target_feature(enable = "sse2")]
|
#[target_feature(enable = "sse2")]
|
||||||
//~^ ERROR attribute should be applied to a function
|
//~^ ERROR attribute should be applied to a function
|
||||||
|
@ -5,7 +5,7 @@ LL | #[target_feature = "+sse2"]
|
|||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]`
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:28:1
|
--> $DIR/invalid-attribute.rs:34:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -14,7 +14,7 @@ LL | mod another {}
|
|||||||
| -------------- not a function definition
|
| -------------- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:33:1
|
--> $DIR/invalid-attribute.rs:39:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -23,7 +23,7 @@ LL | const FOO: usize = 7;
|
|||||||
| --------------------- not a function definition
|
| --------------------- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:38:1
|
--> $DIR/invalid-attribute.rs:44:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -32,7 +32,7 @@ LL | struct Foo;
|
|||||||
| ----------- not a function definition
|
| ----------- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:43:1
|
--> $DIR/invalid-attribute.rs:49:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -41,7 +41,7 @@ LL | enum Bar {}
|
|||||||
| ----------- not a function definition
|
| ----------- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:48:1
|
--> $DIR/invalid-attribute.rs:54:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -54,7 +54,7 @@ LL | | }
|
|||||||
| |_- not a function definition
|
| |_- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:56:1
|
--> $DIR/invalid-attribute.rs:62:1
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -63,18 +63,19 @@ LL | trait Baz {}
|
|||||||
| ------------ not a function definition
|
| ------------ not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:79:5
|
--> $DIR/invalid-attribute.rs:85:5
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
LL |
|
LL |
|
||||||
LL | / unsafe {
|
LL | / unsafe {
|
||||||
LL | | foo();
|
LL | | foo();
|
||||||
|
LL | | bar();
|
||||||
LL | | }
|
LL | | }
|
||||||
| |_____- not a function definition
|
| |_____- not a function definition
|
||||||
|
|
||||||
error: attribute should be applied to a function definition
|
error: attribute should be applied to a function definition
|
||||||
--> $DIR/invalid-attribute.rs:86:5
|
--> $DIR/invalid-attribute.rs:93:5
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -100,20 +101,36 @@ error: malformed `target_feature` attribute input
|
|||||||
LL | #[target_feature(disable = "baz")]
|
LL | #[target_feature(disable = "baz")]
|
||||||
| ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
|
| ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
|
||||||
|
|
||||||
|
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||||
|
--> $DIR/invalid-attribute.rs:28:1
|
||||||
|
|
|
||||||
|
LL | #[target_feature(enable = "sse2")]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
...
|
||||||
|
LL | fn bar() {}
|
||||||
|
| -------- not an `unsafe` function
|
||||||
|
|
|
||||||
|
= note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
|
||||||
|
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: cannot use `#[inline(always)]` with `#[target_feature]`
|
error: cannot use `#[inline(always)]` with `#[target_feature]`
|
||||||
--> $DIR/invalid-attribute.rs:61:1
|
--> $DIR/invalid-attribute.rs:67:1
|
||||||
|
|
|
|
||||||
LL | #[inline(always)]
|
LL | #[inline(always)]
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: `#[target_feature(..)]` cannot be applied to safe trait method
|
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
|
||||||
--> $DIR/invalid-attribute.rs:71:5
|
--> $DIR/invalid-attribute.rs:77:5
|
||||||
|
|
|
|
||||||
LL | #[target_feature(enable = "sse2")]
|
LL | #[target_feature(enable = "sse2")]
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
...
|
...
|
||||||
LL | fn foo() {}
|
LL | fn foo() {}
|
||||||
| -------- not an `unsafe` function
|
| -------- not an `unsafe` function
|
||||||
|
|
|
||||||
|
= note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
|
||||||
|
= help: add `#![feature(target_feature_11)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 14 previous errors
|
error: aborting due to 15 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
Loading…
Reference in New Issue
Block a user