tuple_indexing feature question


#1

Hi Rustaceans,

I’m reading the reference have found a difference between the compiler and the documentation on #![feature]:

Without this directive, all features are considered off, and using the features will result in a compiler error.

tuple_indexing - Allows use of tuple indexing (expressions like expr.0)

If a feature is promoted to a language feature, then all existing programs will start to receive compilation warnings about #[feature] directives which enabled the new feature (because the directive is no longer necessary).

However, I’m not turning on tuple_indexing but it’s not giving me a compiler error or a warning that the feature has been promoted:

fn main() {   let tuple = (9u, 10u, 11u);   println!(“tuple.2 = {}”, tuple.2);   println!(“value.2 = {}”, (9u, 10u, 11u).2); }

Does the bug lie in the documentation or the code?


#3

Tuple indexing has not been un-feature-gated yet, as the RFC for doing so hasn’t been accepted yet. It is probable that it will be un-feature-gated soon, though. That code shouldn’t actually compile; it does because of a bug in the compiler.


#4

@P1start thanks. I won’t yet patch the documentation then :slight_smile:


#5

The bug is that feature gating doesn’t work with macros - you are using the tuple index operation inside println! (a macro) and so feature gating is not checked. This is a bug with rustc, we need to fix it before 1.0…