Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f77c183

Browse files
committedMay 11, 2023
Report all lints, even if other errors already occurred.
This reduces surprises of the "I fixed all the errors, now I'm getting new ones"-kind
1 parent 4d941cd commit f77c183

File tree

91 files changed

+1122
-375
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1122
-375
lines changed
 

‎compiler/rustc_interface/src/passes.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -790,15 +790,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
790790

791791
sess.time("layout_testing", || layout_test::test_layout(tcx));
792792

793-
// Avoid overwhelming user with errors if borrow checking failed.
794-
// I'm not sure how helpful this is, to be honest, but it avoids a
795-
// lot of annoying errors in the ui tests (basically,
796-
// lint warnings and so on -- kindck used to do this abort, but
797-
// kindck is gone now). -nmatsakis
798-
if let Some(reported) = sess.has_errors() {
799-
return Err(reported);
800-
}
801-
802793
sess.time("misc_checking_3", || {
803794
parallel!(
804795
{

‎tests/ui/borrowck/borrowck-access-permissions.rs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,59 @@
1-
static static_x : i32 = 1;
2-
static mut static_x_mut : i32 = 1;
1+
static STATIC_X: i32 = 1;
2+
static mut STATIC_X_MUT: i32 = 1;
33

44
fn main() {
55
let x = 1;
66
let mut x_mut = 1;
77

8-
{ // borrow of local
8+
{
9+
// borrow of local
910
let _y1 = &mut x; //~ ERROR [E0596]
1011
let _y2 = &mut x_mut; // No error
1112
}
1213

13-
{ // borrow of static
14-
let _y1 = &mut static_x; //~ ERROR [E0596]
15-
unsafe { let _y2 = &mut static_x_mut; } // No error
14+
{
15+
// borrow of static
16+
let _y1 = &mut STATIC_X; //~ ERROR [E0596]
17+
unsafe {
18+
let _y2 = &mut STATIC_X_MUT;
19+
} // No error
1620
}
1721

18-
{ // borrow of deref to box
22+
{
23+
// borrow of deref to box
1924
let box_x = Box::new(1);
2025
let mut box_x_mut = Box::new(1);
2126

2227
let _y1 = &mut *box_x; //~ ERROR [E0596]
2328
let _y2 = &mut *box_x_mut; // No error
2429
}
2530

26-
{ // borrow of deref to reference
31+
{
32+
// borrow of deref to reference
2733
let ref_x = &x;
2834
let ref_x_mut = &mut x_mut;
2935

3036
let _y1 = &mut *ref_x; //~ ERROR [E0596]
3137
let _y2 = &mut *ref_x_mut; // No error
3238
}
3339

34-
{ // borrow of deref to pointer
35-
let ptr_x : *const _ = &x;
36-
let ptr_mut_x : *mut _ = &mut x_mut;
40+
{
41+
// borrow of deref to pointer
42+
let ptr_x: *const _ = &x;
43+
let ptr_mut_x: *mut _ = &mut x_mut;
3744

3845
unsafe {
3946
let _y1 = &mut *ptr_x; //~ ERROR [E0596]
4047
let _y2 = &mut *ptr_mut_x; // No error
4148
}
4249
}
4350

44-
{ // borrowing mutably through an immutable reference
45-
struct Foo<'a> { f: &'a mut i32, g: &'a i32 };
51+
{
52+
// borrowing mutably through an immutable reference
53+
struct Foo<'a> {
54+
f: &'a mut i32,
55+
g: &'a i32,
56+
};
4657
let mut foo = Foo { f: &mut x_mut, g: &x };
4758
let foo_ref = &foo;
4859
let _y = &mut *foo_ref.f; //~ ERROR [E0596]

0 commit comments

Comments
 (0)
Please sign in to comment.