forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update test for
E0796
and static_mut_ref
lint
- Loading branch information
Showing
51 changed files
with
786 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
warning: shared reference of mutable static is discouraged | ||
--> $DIR/static-mut-foreign.rs:35:18 | ||
| | ||
LL | static_bound(&rust_dbg_static_mut); | ||
| ^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static | ||
| | ||
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> | ||
= note: reference of mutable static is a hard error from 2024 edition | ||
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior | ||
= note: `#[warn(static_mut_ref)]` on by default | ||
help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer | ||
| | ||
LL | static_bound(addr_of!(rust_dbg_static_mut)); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
warning: mutable reference of mutable static is discouraged | ||
--> $DIR/static-mut-foreign.rs:37:22 | ||
| | ||
LL | static_bound_set(&mut rust_dbg_static_mut); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static | ||
| | ||
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> | ||
= note: reference of mutable static is a hard error from 2024 edition | ||
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior | ||
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer | ||
| | ||
LL | static_bound_set(addr_of_mut!(rust_dbg_static_mut)); | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
warning: 2 warnings emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
warning: mutable reference of mutable static is discouraged | ||
--> $DIR/borrowck-unsafe-static-mutable-borrows.rs:19:30 | ||
| | ||
LL | let sfoo: *mut Foo = &mut SFOO; | ||
| ^^^^^^^^^ mutable reference of mutable static | ||
| | ||
= note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447> | ||
= note: reference of mutable static is a hard error from 2024 edition | ||
= note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior | ||
= note: `#[warn(static_mut_ref)]` on by default | ||
help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer | ||
| | ||
LL | let sfoo: *mut Foo = addr_of_mut!(SFOO); | ||
| ~~~~~~~~~~~~~~~~~~ | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.