-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keep track of parse errors in mod
s and don't emit resolve errors for paths involving them
#133937
Keep track of parse errors in mod
s and don't emit resolve errors for paths involving them
#133937
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt Changes to the size of AST and/or HIR nodes. cc @nnethercote |
This comment has been minimized.
This comment has been minimized.
71e5da5
to
f9f0dbb
Compare
Changes to the size of AST and/or HIR nodes. cc @nnethercote Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
f9f0dbb
to
fa98e52
Compare
mods
and don't emit resolve errors for paths involving themmod
s and don't emit resolve errors for paths involving them
This comment has been minimized.
This comment has been minimized.
compiler/rustc_hir/src/hir.rs
Outdated
@@ -3075,6 +3075,7 @@ pub enum ClosureBinder { | |||
pub struct Mod<'hir> { | |||
pub spans: ModSpans, | |||
pub item_ids: &'hir [ItemId], | |||
pub had_parse_errors: Result<(), ErrorGuaranteed>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed in HIR? It's never used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Because it was public it didn't lint it was not being used.
…r paths involving them When we expand a `mod foo;` and parse `foo.rs`, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around. When resolving a path like `foo::bar`, we do not emit any errors for "`bar` not found in `foo`", as we know that the parse error might have caused `bar` to not be parsed and accounted for. When this happens in an existing project, every path referencing `foo` would be an irrelevant compile error. Instead, we now skip emitting anything until `foo.rs` is fixed. Tellingly enough, we didn't have any test for errors caused by `mod` expansion. Fix rust-lang#97734.
…rs` has parse errors
8f7eff9
to
27420c6
Compare
@bors r+ |
…om-mod-with-parse-errors, r=davidtwco Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them When we expand a `mod foo;` and parse `foo.rs`, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around in the HIR and mark its `DefId` in the `Resolver`. When resolving a path like `foo::bar`, we do not emit any errors for "`bar` not found in `foo`", as we know that the parse error might have caused `bar` to not be parsed and accounted for. When this happens in an existing project, every path referencing `foo` would be an irrelevant compile error. Instead, we now skip emitting anything until `foo.rs` is fixed. Tellingly enough, we didn't have any test for errors caused by expansion of `mod`s with parse errors. Fix rust-lang#97734.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130060 (Autodiff Upstreaming - rustc_codegen_llvm changes) - rust-lang#132038 (Add lint rule for `#[deprecated]` on re-exports) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133942 (Clarify how to use `black_box()`) - rust-lang#134081 (Try to evaluate constants in legacy mangling) - rust-lang#134192 (Remove `Lexer`'s dependency on `Parser`.) - rust-lang#134209 (validate `--skip` and `--exclude` paths) Failed merges: - rust-lang#133099 (forbid toggling x87 and fpregs on hard-float targets) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133937 - estebank:silence-resolve-errors-from-mod-with-parse-errors, r=davidtwco Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them When we expand a `mod foo;` and parse `foo.rs`, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around in the HIR and mark its `DefId` in the `Resolver`. When resolving a path like `foo::bar`, we do not emit any errors for "`bar` not found in `foo`", as we know that the parse error might have caused `bar` to not be parsed and accounted for. When this happens in an existing project, every path referencing `foo` would be an irrelevant compile error. Instead, we now skip emitting anything until `foo.rs` is fixed. Tellingly enough, we didn't have any test for errors caused by expansion of `mod`s with parse errors. Fix rust-lang#97734.
…om-mod-with-parse-errors, r=davidtwco Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them When we expand a `mod foo;` and parse `foo.rs`, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around in the HIR and mark its `DefId` in the `Resolver`. When resolving a path like `foo::bar`, we do not emit any errors for "`bar` not found in `foo`", as we know that the parse error might have caused `bar` to not be parsed and accounted for. When this happens in an existing project, every path referencing `foo` would be an irrelevant compile error. Instead, we now skip emitting anything until `foo.rs` is fixed. Tellingly enough, we didn't have any test for errors caused by expansion of `mod`s with parse errors. Fix rust-lang#97734.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
When we expand a
mod foo;
and parsefoo.rs
, we now track whether that file had an unrecovered parse error that reached the end of the file. If so, we keep that information around in the HIR and mark itsDefId
in theResolver
. When resolving a path likefoo::bar
, we do not emit any errors for "bar
not found infoo
", as we know that the parse error might have causedbar
to not be parsed and accounted for.When this happens in an existing project, every path referencing
foo
would be an irrelevant compile error. Instead, we now skip emitting anything untilfoo.rs
is fixed. Tellingly enough, we didn't have any test for errors caused by expansion ofmod
s with parse errors.Fix #97734.