-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Moved value is still accessible #24069
Comments
I don't think this is a bug. Moved values aren't usable, but you're not using it, you're assigning a new value to it. |
/cc @nikomatsakis |
This can be misleading. A guy was showing this on IRC. If it had triggered a move error he probably would have caught it. As it is, he wasn't noticing that the value had moved. The original question on botbot. The original questions code: #[derive(Debug)]
pub struct Node<T>{
pub item: T,
pub next: Option<Box<Node<T>>>
}
impl <T>Node<T>{
pub fn new(item: T) -> Node<T> {
Node::<T> {item: item, next: None}
}
}
pub fn main() {
let mut first = Node::new("to");
let mut second = Node::new("be");
let mut third = Node::new("or");
let mut fourth = Node::new("not");
let fifth = Node::new("to");
first.next = Some(Box::new(second));
second.next = Some(Box::new(third));
third.next = Some(Box::new(fourth));
fourth.next = Some(Box::new(fifth));
println!("{:?}", first);
} |
I believe this is a dup of #21232 |
Ah yes it is |
This looks like a bug to me. No one responded on IRC so I'm uncertain though:
playpen
The text was updated successfully, but these errors were encountered: