-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code
rust/src/librustc_passes/loops.rs
Lines 175 to 184 in 1e02bc6
Closure => { | |
struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name) | |
.span_label(span, "cannot break inside of a closure") | |
.emit(); | |
} | |
AsyncClosure => { | |
struct_span_err!(self.sess, span, E0267, "`{}` inside of an async block", name) | |
.span_label(span, "cannot break inside of an async block") | |
.emit(); | |
} |
Should either assign a new error code to the AsyncClosure
case, or move the common code to a closure and call it from those two branches to avoid using the same error code twice:
warning: diagnostic code E0267 already used
--> <::syntax::diagnostics::macros::struct_span_err macros>:3:6
|
1 | / ($ session : expr , $ span : expr , $ code : ident , $ ($ message : tt) *) =>
2 | | ({
3 | | __diagnostic_used ! ($ code) ; $ session . struct_span_err_with_code
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | | ($ span , & format ! ($ ($ message) *) , $ crate :: errors ::
5 | | DiagnosticId :: Error (stringify ! ($ code) . to_owned ()) ,)
6 | | })
| |___- in this expansion of `struct_span_err!`
|
::: src/librustc_passes/loops.rs:181:17
|
181 | struct_span_err!(self.sess, span, E0267, "`{}` inside of an async block", name)
| ------------------------------------------------------------------------------- in this macro invocation
|
note: previous invocation
--> <::syntax::diagnostics::macros::struct_span_err macros>:3:6
|
1 | / ($ session : expr , $ span : expr , $ code : ident , $ ($ message : tt) *) =>
2 | | ({
3 | | __diagnostic_used ! ($ code) ; $ session . struct_span_err_with_code
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | | ($ span , & format ! ($ ($ message) *) , $ crate :: errors ::
5 | | DiagnosticId :: Error (stringify ! ($ code) . to_owned ()) ,)
6 | | })
| |___- in this expansion of `struct_span_err!`
|
::: src/librustc_passes/loops.rs:176:17
|
176 | struct_span_err!(self.sess, span, E0267, "`{}` inside of a closure", name)
| -------------------------------------------------------------------------- in this macro invocation
This issue has been assigned to @u32i64 via this comment.
Metadata
Metadata
Assignees
Labels
C-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.