You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the better FnEntry spans in protector errors
Example error, from `tests/fail/stacked_borrows/invalidate_against_protector1.rs`:
```
error: Undefined Behavior: not granting access to tag <3095> because that would remove [Unique for <3099>] which is protected because it is an argument of call 943
--> tests/fail/stacked_borrows/invalidate_against_protector1.rs:5:25
|
5 | let _val = unsafe { *x }; //~ ERROR: protect
| ^^ not granting access to tag <3095> because that would remove [Unique for <3099>] which is protected because it is an argument of call 943
|
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
help: <3095> was created by a SharedReadWrite retag at offsets [0x0..0x4]
--> tests/fail/stacked_borrows/invalidate_against_protector1.rs:10:16
|
10 | let xraw = &mut x as *mut _;
| ^^^^^^
help: <3099> is this argument
--> tests/fail/stacked_borrows/invalidate_against_protector1.rs:1:23
|
1 | fn inner(x: *mut i32, _y: &mut i32) {
| ^^
= note: backtrace:
= note: inside `inner` at tests/fail/stacked_borrows/invalidate_against_protector1.rs:5:25
note: inside `main` at tests/fail/stacked_borrows/invalidate_against_protector1.rs:12:5
--> tests/fail/stacked_borrows/invalidate_against_protector1.rs:12:5
|
12 | inner(xraw, xref);
| ^^^^^^^^^^^^^^^^^
```
Benchmarks report no change, within noise.
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/aliasing_mut1.stderr
+4-5
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
error: Undefined Behavior: not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
1
+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
2
2
--> $DIR/aliasing_mut1.rs:LL:CC
3
3
|
4
4
LL | pub fn safe(_x: &mut i32, _y: &mut i32) {}
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
5
+
| ^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
6
6
|
7
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8
8
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
@@ -11,12 +11,11 @@ help: <TAG> was created by a Unique retag at offsets [0x0..0x4]
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/aliasing_mut2.stderr
+4-9
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
error: Undefined Behavior: not granting access to tag <TAG> because incompatible item [SharedReadOnly for <TAG>] is protected by call ID
1
+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [SharedReadOnly for <TAG>] which is protected because it is an argument of call ID
2
2
--> $DIR/aliasing_mut2.rs:LL:CC
3
3
|
4
4
LL | pub fn safe(_x: &i32, _y: &mut i32) {}
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <TAG> because incompatible item [SharedReadOnly for <TAG>] is protected by call ID
5
+
| ^^ not granting access to tag <TAG> because that would remove [SharedReadOnly for <TAG>] which is protected because it is an argument of call ID
6
6
|
7
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8
8
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
@@ -11,16 +11,11 @@ help: <TAG> was created by a Unique retag at offsets [0x0..0x4]
11
11
|
12
12
LL | let xref = &mut x;
13
13
| ^^^^^^
14
-
help: <TAG> cannot be used for memory access because that would remove protected tag <TAG>, protected by this function call
14
+
help: <TAG> is this argument
15
15
--> $DIR/aliasing_mut2.rs:LL:CC
16
16
|
17
17
LL | pub fn safe(_x: &i32, _y: &mut i32) {}
18
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
-
help: <TAG> was derived from <TAG>, which in turn was created here
20
-
--> $DIR/aliasing_mut2.rs:LL:CC
21
-
|
22
-
LL | safe_raw(xshr, xraw);
23
-
| ^^^^
18
+
| ^^
24
19
= note: backtrace:
25
20
= note: inside `safe` at $DIR/aliasing_mut2.rs:LL:CC
26
21
note: inside `main` at $DIR/aliasing_mut2.rs:LL:CC
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/aliasing_mut3.stderr
+4-4
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,10 @@ error: Undefined Behavior: trying to retag from <TAG> for SharedReadOnly permiss
2
2
--> $DIR/aliasing_mut3.rs:LL:CC
3
3
|
4
4
LL | pub fn safe(_x: &mut i32, _y: &i32) {}
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
-
| |
7
-
| trying to retag from <TAG> for SharedReadOnly permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location
8
-
| this error occurs as part of FnEntry retag at ALLOC[0x0..0x4]
5
+
| ^^
6
+
| |
7
+
| trying to retag from <TAG> for SharedReadOnly permission at ALLOC[0x0], but that tag does not exist in the borrow stack for this location
8
+
| this error occurs as part of FnEntry retag at ALLOC[0x0..0x4]
9
9
|
10
10
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
11
11
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/aliasing_mut4.stderr
+4-9
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
error: Undefined Behavior: not granting access to tag <TAG> because incompatible item [SharedReadOnly for <TAG>] is protected by call ID
1
+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [SharedReadOnly for <TAG>] which is protected because it is an argument of call ID
2
2
--> $DIR/aliasing_mut4.rs:LL:CC
3
3
|
4
4
LL | pub fn safe(_x: &i32, _y: &mut Cell<i32>) {}
5
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not granting access to tag <TAG> because incompatible item [SharedReadOnly for <TAG>] is protected by call ID
5
+
| ^^ not granting access to tag <TAG> because that would remove [SharedReadOnly for <TAG>] which is protected because it is an argument of call ID
6
6
|
7
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8
8
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
@@ -11,16 +11,11 @@ help: <TAG> was created by a Unique retag at offsets [0x0..0x4]
11
11
|
12
12
LL | let xref = &mut x;
13
13
| ^^^^^^
14
-
help: <TAG> cannot be used for memory access because that would remove protected tag <TAG>, protected by this function call
14
+
help: <TAG> is this argument
15
15
--> $DIR/aliasing_mut4.rs:LL:CC
16
16
|
17
17
LL | pub fn safe(_x: &i32, _y: &mut Cell<i32>) {}
18
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19
-
help: <TAG> was derived from <TAG>, which in turn was created here
20
-
--> $DIR/aliasing_mut4.rs:LL:CC
21
-
|
22
-
LL | safe_raw(xshr, xraw as *mut _);
23
-
| ^^^^
18
+
| ^^
24
19
= note: backtrace:
25
20
= note: inside `safe` at $DIR/aliasing_mut4.rs:LL:CC
26
21
note: inside `main` at $DIR/aliasing_mut4.rs:LL:CC
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/illegal_write6.stderr
+5-15
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
error: Undefined Behavior: not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
1
+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
2
2
--> $DIR/illegal_write6.rs:LL:CC
3
3
|
4
4
LL | unsafe { *y = 2 };
5
-
| ^^^^^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
5
+
| ^^^^^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
6
6
|
7
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8
8
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
@@ -11,21 +11,11 @@ help: <TAG> was created by a SharedReadWrite retag at offsets [0x0..0x4]
11
11
|
12
12
LL | let p = x as *mut u32;
13
13
| ^
14
-
help: <TAG> cannot be used for memory access because that would remove protected tag <TAG>, protected by this function call
14
+
help: <TAG> is this argument
15
15
--> $DIR/illegal_write6.rs:LL:CC
16
16
|
17
-
LL | / fn foo(a: &mut u32, y: *mut u32) -> u32 {
18
-
LL | | *a = 1;
19
-
LL | | let _b = &*a;
20
-
LL | | unsafe { *y = 2 };
21
-
LL | | return *a;
22
-
LL | | }
23
-
| |_^
24
-
help: <TAG> was derived from <TAG>, which in turn was created here
25
-
--> $DIR/illegal_write6.rs:LL:CC
26
-
|
27
-
LL | foo(x, p);
28
-
| ^
17
+
LL | fn foo(a: &mut u32, y: *mut u32) -> u32 {
18
+
| ^
29
19
= note: backtrace:
30
20
= note: inside `foo` at $DIR/illegal_write6.rs:LL:CC
31
21
note: inside `main` at $DIR/illegal_write6.rs:LL:CC
Copy file name to clipboardExpand all lines: tests/fail/stacked_borrows/invalidate_against_protector1.stderr
+5-15
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
-
error: Undefined Behavior: not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
1
+
error: Undefined Behavior: not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
2
2
--> $DIR/invalidate_against_protector1.rs:LL:CC
3
3
|
4
4
LL | let _val = unsafe { *x };
5
-
| ^^ not granting access to tag <TAG> because incompatible item [Unique for <TAG>] is protected by call ID
5
+
| ^^ not granting access to tag <TAG> because that would remove [Unique for <TAG>] which is protected because it is an argument of call ID
6
6
|
7
7
= help: this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental
8
8
= help: see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information
@@ -11,21 +11,11 @@ help: <TAG> was created by a SharedReadWrite retag at offsets [0x0..0x4]
11
11
|
12
12
LL | let xraw = &mut x as *mut _;
13
13
| ^^^^^^
14
-
help: <TAG> cannot be used for memory access because that would remove protected tag <TAG>, protected by this function call
14
+
help: <TAG> is this argument
15
15
--> $DIR/invalidate_against_protector1.rs:LL:CC
16
16
|
17
-
LL | / fn inner(x: *mut i32, _y: &mut i32) {
18
-
LL | | // If `x` and `y` alias, retagging is fine with this... but we really
19
-
LL | | // shouldn't be allowed to use `x` at all because `y` was assumed to be
20
-
LL | | // unique for the duration of this call.
21
-
LL | | let _val = unsafe { *x };
22
-
LL | | }
23
-
| |_^
24
-
help: <TAG> was derived from <TAG>, which in turn was created here
25
-
--> $DIR/invalidate_against_protector1.rs:LL:CC
26
-
|
27
-
LL | inner(xraw, xref);
28
-
| ^^^^
17
+
LL | fn inner(x: *mut i32, _y: &mut i32) {
18
+
| ^^
29
19
= note: backtrace:
30
20
= note: inside `inner` at $DIR/invalidate_against_protector1.rs:LL:CC
31
21
note: inside `main` at $DIR/invalidate_against_protector1.rs:LL:CC
0 commit comments