2 ms·
Rust has a fun similar one. I'm assuming for the same reason as C#: contextual keywords. union union<'union> { union: &'union union<'union>, } https
by steveklabnik 9y ago
Rust has a fun similar one. I'm assuming for the same reason as C#: contextual keywords.
union union<'union> {
union: &'union union<'union>,
}
https://github.com/rust-lang/rust/blob/59675d29eb47eb743026dcc0737884f548f2197a/src/test/run-pass/weird-exprs.rs#L110-L112 https://github.com/rust-lang/rust/blob/59675d29eb47eb743026d...
- AndyKelley 9y agoplease, I have to know, what is evil_lincoln testing?
- steveklabnik 9y agoThis is why I love this file. To understand what evil_lincoln is doing, you have to understand very old Rust. Here's the commit that introduced it: https://github.com/rust-lang/rust/commit/664b0ad3fcead4fe4d22c05065a82a338770c429 https://github.com/rust-lang/rust/commit/664b0ad3fcead4fe4d2... fn evil_lincoln() { let evil <- log "lincoln"; } log was a keyword to print stuff to the screen. Hence the joke, https://en.wikipedia.org/wiki/Lincoln_Logs https://en.wikipedia.org/wiki/Lincoln_Logs Now that log is the println! macro, the joke is lost. It doesn't say explicitly why this is "weird", but given some other comments in the file, // FIXME: Doesn't compile //let _x = log true == (ret 0); I am assuming that using the return value of log was buggy, and so this tested that you could save it in a variable. I don't remember the exact semantics of log, but if it's like println!, it returns (), which is useless, so binding it to a variable is something you'd never write in real code, so it's "weird" in that sense.