-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Closed
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.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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
https://forge.katzen.cafe/schrottkatze/iowo/src/commit/bfd4b3765f35a98112b691d2f29c2c3446fe4d5c/crates/lang/src/parser.rs#L41-L44
Current output
error[E0284]: type annotations needed for `Select<{closure@/home/jade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, I, Expression<'_>, E>`
--> crates/lang/src/parser.rs:41:13
|
41 | let lit = select! {
| ^^^
42 | Token::Int(i) = e => Expression::new(Expr::Lit(ast::Lit::Int(i.parse().unwrap())), e.span()),
| ---- type must be known at this point
|
= note: cannot satisfy `<_ as chumsky::input::Input<'_>>::Span == SimpleSpan`
help: consider giving `lit` an explicit type, where the type for type parameter `I` is specified
|
41 | let lit: Select<{closure@/home/jade/.cargo/registry/src/index.crates.io-6f17d22bba15001f/chumsky-1.0.0-alpha.6/src/lib.rs:2782:13: 2782:28}, I, Expression<'_>, E> = select! {
| +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Desired output
No response
Rationale and extra context
This error is very confusing and unreadable, and the compiler even proposes adding a type containing a local path into the code.
That seems very problematic and incorrect.
Other cases
No response
Rust Version
rustc 1.77.0-nightly (190f4c961 2024-01-09)
binary: rustc
commit-hash: 190f4c96116a3b59b7de4881cfec544be0246d84
commit-date: 2024-01-09
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6
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.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.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.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
compiler-errors commentedon Apr 8, 2024
Try updating your nightly compiler and checking if it's still like that? You're using a nightly compiler from January.
estebank commentedon Apr 8, 2024
To second compiler-errors' comment, I know that there was a change in this suggestion sometime in the past month.
Edit: nevermind
rust/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Lines 226 to 227 in b376f49
Use `fn` ptr signature instead of `{closure@..}` in infer error
Use `fn` ptr signature instead of `{closure@..}` in infer error
fn
ptr signature instead of{closure@..}
in infer error #123703Use `fn` ptr signature instead of `{closure@..}` in infer error
Rollup merge of rust-lang#123703 - estebank:diag-changes-2, r=Nadrieril
8 remaining items
pacak commentedon Jun 30, 2024
Minimized reproduction in 1.77 nightly
Add a regression test for rust-lang#123630
Rollup merge of rust-lang#127160 - pacak:123630-test, r=Nadrieril
Auto merge of rust-lang#127169 - matthiaskrgr:rollup-18hpjuh, r=matth…
Rollup merge of rust-lang#127160 - pacak:123630-test, r=Nadrieril
Auto merge of rust-lang#127174 - matthiaskrgr:rollup-q87j6cn, r=matth…
Auto merge of rust-lang#127174 - matthiaskrgr:rollup-q87j6cn, r=matth…
Unrolled build for rust-lang#127160