Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch mutable_borrow_reservation_conflict lint to deny by default #76104

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ declare_lint! {

declare_lint! {
pub MUTABLE_BORROW_RESERVATION_CONFLICT,
Warn,
Deny,
"reservation of a two-phased borrow conflicts with other shared borrows",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #59159 <https://github.com/rust-lang/rust/issues/59159>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LL | v.extend(&v);
| | immutable borrow later used by call
| mutable borrow occurs here

warning: cannot borrow `v` as mutable because it is also borrowed as immutable
error: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
LL | let shared = &v;
Expand All @@ -31,10 +31,10 @@ LL | v.push(shared.len());
| |
| mutable borrow occurs here
|
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
= note: `#[deny(mutable_borrow_reservation_conflict)]` on by default
= warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
= note: for more information, see issue #59159 <https://github.com/rust-lang/rust/issues/59159>

error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0502`.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LL | v.extend(&v);
| | immutable borrow later used by call
| mutable borrow occurs here

warning: cannot borrow `v` as mutable because it is also borrowed as immutable
error: cannot borrow `v` as mutable because it is also borrowed as immutable
--> $DIR/two-phase-reservation-sharing-interference-2.rs:40:5
|
LL | let shared = &v;
Expand All @@ -31,10 +31,10 @@ LL | v.push(shared.len());
| |
| mutable borrow occurs here
|
= note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
= note: `#[deny(mutable_borrow_reservation_conflict)]` on by default
= warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
= note: for more information, see issue #59159 <https://github.com/rust-lang/rust/issues/59159>

error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0502`.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ fn reservation_conflict() {
v.push(shared.len());
//[nll2015]~^ ERROR cannot borrow `v` as mutable
//[nll2018]~^^ ERROR cannot borrow `v` as mutable
//[migrate2015]~^^^ WARNING cannot borrow `v` as mutable
//[migrate2015]~^^^ ERROR cannot borrow `v` as mutable
//[migrate2015]~| WARNING may become a hard error in the future

//[migrate2018]~^^^^^^ WARNING cannot borrow `v` as mutable
//[migrate2018]~^^^^^^ ERROR cannot borrow `v` as mutable
//[migrate2018]~| WARNING may become a hard error in the future
}

Expand Down