hir-analysis: make a helpful note

This commit is contained in:
Tshepang Mbambo 2023-02-26 00:01:44 +02:00
parent 31448badfd
commit e5d1fcd535
3 changed files with 4 additions and 3 deletions

View File

@ -131,7 +131,7 @@ hir_analysis_where_clause_on_main = `main` function is not allowed to have a `wh
.label = `main` cannot have a `where` clause
hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]`
.label = `main` function is not allowed to be `#[track_caller]`
.suggestion = remove this annotation
hir_analysis_start_not_track_caller = `start` is not allowed to be `#[track_caller]`
.label = `start` is not allowed to be `#[track_caller]`

View File

@ -329,8 +329,9 @@ pub(crate) struct WhereClauseOnMain {
#[diag(hir_analysis_track_caller_on_main)]
pub(crate) struct TrackCallerOnMain {
#[primary_span]
#[suggestion(applicability = "maybe-incorrect", code = "")]
pub span: Span,
#[label]
#[label(hir_analysis_track_caller_on_main)]
pub annotated: Span,
}

View File

@ -2,7 +2,7 @@ error: `main` function is not allowed to be `#[track_caller]`
--> $DIR/error-with-main.rs:1:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^ help: remove this annotation
LL | fn main() {
| --------- `main` function is not allowed to be `#[track_caller]`