<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="56927930" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/22063" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/22063/hovercard" href="https://github.com/rust-lang/rust/issues/22063">#22063</a> suggested adding a banner stating "this version is really old" but modifying rust after the fact wasn't well liked. A better way would be to add a conditional banner which checks rust-lang or something similar to see if something new has been released. It should only appear if it's too old or something similar.</p>
<p dir="auto">It could even have grades:</p>
<ul dir="auto">
<li>Yellow: soon to be out of date</li>
<li>Orange: is out of date</li>
<li>Red: way out of date</li>
</ul>
<p dir="auto">Recently it came up on <a href="http://www.reddit.com/r/rust/comments/3672gy/is_the_documentation_for_strsliceslice_wrong/" rel="nofollow">reddit</a>.</p>
<p dir="auto">Quick over: the <code class="notranslate">cfg()</code> attribute can't be used to do multiple-declaration of rust types/fns/mods along multiple-dimensions of consideration (OS, arch) without signifigant hurdle-jumping-through'ing. I spoke with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/graydon/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/graydon">@graydon</a> about this, briefly, on IRC and he was under the impression that commas in a list passed to <code class="notranslate">cfg()</code> would behave like an <code class="notranslate">&amp;&amp;</code>, but it seems, from my observation, that they act more like <code class="notranslate">||</code>.</p>
<p dir="auto">Here's a test case:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use std;
import io;

fn main() {
  io::println(&quot;#[cfg()] failure test case&quot;);
  let inst = new_foo_inst();
}

#[cfg(target_os=&quot;linux&quot;, target_arch=&quot;x86_64&quot;)]
type foo = {
  a: int, b: int
};
#[cfg(target_os=&quot;linux&quot;, target_arch=&quot;x86&quot;)]
type foo = {
  a: int, b: int, c: int
};

fn new_foo_inst() -&gt; foo {
  ret new_foo_arch();
  #[cfg(target_arch=&quot;x86_64&quot;)]
  fn new_foo_arch() -&gt; foo {
    ret { a: 0, b: 0 };
  }
  #[cfg(target_arch=&quot;x86&quot;)]
  fn new_foo_arch() -&gt; foo {
    ret { a: 0, b: 0, c: 0};
  }
}"><pre class="notranslate"><code class="notranslate">use std;
import io;

fn main() {
  io::println("#[cfg()] failure test case");
  let inst = new_foo_inst();
}

#[cfg(target_os="linux", target_arch="x86_64")]
type foo = {
  a: int, b: int
};
#[cfg(target_os="linux", target_arch="x86")]
type foo = {
  a: int, b: int, c: int
};

fn new_foo_inst() -&gt; foo {
  ret new_foo_arch();
  #[cfg(target_arch="x86_64")]
  fn new_foo_arch() -&gt; foo {
    ret { a: 0, b: 0 };
  }
  #[cfg(target_arch="x86")]
  fn new_foo_arch() -&gt; foo {
    ret { a: 0, b: 0, c: 0};
  }
}
</code></pre></div>
<p dir="auto">Will produce this compiler output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="./cfg.rs:10:0: 12:2 error: duplicate definition of type foo
./cfg.rs:10 type foo = {
./cfg.rs:11   a: int, b: int
./cfg.rs:12 };"><pre class="notranslate"><code class="notranslate">./cfg.rs:10:0: 12:2 error: duplicate definition of type foo
./cfg.rs:10 type foo = {
./cfg.rs:11   a: int, b: int
./cfg.rs:12 };
</code></pre></div>
<p dir="auto">There are workarounds, of course (As my <code class="notranslate">new_foo_inst()</code> impl shows, can acheive similar with nested branches of <code class="notranslate">os::arch</code> modules). But I think we can do better.</p>
<p dir="auto">I know this isn't high-priority (as I mentioned, I've already worked around the problem... and I'm not after a turing-completeness for <code class="notranslate">cfg()</code> :) , but it would propose changes the <code class="notranslate">cfg()</code> impl to:</p>
<ol dir="auto">
<li>Change the <code class="notranslate">,</code> in <code class="notranslate">cfg()</code> to be <code class="notranslate">||</code>.</li>
<li>Add <code class="notranslate">&amp;&amp;</code> as a supported separator, with all that it implies</li>
<li>Support arbitrary, if-like predicate nesting within <code class="notranslate">cfg()</code> using parenthesis</li>
</ol>
<p dir="auto">Also, interesting that a single <code class="notranslate">=</code> is used for "equals", here. Trying hard to avoid the impulse to not be pedantic about consistency across the language (<code class="notranslate">==</code> is used for such things in the main grammar).</p>
<p dir="auto">This is totally outside the level of my experience with the language internals so far, and I gather would involve syntax changes. I'm interested in getting my feet wet, gently, with this. Assuming that such a change would be accepted, where would I (or anyone else interested in this work) start?</p>