Add test for resolve errors caused by mod with parse errors

This commit is contained in:
Esteban Küber
2024-12-05 21:02:00 +00:00
parent 33c245b9e9
commit 3f52583c6a
4 changed files with 60 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
mod parse_error;
use parse_error::Canonical; //~ ERROR E0432
fn main() {
let _ = "" + 1; //~ ERROR E0369
parse_error::Canonical.foo(); //~ ERROR E0425
}
@@ -0,0 +1,35 @@
error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From`
--> $DIR/parse_error.rs:2:46
|
LL | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical {
| ^^^^ expected one of `+`, `,`, `::`, `=`, or `>`
|
help: you might have meant to end the type parameters here
|
LL | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical {
| +
error[E0432]: unresolved import `parse_error::Canonical`
--> $DIR/parse-error-resolve.rs:2:5
|
LL | use parse_error::Canonical;
| ^^^^^^^^^^^^^^^^^^^^^^ no `Canonical` in `parse_error`
error[E0425]: cannot find value `Canonical` in module `parse_error`
--> $DIR/parse-error-resolve.rs:6:18
|
LL | parse_error::Canonical.foo();
| ^^^^^^^^^ not found in `parse_error`
error[E0369]: cannot add `{integer}` to `&str`
--> $DIR/parse-error-resolve.rs:5:16
|
LL | let _ = "" + 1;
| -- ^ - {integer}
| |
| &str
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0369, E0425, E0432.
For more information about an error, try `rustc --explain E0369`.
+5
View File
@@ -0,0 +1,5 @@
struct Canonical;
impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { //~ ERROR expected
fn foo() {}
}
fn bar() {}
+13
View File
@@ -0,0 +1,13 @@
error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From`
--> $DIR/parse_error.rs:2:46
|
LL | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical {
| ^^^^ expected one of `+`, `,`, `::`, `=`, or `>`
|
help: you might have meant to end the type parameters here
|
LL | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical {
| +
error: aborting due to 1 previous error