Comments on: [rust] what’s a tuple variant? /2019/10/rust-whats-a-tuple-variant/ Sarah Allen's reflections on internet software and other topics Sun, 13 Oct 2019 18:03:43 +0000 hourly 1 https://wordpress.org/?v=5.7.1 By: Kornel /2019/10/rust-whats-a-tuple-variant/#comment-18539 Sun, 13 Oct 2019 17:03:06 +0000 /?p=6859#comment-18539 I hoped it’d be an easy to fix it by just saying “enum variant” (since you shouldn’t need to care what kind of variant it is – the message should be suggesting the right one), but unfortunately it’s coming from a general-purpose error message:

https://github.com/rust-lang/rust/blob/aa2ae564d391a3da10bca2a79ab529a9925fbe58/src/librustc_resolve/diagnostics.rs#L61-L66

that uses descr() of whatever it finds:

https://github.com/rust-lang/rust/blob/aa2ae564d391a3da10bca2a79ab529a9925fbe58/src/librustc/hir/def.rs#L85-L95

and descr() makes a distinction between enum and different kinds of enum variants (and there’s “unit variant”, ugh!)

]]>