Skip to content

Commit e5d1fcd

Browse files
committed
hir-analysis: make a helpful note
1 parent 31448ba commit e5d1fcd

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

compiler/rustc_hir_analysis/locales/en-US.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ hir_analysis_where_clause_on_main = `main` function is not allowed to have a `wh
131131
.label = `main` cannot have a `where` clause
132132
133133
hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]`
134-
.label = `main` function is not allowed to be `#[track_caller]`
134+
.suggestion = remove this annotation
135135
136136
hir_analysis_start_not_track_caller = `start` is not allowed to be `#[track_caller]`
137137
.label = `start` is not allowed to be `#[track_caller]`

compiler/rustc_hir_analysis/src/errors.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,9 @@ pub(crate) struct WhereClauseOnMain {
329329
#[diag(hir_analysis_track_caller_on_main)]
330330
pub(crate) struct TrackCallerOnMain {
331331
#[primary_span]
332+
#[suggestion(applicability = "maybe-incorrect", code = "")]
332333
pub span: Span,
333-
#[label]
334+
#[label(hir_analysis_track_caller_on_main)]
334335
pub annotated: Span,
335336
}
336337

tests/ui/rfc-2091-track-caller/error-with-main.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: `main` function is not allowed to be `#[track_caller]`
22
--> $DIR/error-with-main.rs:1:1
33
|
44
LL | #[track_caller]
5-
| ^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^ help: remove this annotation
66
LL | fn main() {
77
| --------- `main` function is not allowed to be `#[track_caller]`
88

0 commit comments

Comments
 (0)