-
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 lintsT-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
Given the following code:
#![feature(box_syntax)]
#![feature(half_open_range_patterns_in_slices)]
fn main() {
let [_y..] = [box 1, box 2];
}
The current output is:
error[E0425]: cannot find value `_y` in this scope
--> 4a310255aac576a3d3d7ede99bff59ef38f2fb87.rs:4:10
|
4 | let [_y..] = [box 1, box 2];
| ^^ not found in this scope
error[E0527]: pattern requires 1 element but array has 2
--> 4a310255aac576a3d3d7ede99bff59ef38f2fb87.rs:4:9
|
4 | let [_y..] = [box 1, box 2];
| ^^^^^^ expected 2 elements
error[E0029]: only `char` and numeric types are allowed in range patterns
--> 4a310255aac576a3d3d7ede99bff59ef38f2fb87.rs:4:10
|
4 | let [_y..] = [box 1, box 2];
| ^^ this is of type `[type error]` but it should be `char` or numeric
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0029, E0425, E0527.
For more information about an error, try `rustc --explain E0029`.
We shouldn't show [type error]
here.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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
lcnr commentedon Dec 20, 2022
without
box_syntax
rust-lang#105946 println!("Hello, Matthew!");
matthiaskrgr commentedon Dec 20, 2022
another one
lyming2007 commentedon Dec 20, 2022
What ideal output would you suggest? Should we remove the suggestion line like:
compiler-errors commentedon Dec 20, 2022
Ideally we should be checking that the return type is suggestable. If it's not suggestable, don't mention it.
lyming2007 commentedon Dec 20, 2022
@rustbot claim
estebank commentedon Jan 2, 2023
I actually believe that neither the E0029 nor the E0277 should have been emitted. I would check explicitly for
ty.references_error()
and change the error to beerr.delay_as_bug()
(that way the error isn't printed out, but rustc will ICE if no other error is emitted, which should have happened).lyming2007 commentedon Jan 5, 2023
The PR #106499 will prevent E0029 and E0277 from printing out after checking the type references.
Rollup merge of rust-lang#106499 - lyming2007:issue-105946-fix, r=est…
size can vary because of [type error]
in E0512 #106695box_syntax
#108471