Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upIndexing Autoref + Borrow = :( #22826
Comments
This comment has been minimized.
This comment has been minimized.
|
CC @aturon |
This comment has been minimized.
This comment has been minimized.
|
The ICE is definitely a bug, which I may have introduced: use std::collections::HashMap;
fn main(){
let mut map = HashMap::new();
map.insert("foo".to_string(), "bar".to_string());
// Ok, maybe I can deref to cancel out the autoref?
let key = "foo";
println!("{}", map[*key]);
} |
This comment has been minimized.
This comment has been minimized.
|
Yeah, that was my work-around, but I think we can all agree that that's pretty awful. |
steveklabnik
added
the
I-ICE
label
Feb 26, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: I-nominated |
This comment has been minimized.
This comment has been minimized.
|
(Hm, triage bot seems to be busted.) |
aturon
added
the
I-nominated
label
Mar 17, 2015
This comment has been minimized.
This comment has been minimized.
|
Nominating: we need to at least get the |
This comment has been minimized.
This comment has been minimized.
|
1.0 beta for addressing the ICE. its not clear whether we have time for a breaking-change to try to fix the trait. (and its also not clear whether a breaking-change is the only option for fixing the trait; e.g. there may be some method via deref-coercion or other magic.) |
pnkfelix
added this to the 1.0 beta milestone
Mar 19, 2015
pnkfelix
added
P-medium
and removed
I-nominated
labels
Mar 19, 2015
This comment has been minimized.
This comment has been minimized.
|
Update: @nikomatsakis is looking into changing the traits to work by-value, as the RFC originally intended. |
This comment has been minimized.
This comment has been minimized.
|
Now that index operators take arguments by value I believe this bug is actually fixed. Yay! use std::collections::HashMap;
fn main() {
let mut m = HashMap::new();
m.insert("a".to_string(), 2);
println!("{}", m["a"]);
} |
alexcrichton
closed this
Mar 26, 2015
This comment has been minimized.
This comment has been minimized.
|
Does the ICE have a separate issue? |
This comment has been minimized.
This comment has been minimized.
|
If you do |
Gankro commentedFeb 26, 2015
:(
:((((((
These two conveniences are basically cancelling each-other out for the super-natural case of doing lookup with a string literal. Is there something that can be done about this?