Uh oh!
There was an error while loading. Please reload this page.
Point to definition when modifying field of immutable variable - #40767
Point to definition when modifying field of immutable variable#40767estebank wants to merge 1 commit into
Conversation
rust-highfive
commented
Mar 23, 2017
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Mark-Simulacrum
commented
Mar 23, 2017
It'd be nice to avoid the phrasing "immutable field" since it's not really the field that's immutable, but more the binding of the struct. I'm not sure I can come up with anything better than "immutable binding," though, which isn't great either. The help message does alleviate most of the potential pain from this, so while nice to improve, certainly not necessary. |
0f8c678 to
289772fCompareGiven a file
```rust
struct S {
x: i32,
}
fn foo() {
let s = S { x: 42 };
s.x += 1;
}
fn bar(s: S) {
s.x += 1;
}
```
Provide the following output:
```rust
error: cannot assign to immutable field `s.x`
--> $DIR/issue-35937.rs:16:5
|
5 | let s = S { x: 42 };
| - consider changing this to `mut s`
6 | s.x += 1;
| ^^^^^^^^ cannot mutably borrow immutable field
error: cannot assign to immutable field `s.x`
--> $DIR/issue-35937.rs:20:5
|
8 | fn bar(s: S) {
| - consider changing this to `mut s`
9 | s.x += 1;
| ^^^^^^^^ cannot mutably borrow immutable field
```
Follow up to rust-lang#40445. Fixrust-lang#35937.pnkfelix
commented
Mar 30, 2017
@bors r+ |
bors
commented
Mar 30, 2017
📌 Commit 289772f has been approved by |
bors
commented
Mar 30, 2017
⌛ Testing commit 289772f with merge 83d832d... |
bors
commented
Mar 30, 2017
💔 Test failed - status-travis |
estebank
commented
Apr 2, 2017
@bors retry |
bors
commented
Apr 2, 2017
⌛ Testing commit 289772f with merge d1023ae... |
bors
commented
Apr 2, 2017
💔 Test failed - status-travis |
alexcrichton
commented
Apr 2, 2017
via email
@bors: retry
* network error …On Sun, Apr 2, 2017 at 12:06 PM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/217835654>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#40767 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95IYapgdutfh1OLNNGqyDfVQyFaSCks5rr-OPgaJpZM4MnLU7>
.
|
bors
commented
Apr 3, 2017
⌛ Testing commit 289772f with merge 7f2ec26... |
bors
commented
Apr 3, 2017
💔 Test failed - status-travis |
estebank
commented
Apr 3, 2017
@bors retry |
bors
commented
Apr 3, 2017
⌛ Testing commit 289772f with merge cd0a4f3... |
bors
commented
Apr 3, 2017
💔 Test failed - status-travis |
alexcrichton
commented
Apr 3, 2017
via email
| … On Mon, Apr 3, 2017 at 12:52 PM, bors ***@***.***> wrote:
💔 Test failed - status-travis
<https://travis-ci.org/rust-lang/rust/builds/218183568>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#40767 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAD95MV5yw_Q3VTl2iQ_uY3N9xvjHpvWks5rsT_agaJpZM4MnLU7>
.
|
bors
commented
Apr 5, 2017
⌛ Testing commit 289772f with merge ceaaebc... |
bors
commented
Apr 5, 2017
💔 Test failed - status-travis |
estebank
commented
Apr 5, 2017
@bors retry |
alexcrichton
commented
Apr 5, 2017
@bors: r- I think that's a legitimate error unfortunately: |
estebank
commented
Apr 5, 2017
@alexcrichton it seems like #40841supersedes this PR. |
Given a file
Provide the following output:
Follow up to #40445. Fix#35937.