-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
This code:
fn main() {
let bar = &5;
foo(&*bar);
}
fn foo(x: &mut int) -> &int {
x
}
Gives this error message:
hello.rs:3:9: 3:14 error: cannot borrow immutable dereference of `&`-pointer as mutable
hello.rs:3 foo(&*bar);
^~~~~
This error is correct, but is really complicated. First of all, &pointer
should probably use 'reference,' the term we've settled on for &T
. More importantly, it's just a very dense sentence. This came up in IRC this morning.
kiwikern
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints