Skip to content

Commit 8395dbd

Browse files
committed
Never stop due to errors before borrow checking
1 parent f69acab commit 8395dbd

22 files changed

+146
-35
lines changed

src/librustc_interface/passes.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,6 @@ fn analysis<'tcx>(
936936
});
937937
});
938938

939-
// Abort so we don't try to construct MIR with liveness errors.
940-
// We also won't want to continue with errors from rvalue promotion
941-
// We only do so if the only error found so far *isn't* a missing `fn main()`
942-
if !(entry_point.is_none() && sess.err_count() == 1) {
943-
tcx.sess.abort_if_errors();
944-
}
945-
946939
time(sess, "borrow checking", || {
947940
if tcx.use_ast_borrowck() {
948941
borrowck::check_crate(tcx);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {}
22

33
const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument
4-
a + b
4+
a + b //~ ERROR can only call other `min_const_fn` within a `min_const_fn`
55
}

src/test/ui/consts/const_let_refutable.stderr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ error[E0005]: refutable pattern in function argument: `&[]` not covered
44
LL | const fn slice([a, b]: &[i32]) -> i32 {
55
| ^^^^^^ pattern `&[]` not covered
66

7-
error: aborting due to previous error
7+
error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563)
8+
--> $DIR/const_let_refutable.rs:4:5
9+
|
10+
LL | a + b
11+
| ^^^^^
12+
|
13+
= help: add #![feature(const_fn)] to the crate attributes to enable
14+
15+
error: aborting due to 2 previous errors
816

9-
For more information about this error, try `rustc --explain E0005`.
17+
Some errors occurred: E0005, E0723.
18+
For more information about an error, try `rustc --explain E0005`.

src/test/ui/error-codes/E0007.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ fn main() {
44
op_string @ Some(s) => {},
55
//~^ ERROR E0007
66
//~| ERROR E0303
7+
//~| ERROR E0382
78
None => {},
89
}
910
}

src/test/ui/error-codes/E0007.stderr

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,18 @@ error[E0303]: pattern bindings are not allowed after an `@`
1010
LL | op_string @ Some(s) => {},
1111
| ^ not allowed after `@`
1212

13-
error: aborting due to 2 previous errors
13+
error[E0382]: use of partially moved value: `x`
14+
--> $DIR/E0007.rs:4:9
15+
|
16+
LL | op_string @ Some(s) => {},
17+
| ^^^^^^^^^^^^^^^^^-^
18+
| | |
19+
| | value moved here
20+
| value used here after move
21+
|
22+
= note: move occurs because the value has type `std::string::String`, which does not implement the `Copy` trait
23+
24+
error: aborting due to 3 previous errors
1425

15-
Some errors occurred: E0007, E0303.
26+
Some errors occurred: E0007, E0303, E0382.
1627
For more information about an error, try `rustc --explain E0007`.

src/test/ui/error-codes/E0030-teach.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ fn main() {
44
match 5u32 {
55
1000 ..= 5 => {}
66
//~^ ERROR lower range bound must be less than or equal to upper
7+
//~| ERROR lower range bound must be less than or equal to upper
78
}
89
}

src/test/ui/error-codes/E0030-teach.stderr

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ LL | 1000 ..= 5 => {}
66
|
77
= note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range.
88

9-
error: aborting due to previous error
9+
error[E0030]: lower range bound must be less than or equal to upper
10+
--> $DIR/E0030-teach.rs:5:9
11+
|
12+
LL | 1000 ..= 5 => {}
13+
| ^^^^ lower bound larger than upper bound
14+
15+
error: aborting due to 2 previous errors
1016

1117
For more information about this error, try `rustc --explain E0030`.

src/test/ui/error-codes/E0301.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ fn main() {
22
match Some(()) {
33
None => { },
44
option if option.take().is_none() => {}, //~ ERROR E0301
5-
Some(_) => { }
5+
Some(_) => { } //~^ ERROR E0596
66
}
77
}

src/test/ui/error-codes/E0301.stderr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ error[E0301]: cannot mutably borrow in a pattern guard
44
LL | option if option.take().is_none() => {},
55
| ^^^^^^ borrowed mutably in pattern guard
66

7-
error: aborting due to previous error
7+
error[E0596]: cannot borrow immutable local variable `option` as mutable
8+
--> $DIR/E0301.rs:4:19
9+
|
10+
LL | option if option.take().is_none() => {},
11+
| ------ ^^^^^^ cannot borrow mutably
12+
| |
13+
| help: make this binding mutable: `mut option`
14+
15+
error: aborting due to 2 previous errors
816

9-
For more information about this error, try `rustc --explain E0301`.
17+
Some errors occurred: E0301, E0596.
18+
For more information about an error, try `rustc --explain E0301`.

src/test/ui/error-codes/E0302.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ fn main() {
22
match Some(()) {
33
None => { },
44
option if { option = None; false } => { }, //~ ERROR E0302
5-
Some(_) => { }
5+
Some(_) => { } //~^ ERROR E0384
66
}
77
}

0 commit comments

Comments
 (0)