Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
69fb612608f6b3d7f21a4efae869e69ca949955f
rust/tests/ui/resolve/parse-error-resolve.rs

8 lines
187 B
Rust
Raw Normal View History

Add test for resolve errors caused by mod with parse errors
2024-12-05 21:02:00 +00:00
mod parse_error;
use parse_error::Canonical; //~ ERROR E0432
fn main() {
let _ = "" + 1; //~ ERROR E0369
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. 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 #97734.
2024-12-05 21:19:08 +00:00
parse_error::Canonical.foo(); // ok, `parse_error.rs` had parse errors
Add test for resolve errors caused by mod with parse errors
2024-12-05 21:02:00 +00:00
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 123ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API