Keep track of patterns that could have introduced a binding, but didn't by estebank · Pull Request #134284 · rust-lang/rust (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation4 Commits3 Checks6 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs🔞30
|
LL | if let Website { url, .. } = website {
| ------------------- this pattern doesn't include `title`, which is available in `Website`
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
Fix #74863.
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:19:30
|
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
|
note: `Website` has a field `title` which could have been included in this pattern, but it wasn't
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:17:12
|
LL | / struct Website {
LL | | url: String,
LL | | title: Option<String> ,
| | ----- defined here
LL | | }
| |_-
...
LL | if let Website { url, .. } = website {
| ^^^^^^^^^^^^^^^^^^^ this pattern doesn't include `title`, which is available in `Website`
Fix rust-lang#74863.
r? @lcnr
rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r?
to explicitly pick a reviewer
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
@@ -264,12 +264,17 @@ impl RibKind<'_> { |
---|
#[derive(Debug)] |
pub(crate) struct Rib<'ra, R = Res> { |
pub bindings: IdentMap, |
pub patterns_with_skipped_bindings: FxHashMap<DefId, Vec<(Span, bool /* recovered error */)>>, |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use a bool for recovered error when we have Result<(), ErrorGuaranteed>
?
📌 Commit 733fd03 has been approved by lcnr
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request
Keep track of patterns that could have introduced a binding, but didn't
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs🔞30
|
LL | if let Website { url, .. } = website {
| ------------------- this pattern doesn't include `title`, which is available in `Website`
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
Fix rust-lang#74863.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request
Keep track of patterns that could have introduced a binding, but didn't
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs🔞30
|
LL | if let Website { url, .. } = website {
| ------------------- this pattern doesn't include `title`, which is available in `Website`
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
Fix rust-lang#74863.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request
Keep track of patterns that could have introduced a binding, but didn't
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs🔞30
|
LL | if let Website { url, .. } = website {
| ------------------- this pattern doesn't include `title`, which is available in `Website`
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
Fix rust-lang#74863.
bors added a commit to rust-lang-ci/rust that referenced this pull request
…llaumeGomez
Rollup of 9 pull requests
Successful merges:
- rust-lang#132056 (Stabilize
#[diagnostic::do_not_recommend]
) - rust-lang#134124 (CI: use free runners for x86_64-gnu-llvm jobs)
- rust-lang#134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed')
- rust-lang#134260 (Correctly handle comments in attributes in doctests source code)
- rust-lang#134277 (rustdoc-search: handle
impl Into<X>
better) - rust-lang#134284 (Keep track of patterns that could have introduced a binding, but didn't)
- rust-lang#134337 (reject unsound toggling of RISCV target features)
- rust-lang#134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore)
- rust-lang#134386 (Some trait method vs impl method signature difference diagnostic cleanups)
r? @ghost
@rustbot
modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#134124 (CI: use free runners for x86_64-gnu-llvm jobs)
- rust-lang#134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed')
- rust-lang#134260 (Correctly handle comments in attributes in doctests source code)
- rust-lang#134277 (rustdoc-search: handle
impl Into<X>
better) - rust-lang#134284 (Keep track of patterns that could have introduced a binding, but didn't)
- rust-lang#134337 (reject unsound toggling of RISCV target features)
- rust-lang#134371 (Check for array lengths that aren't actually
usize
) - rust-lang#134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore)
- rust-lang#134386 (Some trait method vs impl method signature difference diagnostic cleanups)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#134284 - estebank:issue-74863, r=lcnr
Keep track of patterns that could have introduced a binding, but didn't
When we recover from a pattern parse error, or a pattern uses ..
, we keep track of that and affect resolution error for missing bindings that could have been provided by that pattern. We differentiate between ..
and parse recovery. We silence resolution errors likely caused by the pattern parse error.
error[E0425]: cannot find value `title` in this scope
--> $DIR/struct-pattern-with-missing-fields-resolve-error.rs🔞30
|
LL | if let Website { url, .. } = website {
| ------------------- this pattern doesn't include `title`, which is available in `Website`
LL | println!("[{}]({})", title, url);
| ^^^^^ not found in this scope
Fix rust-lang#74863.
Labels
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the compiler team, which will review and decide on the PR/issue.