1
Fork 0

rollup merge of #20721: japaric/snap

Conflicts:
	src/libcollections/vec.rs
	src/libcore/fmt/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/session/config.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/context.rs
	src/librustc_trans/trans/type_.rs
	src/librustc_typeck/check/_match.rs
	src/librustdoc/html/format.rs
	src/libsyntax/std_inject.rs
	src/libsyntax/util/interner.rs
	src/test/compile-fail/mut-pattern-mismatched.rs
This commit is contained in:
Alex Crichton 2015-01-07 17:26:58 -08:00
commit 6e806bdefd
236 changed files with 2421 additions and 2495 deletions

View file

@ -40,7 +40,7 @@ pub fn maybe_inject_prelude(krate: ast::Crate) -> ast::Crate {
}
fn use_std(krate: &ast::Crate) -> bool {
!attr::contains_name(krate.attrs.index(&FullRange), "no_std")
!attr::contains_name(&krate.attrs[], "no_std")
}
fn no_prelude(attrs: &[ast::Attribute]) -> bool {
@ -56,7 +56,7 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> {
// The name to use in `extern crate "name" as std;`
let actual_crate_name = match self.alt_std_name {
Some(ref s) => token::intern_and_get_ident(s.index(&FullRange)),
Some(ref s) => token::intern_and_get_ident(&s[]),
None => token::intern_and_get_ident("std"),
};
@ -106,14 +106,27 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
// only add `use std::prelude::*;` if there wasn't a
// `#![no_implicit_prelude]` at the crate level.
// fold_mod() will insert glob path.
if !no_prelude(krate.attrs.index(&FullRange)) {
if !no_prelude(&krate.attrs[]) {
// only add `use std::prelude::*;` if there wasn't a
// `#![no_implicit_prelude]` at the crate level.
// fold_mod() will insert glob path.
let globs_attr = attr::mk_attr_inner(attr::mk_attr_id(),
attr::mk_list_item(
InternedString::new("feature"),
vec!(
attr::mk_word_item(InternedString::new("globs")),
)));
// std_inject runs after feature checking so manually mark this attr
attr::mark_used(&globs_attr);
krate.attrs.push(globs_attr);
krate.module = self.fold_mod(krate.module);
}
krate
}
fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
if !no_prelude(item.attrs.index(&FullRange)) {
if !no_prelude(&item.attrs[]) {
// only recur if there wasn't `#![no_implicit_prelude]`
// on this item, i.e. this means that the prelude is not
// implicitly imported though the whole subtree