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

Suggest using ref inline in an error #26819

Merged
merged 1 commit into from
Jul 17, 2015
Merged

Conversation

ftxqxd
Copy link
Contributor

@ftxqxd ftxqxd commented Jul 6, 2015

The error now looks like this:

<anon>:4:9: 4:10 error: use of moved value: `x` [E0382]
<anon>:4     foo(x);
                 ^
<anon>:3:9: 3:10 note: `x` moved here because it has type `Box<i32>`, which is moved by default
<anon>:3     let y = x;
                 ^
<anon>:3:9: 3:10 help: use `ref` to take a reference instead:
<anon>:      let ref y = x;

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@sanxiyn
Copy link
Member

sanxiyn commented Jul 7, 2015

Travis failure (license check) is real.

@ftxqxd
Copy link
Contributor Author

ftxqxd commented Jul 7, 2015

Fixed.

@nikomatsakis
Copy link
Contributor

Hmm. I'm not sure about this sort of help in general. I mean, taking a ref may be what they want, but it might not. Perhaps we can phrase this to make it clearer? Something like, "if you would like to borrow the value instead, you can use a ref binding, as shown".

@nikomatsakis
Copy link
Contributor

Sorry, I know this is pre-existing :) I've just had this concern for a while...

@nikomatsakis
Copy link
Contributor

Otherwise, looks really nice, and I'm happy to see span_suggestion getting more use.

@ftxqxd
Copy link
Contributor Author

ftxqxd commented Jul 11, 2015

Good point—I’ve changed it to read if you would like to borrow the value instead, use arefbinding as shown: instead.

@nikomatsakis
Copy link
Contributor

@bors r+ nice!

@bors
Copy link
Contributor

bors commented Jul 15, 2015

📌 Commit 0bf9fbb has been approved by nikomatsakis

Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 16, 2015
 The error now looks like this:

```
<anon>:4:9: 4:10 error: use of moved value: `x` [E0382]
<anon>:4     foo(x);
                 ^
<anon>:3:9: 3:10 note: `x` moved here because it has type `Box<i32>`, which is moved by default
<anon>:3     let y = x;
                 ^
<anon>:3:9: 3:10 help: use `ref` to take a reference instead:
<anon>:      let ref y = x;
```
@bors bors merged commit 0bf9fbb into rust-lang:master Jul 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants