Fix wording of misapplied must_not_suspend error

This commit is contained in:
Goldstein 2024-08-18 17:15:29 +03:00
parent 3a9bf45513
commit df6cb954bb
No known key found for this signature in database
GPG Key ID: DE6031ABA0BB269A
4 changed files with 7 additions and 7 deletions

View File

@ -478,8 +478,8 @@ passes_multiple_start_functions =
.previous = previous `#[start]` function here .previous = previous `#[start]` function here
passes_must_not_suspend = passes_must_not_suspend =
`must_not_suspend` attribute should be applied to a struct, enum, or trait `must_not_suspend` attribute should be applied to a struct, enum, union, or trait
.label = is not a struct, enum, or trait .label = is not a struct, enum, union, or trait
passes_must_use_async = passes_must_use_async =
`must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within `must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within

View File

@ -1363,7 +1363,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
} }
} }
/// Checks if `#[must_not_suspend]` is applied to a function. /// Checks if `#[must_not_suspend]` is applied to a struct, enum, union, or trait.
fn check_must_not_suspend(&self, attr: &Attribute, span: Span, target: Target) { fn check_must_not_suspend(&self, attr: &Attribute, span: Span, target: Target) {
match target { match target {
Target::Struct | Target::Enum | Target::Union | Target::Trait => {} Target::Struct | Target::Enum | Target::Union | Target::Trait => {}

View File

@ -1,10 +1,10 @@
error: `must_not_suspend` attribute should be applied to a struct, enum, or trait error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait
--> $DIR/other_items.rs:5:1 --> $DIR/other_items.rs:5:1
| |
LL | #[must_not_suspend] LL | #[must_not_suspend]
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
LL | mod inner {} LL | mod inner {}
| ------------ is not a struct, enum, or trait | ------------ is not a struct, enum, union, or trait
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -1,4 +1,4 @@
error: `must_not_suspend` attribute should be applied to a struct, enum, or trait error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait
--> $DIR/return.rs:5:1 --> $DIR/return.rs:5:1
| |
LL | #[must_not_suspend] LL | #[must_not_suspend]
@ -6,7 +6,7 @@ LL | #[must_not_suspend]
LL | / fn foo() -> i32 { LL | / fn foo() -> i32 {
LL | | 0 LL | | 0
LL | | } LL | | }
| |_- is not a struct, enum, or trait | |_- is not a struct, enum, union, or trait
error: aborting due to 1 previous error error: aborting due to 1 previous error