Stream: general

Topic: misc_question


csmoe (Sep 01 2018 at 10:09, on Zulip):

@nikomatsakis
the lint

data.iter().cloned()
^^^^ data is borrowed here

in your new diag issue https://github.com/rust-lang/rust/issues/53882 reminds me of https://github.com/rust-lang/rust/issues/25507#issuecomment-262564469

error[E0507]: cannot move out of borrowed content
 --> <anon>:9:26
  |
9 |         println!("{:?}", y.field.unwrap_or(X));
  |                          ^ cannot move out of borrowed content

can we add the info like Mover/Borrower into diag like

data.iter().cloned()
^^^^ data is borrowed by `iter(...)`here

and

error[E0507]: cannot move out of borrowed content
 --> <anon>:9:26
  |
  |         println!("{:?}", y.field.unwrap_or(X));
  |                          ^ cannot move out of borrowed content, moved by unwrap_or(...)

it'll be more friendly for users to locate them.

nikomatsakis (Sep 01 2018 at 11:41, on Zulip):

perhaps, yes. I do think there are a few things in our semantics that can be non-obvious:

e.g., Foo { }.iter() makes a temporary, but this is not obvious

Nicole Mazzuca (Sep 01 2018 at 14:02, on Zulip):

(this is what I mean by "we should define a model in terms of Rust rvalues/lvalues, because this is already what a Rust user must understand" - this is all to do with lvalues)

Last update: Nov 20 2019 at 11:30UTC