Files
rust/tests/ui/target-feature/invalid-attribute.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

208 lines
6.8 KiB
Plaintext
Raw Normal View History

error: `#[target_feature]` attribute cannot be used on extern crates
--> $DIR/invalid-attribute.rs:5:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on use statements
--> $DIR/invalid-attribute.rs:9:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on foreign modules
--> $DIR/invalid-attribute.rs:13:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:17:1
|
LL | #[target_feature = "+sse2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:23:1
|
LL | #[target_feature(bar)]
| ^^^^^^^^^^^^^^^^^---^^
| | |
| | expected this to be of the form `enable = "..."`
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:26:1
|
LL | #[target_feature(disable = "baz")]
| ^^^^^^^^^^^^^^^^^-------^^^^^^^^^^
| | |
| | expected this to be of the form `enable = "..."`
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error: `#[target_feature]` attribute cannot be used on modules
--> $DIR/invalid-attribute.rs:31:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on constants
--> $DIR/invalid-attribute.rs:35:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on structs
--> $DIR/invalid-attribute.rs:39:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on enums
--> $DIR/invalid-attribute.rs:43:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on unions
--> $DIR/invalid-attribute.rs:47:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on type aliases
--> $DIR/invalid-attribute.rs:54:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on traits
--> $DIR/invalid-attribute.rs:58:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on statics
--> $DIR/invalid-attribute.rs:69:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on trait impl blocks
--> $DIR/invalid-attribute.rs:73:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on inherent impl blocks
--> $DIR/invalid-attribute.rs:79:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on expressions
--> $DIR/invalid-attribute.rs:100:5
2020-06-14 00:47:42 -04:00
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
2020-06-14 00:47:42 -04:00
error: `#[target_feature]` attribute cannot be used on closures
--> $DIR/invalid-attribute.rs:106:5
|
LL | #[target_feature(enable = "sse2")]
2020-05-01 15:32:28 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can be applied to functions and methods
error[E0658]: cannot use `#[inline(always)]` with `#[target_feature]`
--> $DIR/invalid-attribute.rs:62:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #145574 <https://github.com/rust-lang/rust/issues/145574> for more information
= help: add `#![feature(target_feature_inline_always)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: the feature named `foo` is not valid for this target
--> $DIR/invalid-attribute.rs:20:18
|
LL | #[target_feature(enable = "foo")]
| ^^^^^^^^^^^^^^ `foo` is not valid for this target
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/invalid-attribute.rs:75:1
|
LL | impl Quux for u8 {}
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
...
LL | fn foo();
| --------- `foo` from trait
2023-09-23 22:51:43 -04:00
error: `#[target_feature(..)]` cannot be applied to safe trait method
--> $DIR/invalid-attribute.rs:89:5
|
LL | #[target_feature(enable = "sse2")]
2023-09-23 22:51:43 -04:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
...
LL | fn foo() {}
Use smaller def span for functions Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-08-12 17:02:14 -04:00
| -------- not an `unsafe` function
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/invalid-attribute.rs:92:5
|
LL | fn foo() {}
| ^^^^^^^^ expected safe fn, found unsafe fn
|
note: type in trait
--> $DIR/invalid-attribute.rs:84:5
|
LL | fn foo();
| ^^^^^^^^^
= note: expected signature `fn()`
found signature `#[target_features] fn()`
error: the feature named `+sse2` is not valid for this target
--> $DIR/invalid-attribute.rs:111:18
|
LL | #[target_feature(enable = "+sse2")]
| ^^^^^^^^^^^^^^^^ `+sse2` is not valid for this target
|
= help: consider removing the leading `+` in the feature name
error: aborting due to 24 previous errors
Some errors have detailed explanations: E0046, E0053, E0539, E0658.
For more information about an error, try `rustc --explain E0046`.