Skip to content

Commit

Permalink
Adjust the mutable_borrow_reservation_conflict message
Browse files Browse the repository at this point in the history
We aren't sure if this will become an error or not yet.
  • Loading branch information
matthewjasper committed Apr 4, 2019
1 parent 800be4c commit b3f6266
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/librustc/lint/mod.rs
Expand Up @@ -716,6 +716,10 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
"once this method is added to the standard library, \
the ambiguity may cause an error or change in behavior!"
.to_owned()
} else if lint_id == LintId::of(crate::lint::builtin::MUTABLE_BORROW_RESERVATION_CONFLICT) {
"this borrowing pattern was not meant to be accepted, \
and may become a hard error in the future"
.to_owned()
} else if let Some(edition) = future_incompatible.edition {
format!("{} in the {} edition!", STANDARD_MESSAGE, edition)
} else {
Expand Down
Expand Up @@ -32,7 +32,7 @@ LL | v.push(shared.len());
| mutable borrow occurs here
|
= note: #[warn(mutable_borrow_reservation_conflict)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= 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
Expand Down
Expand Up @@ -32,7 +32,7 @@ LL | v.push(shared.len());
| mutable borrow occurs here
|
= note: #[warn(mutable_borrow_reservation_conflict)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= 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
Expand Down
Expand Up @@ -43,10 +43,10 @@ fn reservation_conflict() {
//[nll2015]~^ ERROR cannot borrow `v` as mutable
//[nll2018]~^^ ERROR cannot borrow `v` as mutable
//[migrate2015]~^^^ WARNING cannot borrow `v` as mutable
//[migrate2015]~| WARNING will become a hard error in a future release
//[migrate2015]~| WARNING may become a hard error in the future

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

//[ast]~^^^^^^^^^ ERROR cannot borrow `v` as mutable
}
Expand Down
Expand Up @@ -23,7 +23,7 @@ mod future_compat_warn {

v.push(shared.len());
//~^ WARNING cannot borrow `v` as mutable
//~| WARNING will become a hard error in a future release
//~| WARNING may become a hard error in the future
}
}

Expand All @@ -36,7 +36,7 @@ mod future_compat_deny {

v.push(shared.len());
//~^ ERROR cannot borrow `v` as mutable
//~| WARNING will become a hard error in a future release
//~| WARNING may become a hard error in the future
}
}

Expand Down
Expand Up @@ -14,7 +14,7 @@ note: lint level defined here
|
LL | #![warn(mutable_borrow_reservation_conflict)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= 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: cannot borrow `v` as mutable because it is also borrowed as immutable
Expand All @@ -33,7 +33,7 @@ note: lint level defined here
|
LL | #![deny(mutable_borrow_reservation_conflict)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= 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 previous error
Expand Down

0 comments on commit b3f6266

Please sign in to comment.