Skip to content

Commit 7ca3b75

Browse files
committed
Add test for resolve errors caused by mod with parse errors
1 parent acabb52 commit 7ca3b75

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mod parse_error;
2+
use parse_error::Canonical; //~ ERROR E0432
3+
4+
fn main() {
5+
let _ = "" + 1; //~ ERROR E0369
6+
parse_error::Canonical.foo(); //~ ERROR E0425
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From`
2+
--> $DIR/parse_error.rs:2:46
3+
|
4+
2 | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { //~ ERROR expected
5+
| ^^^^ expected one of `+`, `,`, `::`, `=`, or `>`
6+
|
7+
help: you might have meant to end the type parameters here
8+
|
9+
2 | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical { //~ ERROR expected
10+
| +
11+
12+
error[E0432]: unresolved import `parse_error::Canonical`
13+
--> $DIR/parse-error-resolve.rs:2:5
14+
|
15+
2 | use parse_error::Canonical; // ok, `parse_error.rs` has a parse error
16+
| ^^^^^^^^^^^^^^^^^^^^^^ no `Canonical` in `parse_error`
17+
18+
error[E0425]: cannot find value `Canonical` in module `parse_error`
19+
--> $DIR/parse-error-resolve.rs:6:18
20+
|
21+
6 | parse_error::Canonical.foo(); // ok, `parse_error.rs` has a parse error
22+
| ^^^^^^^^^ not found in `parse_error`
23+
24+
error[E0369]: cannot add `{integer}` to `&str`
25+
--> $DIR/parse-error-resolve.rs:5:16
26+
|
27+
5 | let _ = "" + 1; //~ ERROR E0369
28+
| -- ^ - {integer}
29+
| |
30+
| &str
31+
32+
error: aborting due to 4 previous errors
33+
34+
Some errors have detailed explanations: E0369, E0425, E0432.
35+
For more information about an error, try `rustc --explain E0369`.

tests/ui/resolve/parse_error.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
struct Canonical;
2+
impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical { //~ ERROR expected
3+
fn foo() {}
4+
}
5+
fn bar() {}

tests/ui/resolve/parse_error.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: expected one of `+`, `,`, `::`, `=`, or `>`, found `From`
2+
--> $DIR/parse_error.rs:2:46
3+
|
4+
LL | impl<S: Into<std::borrow::Cow<'static, str>> From<S> for Canonical {
5+
| ^^^^ expected one of `+`, `,`, `::`, `=`, or `>`
6+
|
7+
help: you might have meant to end the type parameters here
8+
|
9+
LL | impl<S: Into<std::borrow::Cow<'static, str>>> From<S> for Canonical {
10+
| +
11+
12+
error: aborting due to 1 previous error
13+

0 commit comments

Comments
 (0)