Skip to content

Commit 5681ef5

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 179193 b: refs/heads/auto c: 724bf7b h: refs/heads/master i: 179191: ac0bacd v: v3
1 parent 5ecd03b commit 5681ef5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+315
-342
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 7ebf9bc5c22155d622537ded42b4ebf94238b296
13+
refs/heads/auto: 724bf7bce2b35ac5731cf7e217c0e87916517b69
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcollections/btree/map.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,6 @@ impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
910910
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
911911
where Q: BorrowFrom<K> + Ord
912912
{
913-
type Output = V;
914-
915913
fn index_mut(&mut self, key: &Q) -> &mut V {
916914
self.get_mut(key).expect("no entry found for key")
917915
}

branches/auto/src/libcollections/ring_buf.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,8 +1591,6 @@ impl<A> Index<usize> for RingBuf<A> {
15911591

15921592
#[stable(feature = "rust1", since = "1.0.0")]
15931593
impl<A> IndexMut<usize> for RingBuf<A> {
1594-
type Output = A;
1595-
15961594
#[inline]
15971595
fn index_mut(&mut self, i: &usize) -> &mut A {
15981596
self.get_mut(*i).expect("Out of bounds access")

branches/auto/src/libcollections/vec.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,6 @@ impl<T> Index<usize> for Vec<T> {
12861286

12871287
#[stable(feature = "rust1", since = "1.0.0")]
12881288
impl<T> IndexMut<usize> for Vec<T> {
1289-
type Output = T;
1290-
12911289
#[inline]
12921290
fn index_mut(&mut self, index: &usize) -> &mut T {
12931291
// NB built-in indexing via `&mut [T]`
@@ -1331,31 +1329,27 @@ impl<T> ops::Index<ops::RangeFull> for Vec<T> {
13311329

13321330
#[stable(feature = "rust1", since = "1.0.0")]
13331331
impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
1334-
type Output = [T];
13351332
#[inline]
13361333
fn index_mut(&mut self, index: &ops::Range<usize>) -> &mut [T] {
13371334
IndexMut::index_mut(&mut **self, index)
13381335
}
13391336
}
13401337
#[stable(feature = "rust1", since = "1.0.0")]
13411338
impl<T> ops::IndexMut<ops::RangeTo<usize>> for Vec<T> {
1342-
type Output = [T];
13431339
#[inline]
13441340
fn index_mut(&mut self, index: &ops::RangeTo<usize>) -> &mut [T] {
13451341
IndexMut::index_mut(&mut **self, index)
13461342
}
13471343
}
13481344
#[stable(feature = "rust1", since = "1.0.0")]
13491345
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for Vec<T> {
1350-
type Output = [T];
13511346
#[inline]
13521347
fn index_mut(&mut self, index: &ops::RangeFrom<usize>) -> &mut [T] {
13531348
IndexMut::index_mut(&mut **self, index)
13541349
}
13551350
}
13561351
#[stable(feature = "rust1", since = "1.0.0")]
13571352
impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
1358-
type Output = [T];
13591353
#[inline]
13601354
fn index_mut(&mut self, _index: &ops::RangeFull) -> &mut [T] {
13611355
self.as_mut_slice()

branches/auto/src/libcollections/vec_map.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,6 @@ impl<V> Index<usize> for VecMap<V> {
712712

713713
#[stable(feature = "rust1", since = "1.0.0")]
714714
impl<V> IndexMut<usize> for VecMap<V> {
715-
type Output = V;
716-
717715
#[inline]
718716
fn index_mut<'a>(&'a mut self, i: &usize) -> &'a mut V {
719717
self.get_mut(i).expect("key not present")

branches/auto/src/libcore/ops.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -897,14 +897,14 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
897897
/// }
898898
/// ```
899899
#[lang="index"]
900-
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Index}`"]
900+
#[rustc_on_unimplemented = "the type `{Self}` cannot be indexed by `{Idx}`"]
901901
#[stable(feature = "rust1", since = "1.0.0")]
902-
pub trait Index<Index: ?Sized> {
902+
pub trait Index<Idx: ?Sized> {
903903
type Output: ?Sized;
904904

905905
/// The method for the indexing (`Foo[Bar]`) operation
906906
#[stable(feature = "rust1", since = "1.0.0")]
907-
fn index<'a>(&'a self, index: &Index) -> &'a Self::Output;
907+
fn index<'a>(&'a self, index: &Idx) -> &'a Self::Output;
908908
}
909909

910910
/// The `IndexMut` trait is used to specify the functionality of indexing
@@ -916,15 +916,21 @@ pub trait Index<Index: ?Sized> {
916916
/// calling `index_mut`, and therefore, `main` prints `Indexing!`.
917917
///
918918
/// ```
919-
/// use std::ops::IndexMut;
919+
/// use std::ops::{Index, IndexMut};
920920
///
921921
/// #[derive(Copy)]
922922
/// struct Foo;
923923
/// struct Bar;
924924
///
925-
/// impl IndexMut<Bar> for Foo {
925+
/// impl Index<Bar> for Foo {
926926
/// type Output = Foo;
927927
///
928+
/// fn index<'a>(&'a self, _index: &Bar) -> &'a Foo {
929+
/// self
930+
/// }
931+
/// }
932+
///
933+
/// impl IndexMut<Bar> for Foo {
928934
/// fn index_mut<'a>(&'a mut self, _index: &Bar) -> &'a mut Foo {
929935
/// println!("Indexing!");
930936
/// self
@@ -936,14 +942,12 @@ pub trait Index<Index: ?Sized> {
936942
/// }
937943
/// ```
938944
#[lang="index_mut"]
939-
#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Index}`"]
945+
#[rustc_on_unimplemented = "the type `{Self}` cannot be mutably indexed by `{Idx}`"]
940946
#[stable(feature = "rust1", since = "1.0.0")]
941-
pub trait IndexMut<Index: ?Sized> {
942-
type Output: ?Sized;
943-
947+
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
944948
/// The method for the indexing (`Foo[Bar]`) operation
945949
#[stable(feature = "rust1", since = "1.0.0")]
946-
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Self::Output;
950+
fn index_mut<'a>(&'a mut self, index: &Idx) -> &'a mut Self::Output;
947951
}
948952

949953
/// An unbounded range.

branches/auto/src/libcore/slice.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,6 @@ impl<T> ops::Index<uint> for [T] {
502502

503503
#[stable(feature = "rust1", since = "1.0.0")]
504504
impl<T> ops::IndexMut<uint> for [T] {
505-
type Output = T;
506-
507505
fn index_mut(&mut self, &index: &uint) -> &mut T {
508506
assert!(index < self.len());
509507

@@ -553,7 +551,6 @@ impl<T> ops::Index<RangeFull> for [T] {
553551

554552
#[stable(feature = "rust1", since = "1.0.0")]
555553
impl<T> ops::IndexMut<ops::Range<uint>> for [T] {
556-
type Output = [T];
557554
#[inline]
558555
fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
559556
assert!(index.start <= index.end);
@@ -568,15 +565,13 @@ impl<T> ops::IndexMut<ops::Range<uint>> for [T] {
568565
}
569566
#[stable(feature = "rust1", since = "1.0.0")]
570567
impl<T> ops::IndexMut<ops::RangeTo<uint>> for [T] {
571-
type Output = [T];
572568
#[inline]
573569
fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
574570
self.index_mut(&ops::Range{ start: 0, end: index.end })
575571
}
576572
}
577573
#[stable(feature = "rust1", since = "1.0.0")]
578574
impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] {
579-
type Output = [T];
580575
#[inline]
581576
fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
582577
let len = self.len();
@@ -585,7 +580,6 @@ impl<T> ops::IndexMut<ops::RangeFrom<uint>> for [T] {
585580
}
586581
#[stable(feature = "rust1", since = "1.0.0")]
587582
impl<T> ops::IndexMut<RangeFull> for [T] {
588-
type Output = [T];
589583
#[inline]
590584
fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
591585
self
@@ -865,31 +859,27 @@ impl<'a, T> ops::Index<RangeFull> for IterMut<'a, T> {
865859

866860
#[unstable(feature = "core")]
867861
impl<'a, T> ops::IndexMut<ops::Range<uint>> for IterMut<'a, T> {
868-
type Output = [T];
869862
#[inline]
870863
fn index_mut(&mut self, index: &ops::Range<uint>) -> &mut [T] {
871864
self.index_mut(&RangeFull).index_mut(index)
872865
}
873866
}
874867
#[unstable(feature = "core")]
875868
impl<'a, T> ops::IndexMut<ops::RangeTo<uint>> for IterMut<'a, T> {
876-
type Output = [T];
877869
#[inline]
878870
fn index_mut(&mut self, index: &ops::RangeTo<uint>) -> &mut [T] {
879871
self.index_mut(&RangeFull).index_mut(index)
880872
}
881873
}
882874
#[unstable(feature = "core")]
883875
impl<'a, T> ops::IndexMut<ops::RangeFrom<uint>> for IterMut<'a, T> {
884-
type Output = [T];
885876
#[inline]
886877
fn index_mut(&mut self, index: &ops::RangeFrom<uint>) -> &mut [T] {
887878
self.index_mut(&RangeFull).index_mut(index)
888879
}
889880
}
890881
#[unstable(feature = "core")]
891882
impl<'a, T> ops::IndexMut<RangeFull> for IterMut<'a, T> {
892-
type Output = [T];
893883
#[inline]
894884
fn index_mut(&mut self, _index: &RangeFull) -> &mut [T] {
895885
make_slice!(T => &mut [T]: self.ptr, self.end)

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ impl LintPass for UnusedAttributes {
699699

700700
if !attr::is_used(attr) {
701701
cx.span_lint(UNUSED_ATTRIBUTES, attr.span, "unused attribute");
702-
if CRATE_ATTRS.contains(&&attr.name()[]) {
702+
if CRATE_ATTRS.contains(&attr.name().get()) {
703703
let msg = match attr.node.style {
704704
ast::AttrOuter => "crate-level attribute should be an inner \
705705
attribute: add an exclamation mark: #![foo]",
@@ -801,10 +801,10 @@ impl LintPass for UnusedResults {
801801
None => {}
802802
Some(s) => {
803803
msg.push_str(": ");
804-
msg.push_str(&s);
804+
msg.push_str(s.get());
805805
}
806806
}
807-
cx.span_lint(UNUSED_MUST_USE, sp, &msg);
807+
cx.span_lint(UNUSED_MUST_USE, sp, &msg[]);
808808
return true;
809809
}
810810
}
@@ -826,8 +826,8 @@ impl NonCamelCaseTypes {
826826
fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
827827
fn is_camel_case(ident: ast::Ident) -> bool {
828828
let ident = token::get_ident(ident);
829-
if ident.is_empty() { return true; }
830-
let ident = ident.trim_matches('_');
829+
if ident.get().is_empty() { return true; }
830+
let ident = ident.get().trim_matches('_');
831831

832832
// start with a non-lowercase letter rather than non-uppercase
833833
// ones (some scripts don't have a concept of upper/lowercase)
@@ -844,7 +844,7 @@ impl NonCamelCaseTypes {
844844
let s = token::get_ident(ident);
845845

846846
if !is_camel_case(ident) {
847-
let c = to_camel_case(&s);
847+
let c = to_camel_case(s.get());
848848
let m = if c.is_empty() {
849849
format!("{} `{}` should have a camel case name such as `CamelCase`", sort, s)
850850
} else {
@@ -977,8 +977,8 @@ impl NonSnakeCase {
977977
fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
978978
fn is_snake_case(ident: ast::Ident) -> bool {
979979
let ident = token::get_ident(ident);
980-
if ident.is_empty() { return true; }
981-
let ident = ident.trim_left_matches('\'');
980+
if ident.get().is_empty() { return true; }
981+
let ident = ident.get().trim_left_matches('\'');
982982
let ident = ident.trim_matches('_');
983983

984984
let mut allow_underscore = true;
@@ -996,8 +996,8 @@ impl NonSnakeCase {
996996
let s = token::get_ident(ident);
997997

998998
if !is_snake_case(ident) {
999-
let sc = NonSnakeCase::to_snake_case(&s);
1000-
if sc != &s[] {
999+
let sc = NonSnakeCase::to_snake_case(s.get());
1000+
if sc != s.get() {
10011001
cx.span_lint(NON_SNAKE_CASE, span,
10021002
&*format!("{} `{}` should have a snake case name such as `{}`",
10031003
sort, s, sc));
@@ -1077,10 +1077,10 @@ impl NonUpperCaseGlobals {
10771077
fn check_upper_case(cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
10781078
let s = token::get_ident(ident);
10791079

1080-
if s.chars().any(|c| c.is_lowercase()) {
1081-
let uc: String = NonSnakeCase::to_snake_case(&s).chars()
1080+
if s.get().chars().any(|c| c.is_lowercase()) {
1081+
let uc: String = NonSnakeCase::to_snake_case(s.get()).chars()
10821082
.map(|c| c.to_uppercase()).collect();
1083-
if uc != &s[] {
1083+
if uc != s.get() {
10841084
cx.span_lint(NON_UPPER_CASE_GLOBALS, span,
10851085
&format!("{} `{}` should have an upper case name such as `{}`",
10861086
sort, s, uc));
@@ -1241,7 +1241,7 @@ impl LintPass for UnusedImportBraces {
12411241
match items[0].node {
12421242
ast::PathListIdent {ref name, ..} => {
12431243
let m = format!("braces around {} is unnecessary",
1244-
&token::get_ident(*name));
1244+
token::get_ident(*name).get());
12451245
cx.span_lint(UNUSED_IMPORT_BRACES, item.span,
12461246
&m[]);
12471247
},
@@ -1358,7 +1358,7 @@ impl UnusedMut {
13581358
pat_util::pat_bindings(&cx.tcx.def_map, &**p, |mode, id, _, path1| {
13591359
let ident = path1.node;
13601360
if let ast::BindByValue(ast::MutMutable) = mode {
1361-
if !token::get_ident(ident).starts_with("_") {
1361+
if !token::get_ident(ident).get().starts_with("_") {
13621362
match mutables.entry(ident.name.usize()) {
13631363
Vacant(entry) => { entry.insert(vec![id]); },
13641364
Occupied(mut entry) => { entry.get_mut().push(id); },

branches/auto/src/librustc/lint/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub fn gather_attrs(attrs: &[ast::Attribute])
341341
-> Vec<Result<(InternedString, Level, Span), Span>> {
342342
let mut out = vec!();
343343
for attr in attrs {
344-
let level = match Level::from_str(&attr.name()) {
344+
let level = match Level::from_str(attr.name().get()) {
345345
None => continue,
346346
Some(lvl) => lvl,
347347
};
@@ -499,10 +499,10 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
499499
continue;
500500
}
501501
Ok((lint_name, level, span)) => {
502-
match self.lints.find_lint(&lint_name, &self.tcx.sess, Some(span)) {
502+
match self.lints.find_lint(lint_name.get(), &self.tcx.sess, Some(span)) {
503503
Some(lint_id) => vec![(lint_id, level, span)],
504504
None => {
505-
match self.lints.lint_groups.get(&lint_name[]) {
505+
match self.lints.lint_groups.get(lint_name.get()) {
506506
Some(&(ref v, _)) => v.iter()
507507
.map(|lint_id: &LintId|
508508
(*lint_id, level, span))

branches/auto/src/librustc/metadata/creader.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a> CrateReader<'a> {
170170
fn process_crate(&self, c: &ast::Crate) {
171171
for a in c.attrs.iter().filter(|m| m.name() == "link_args") {
172172
match a.value_str() {
173-
Some(ref linkarg) => self.sess.cstore.add_used_link_args(&linkarg),
173+
Some(ref linkarg) => self.sess.cstore.add_used_link_args(linkarg.get()),
174174
None => { /* fallthrough */ }
175175
}
176176
}
@@ -184,15 +184,15 @@ impl<'a> CrateReader<'a> {
184184
ident, path_opt);
185185
let name = match *path_opt {
186186
Some((ref path_str, _)) => {
187-
let name = path_str.to_string();
187+
let name = path_str.get().to_string();
188188
validate_crate_name(Some(self.sess), &name[],
189189
Some(i.span));
190190
name
191191
}
192-
None => ident.to_string(),
192+
None => ident.get().to_string(),
193193
};
194194
Some(CrateInfo {
195-
ident: ident.to_string(),
195+
ident: ident.get().to_string(),
196196
name: name,
197197
id: i.id,
198198
should_link: should_link(i),
@@ -237,7 +237,7 @@ impl<'a> CrateReader<'a> {
237237
.collect::<Vec<&ast::Attribute>>();
238238
for m in &link_args {
239239
match m.value_str() {
240-
Some(linkarg) => self.sess.cstore.add_used_link_args(&linkarg),
240+
Some(linkarg) => self.sess.cstore.add_used_link_args(linkarg.get()),
241241
None => { /* fallthrough */ }
242242
}
243243
}
@@ -289,7 +289,7 @@ impl<'a> CrateReader<'a> {
289289
}
290290
};
291291
register_native_lib(self.sess, Some(m.span),
292-
n.to_string(), kind);
292+
n.get().to_string(), kind);
293293
}
294294
None => {}
295295
}

branches/auto/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ pub fn is_staged_api(cstore: &cstore::CStore, def: ast::DefId) -> bool {
383383
let cdata = cstore.get_crate_data(def.krate);
384384
let attrs = decoder::get_crate_attributes(cdata.data());
385385
for attr in &attrs {
386-
if &attr.name()[] == "staged_api" {
386+
if attr.name().get() == "staged_api" {
387387
match attr.node.value.node { ast::MetaWord(_) => return true, _ => (/*pass*/) }
388388
}
389389
}

0 commit comments

Comments
 (0)