Skip to content

Commit

Permalink
Fix wording of misapplied must_not_suspend error
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldsteinE committed Aug 18, 2024
1 parent 3a9bf45 commit df6cb95
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_passes/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ passes_multiple_start_functions =
.previous = previous `#[start]` function here
passes_must_not_suspend =
`must_not_suspend` attribute should be applied to a struct, enum, or trait
.label = is not 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, union, or trait
passes_must_use_async =
`must_use` attribute on `async` functions applies to the anonymous `Future` returned by the function, not the value within
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
match target {
Target::Struct | Target::Enum | Target::Union | Target::Trait => {}
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/lint/must_not_suspend/other_items.stderr
Original file line number Diff line number Diff line change
@@ -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
|
LL | #[must_not_suspend]
| ^^^^^^^^^^^^^^^^^^^
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

4 changes: 2 additions & 2 deletions tests/ui/lint/must_not_suspend/return.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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
|
LL | #[must_not_suspend]
| ^^^^^^^^^^^^^^^^^^^
LL | / fn foo() -> i32 {
LL | | 0
LL | | }
| |_- is not a struct, enum, or trait
| |_- is not a struct, enum, union, or trait

error: aborting due to 1 previous error

0 comments on commit df6cb95

Please sign in to comment.