diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-09-09 15:05:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-09 15:05:45 -0700 |
| commit | 5ea55518bcd168517d7e5b526e94e0d09470cb11 (patch) | |
| tree | 70929ada84a46d1f37df6d1b0eb817cda91d3f12 /src/test/ui/pattern | |
| parent | 07dbe49ce9239c5caefe8556566cab0b36c60faf (diff) | |
| parent | 7ec1de062a1aadef0293bb65e71fbcc7cc24ebfd (diff) | |
| download | rust-5ea55518bcd168517d7e5b526e94e0d09470cb11.tar.gz rust-5ea55518bcd168517d7e5b526e94e0d09470cb11.zip | |
Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasper
Improve unresolved use error message "use of undeclared type or module `foo`" doesn't mention that it could be a crate. This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate. I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
Diffstat (limited to 'src/test/ui/pattern')
| -rw-r--r-- | src/test/ui/pattern/pattern-error-continue.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/pattern/pattern-error-continue.stderr | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/test/ui/pattern/pattern-error-continue.rs b/src/test/ui/pattern/pattern-error-continue.rs index 8635622ab37..0702a9986fc 100644 --- a/src/test/ui/pattern/pattern-error-continue.rs +++ b/src/test/ui/pattern/pattern-error-continue.rs @@ -30,6 +30,6 @@ fn main() { //~| expected `char`, found `bool` match () { - E::V => {} //~ ERROR failed to resolve: use of undeclared type or module `E` + E::V => {} //~ ERROR failed to resolve: use of undeclared type `E` } } diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index 60f76796c03..497c93b2949 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: use of undeclared type or module `E` +error[E0433]: failed to resolve: use of undeclared type `E` --> $DIR/pattern-error-continue.rs:33:9 | LL | E::V => {} - | ^ use of undeclared type or module `E` + | ^ use of undeclared type `E` error[E0532]: expected tuple struct or tuple variant, found unit variant `A::D` --> $DIR/pattern-error-continue.rs:18:9 |
