rollup merge of #22502: nikomatsakis/deprecate-bracket-bracket

Conflicts:
	src/libcollections/slice.rs
	src/libcollections/str.rs
	src/librustc/middle/lang_items.rs
	src/librustc_back/rpath.rs
	src/librustc_typeck/check/regionck.rs
	src/libstd/ffi/os_str.rs
	src/libsyntax/diagnostic.rs
	src/libsyntax/parse/parser.rs
	src/libsyntax/util/interner.rs
	src/test/run-pass/regions-refcell.rs
This commit is contained in:
Alex Crichton 2015-02-18 15:48:40 -08:00
commit 231eeaa35b
146 changed files with 895 additions and 882 deletions

View file

@ -37,9 +37,9 @@ impl LintPass for Pass {
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
let name = token::get_ident(it.ident);
if &name[] == "lintme" {
if &name[..] == "lintme" {
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
} else if &name[] == "pleaselintme" {
} else if &name[..] == "pleaselintme" {
cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'");
}
}

View file

@ -35,7 +35,7 @@ impl LintPass for Pass {
fn check_item(&mut self, cx: &Context, it: &ast::Item) {
let name = token::get_ident(it.ident);
if &name[] == "lintme" {
if &name[..] == "lintme" {
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
}
}

View file

@ -37,7 +37,7 @@ impl TTMacroExpander for Expander {
_: &[ast::TokenTree]) -> Box<MacResult+'cx> {
let args = self.args.iter().map(|i| pprust::meta_item_to_string(&*i))
.collect::<Vec<_>>().connect(", ");
let interned = token::intern_and_get_ident(&args[]);
let interned = token::intern_and_get_ident(&args[..]);
MacExpr::new(ecx.expr_str(sp, interned))
}
}

View file

@ -9,14 +9,12 @@
// except according to those terms.
// Test slicing &expr[] is deprecated and gives a helpful error message.
//
// ignore-test
struct Foo;
fn main() {
let x = Foo;
&x[]; //~ WARNING deprecated slicing syntax: `[]`
//~^ NOTE use `&expr[..]` to construct a slice of the whole of expr
//~^^ ERROR cannot index a value of type `Foo`
&x[];
//~^ WARN obsolete syntax
//~| ERROR cannot index
}

View file

@ -19,7 +19,7 @@ use std::cell::RefCell;
#[cfg(cannot_use_this_yet)]
fn foo<'a>(map: RefCell<HashMap<&'static str, &'a [u8]>>) {
let one = [1_usize];
assert_eq!(map.borrow().get("one"), Some(&one[]));
assert_eq!(map.borrow().get("one"), Some(&one[..]));
}
#[cfg(cannot_use_this_yet_either)]
@ -45,9 +45,9 @@ fn main() {
let one = [1u8];
let two = [2u8];
let mut map = HashMap::new();
map.insert("zero", &zer[]);
map.insert("one", &one[]);
map.insert("two", &two[]);
map.insert("zero", &zer[..]);
map.insert("one", &one[..]);
map.insert("two", &two[..]);
let map = RefCell::new(map);
foo(map);
}