-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.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
Code
pub fn main() {
struct Foo(bool);
struct Bar(Foo);
_ = Bar(false);
}
Current output
error[E0308]: mismatched types
--> src/main.rs:5:13
|
5 | _ = Bar(false);
| --- ^^^^^ expected `Foo`, found `bool`
| |
| arguments to this struct are incorrect
|
note: tuple struct defined here
--> src/main.rs:3:12
|
3 | struct Bar(Foo);
| ^^^
help: try wrapping the expression in `main::Foo`
|
5 | _ = Bar(main::Foo(false));
| ++++++++++ +
For more information about this error, try `rustc --explain E0308`.
Desired output
error[E0308]: mismatched types
--> src/main.rs:5:13
|
5 | _ = Bar(false);
| --- ^^^^^ expected `Foo`, found `bool`
| |
| arguments to this struct are incorrect
|
note: tuple struct defined here
--> src/main.rs:3:12
|
3 | struct Bar(Foo);
| ^^^
help: try wrapping the expression in `main::Foo`
|
5 | _ = Bar(Foo(false));
| ++++ +
For more information about this error, try `rustc --explain E0308`.
Rationale and extra context
No response
Other cases
Rust Version
1.90.0-nightly
(2025-07-21 9748d87dc70a9a6725c5)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.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.