These are chat archives for rust-lang/rust

8th
Mar 2017
Tim
@tikue
Mar 08 2017 04:55
are there any plans to turn off the "irrefutable if let" error and make it a warning instead
makes writing correct macro code a lot harder
than it should be
Peter Atashian
@retep998
Mar 08 2017 05:00
I don't know of any plans or RFCs or pre-RFCs to do so
Tim
@tikue
Mar 08 2017 06:21
I was thinking there might be something related to !
Joonas Koivunen
@koivunej
Mar 08 2017 11:13
re: the rust-move-copy-borrow article linked above. is it truly so that let m = &mut sunder "Mutable borrow" header is not copyable? perhaps not-copyable because let s: String (which is not Copy) but I don't think exclusive &mut borrow implies "cannot copy"..
Felix S Klock II
@pnkfelix
Mar 08 2017 11:17
@koivunej it does. See e.g.: https://is.gd/mPnG1k
@koivunej Here's one justification for this rule: the value could be put into some intermediate state that is internally inconsistent. You wouldn't want to copy the value at that point.
@koivunej (obviously in a simple case like the one in the playpen above, one can just copy the value before doing the borrow...)
Joonas Koivunen
@koivunej
Mar 08 2017 11:22
@pnkfelix: oh yes, I understood the "copy restriction" being on m, not the currently borrowed out s. surely you could copy value of m or in your playpen link let mut s3 = *r;?
Felix S Klock II
@pnkfelix
Mar 08 2017 11:22
you can't copy m because its a mutable borrow
that is, you can move m, but you cannot have two copies of same the &mut reference
in other words, you are describing copying *m; but the article is saying that you cannot copy m itself.
Joonas Koivunen
@koivunej
Mar 08 2017 11:26
oh yes. i was thinking about copying *m but don't know how to pronounce it. ok, now it makes sense, thanks. perhaps in my mind I didn't consider the borrowed m to be separate from the value it is a "borrow of"
Felix S Klock II
@pnkfelix
Mar 08 2017 11:28
ah yes the classic "the map is not the terrain", or one of those other aphorisms.
mhsjlw
@mhsjlw
Mar 08 2017 15:09
Hey, gravity scripting language is on trending today, is anyone working on bindings for it? I'd love to use it from Rust