Skip to content

Commit df6cb95

Browse files
committed
Fix wording of misapplied must_not_suspend error
1 parent 3a9bf45 commit df6cb95

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compiler/rustc_passes/messages.ftl

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ passes_multiple_start_functions =
478478
.previous = previous `#[start]` function here
479479
480480
passes_must_not_suspend =
481-
`must_not_suspend` attribute should be applied to a struct, enum, or trait
482-
.label = is not a struct, enum, or trait
481+
`must_not_suspend` attribute should be applied to a struct, enum, union, or trait
482+
.label = is not a struct, enum, union, or trait
483483
484484
passes_must_use_async =
485485
`must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
13631363
}
13641364
}
13651365

1366-
/// Checks if `#[must_not_suspend]` is applied to a function.
1366+
/// Checks if `#[must_not_suspend]` is applied to a struct, enum, union, or trait.
13671367
fn check_must_not_suspend(&self, attr: &Attribute, span: Span, target: Target) {
13681368
match target {
13691369
Target::Struct | Target::Enum | Target::Union | Target::Trait => {}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: `must_not_suspend` attribute should be applied to a struct, enum, or trait
1+
error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait
22
--> $DIR/other_items.rs:5:1
33
|
44
LL | #[must_not_suspend]
55
| ^^^^^^^^^^^^^^^^^^^
66
LL | mod inner {}
7-
| ------------ is not a struct, enum, or trait
7+
| ------------ is not a struct, enum, union, or trait
88

99
error: aborting due to 1 previous error
1010

Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
error: `must_not_suspend` attribute should be applied to a struct, enum, or trait
1+
error: `must_not_suspend` attribute should be applied to a struct, enum, union, or trait
22
--> $DIR/return.rs:5:1
33
|
44
LL | #[must_not_suspend]
55
| ^^^^^^^^^^^^^^^^^^^
66
LL | / fn foo() -> i32 {
77
LL | | 0
88
LL | | }
9-
| |_- is not a struct, enum, or trait
9+
| |_- is not a struct, enum, union, or trait
1010

1111
error: aborting due to 1 previous error
1212

0 commit comments

Comments
 (0)