Skip to content

Commit 351a674

Browse files
committed
---
yaml --- r: 272729 b: refs/heads/beta c: cf01fb6 h: refs/heads/master i: 272727: 4ee644d
1 parent c0528f6 commit 351a674

Some content is hidden

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

63 files changed

+635
-703
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 25e42ac10653e4d7178e36201608cc269e3c66c7
26+
refs/heads/beta: cf01fb68368ec985ffd3bf00e8e885780576da25
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/book/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [Comments](comments.md)
1010
* [if](if.md)
1111
* [Loops](loops.md)
12+
* [Vectors](vectors.md)
1213
* [Ownership](ownership.md)
1314
* [References and Borrowing](references-and-borrowing.md)
1415
* [Lifetimes](lifetimes.md)
@@ -18,7 +19,6 @@
1819
* [Match](match.md)
1920
* [Patterns](patterns.md)
2021
* [Method Syntax](method-syntax.md)
21-
* [Vectors](vectors.md)
2222
* [Strings](strings.md)
2323
* [Generics](generics.md)
2424
* [Traits](traits.md)

branches/beta/src/libcollectionstest/str.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,19 +1508,6 @@ generate_iterator_test! {
15081508
with str::rsplitn;
15091509
}
15101510

1511-
#[test]
1512-
fn different_str_pattern_forwarding_lifetimes() {
1513-
use std::str::pattern::Pattern;
1514-
1515-
fn foo<'a, P>(p: P) where for<'b> &'b P: Pattern<'a> {
1516-
for _ in 0..3 {
1517-
"asdf".find(&p);
1518-
}
1519-
}
1520-
1521-
foo::<&str>("x");
1522-
}
1523-
15241511
mod bench {
15251512
use test::{Bencher, black_box};
15261513

branches/beta/src/libcore/cell.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ impl<T:Copy> Cell<T> {
241241
#[stable(feature = "rust1", since = "1.0.0")]
242242
unsafe impl<T> Send for Cell<T> where T: Send {}
243243

244-
#[stable(feature = "rust1", since = "1.0.0")]
245-
impl<T> !Sync for Cell<T> {}
246-
247244
#[stable(feature = "rust1", since = "1.0.0")]
248245
impl<T:Copy> Clone for Cell<T> {
249246
#[inline]
@@ -464,9 +461,6 @@ impl<T: ?Sized> RefCell<T> {
464461
#[stable(feature = "rust1", since = "1.0.0")]
465462
unsafe impl<T: ?Sized> Send for RefCell<T> where T: Send {}
466463

467-
#[stable(feature = "rust1", since = "1.0.0")]
468-
impl<T: ?Sized> !Sync for RefCell<T> {}
469-
470464
#[stable(feature = "rust1", since = "1.0.0")]
471465
impl<T: Clone> Clone for RefCell<T> {
472466
#[inline]

branches/beta/src/libcore/slice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ impl<T> SliceExt for [T] {
285285

286286
#[inline]
287287
unsafe fn get_unchecked(&self, index: usize) -> &T {
288-
&*(self.as_ptr().offset(index as isize))
288+
&*(self.repr().data.offset(index as isize))
289289
}
290290

291291
#[inline]
292292
fn as_ptr(&self) -> *const T {
293-
self as *const [T] as *const T
293+
self.repr().data
294294
}
295295

296296
fn binary_search_by<F>(&self, mut f: F) -> Result<usize, usize> where
@@ -448,12 +448,12 @@ impl<T> SliceExt for [T] {
448448

449449
#[inline]
450450
unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T {
451-
&mut *self.as_mut_ptr().offset(index as isize)
451+
&mut *(self.repr().data as *mut T).offset(index as isize)
452452
}
453453

454454
#[inline]
455455
fn as_mut_ptr(&mut self) -> *mut T {
456-
self as *mut [T] as *mut T
456+
self.repr().data as *mut T
457457
}
458458

459459
#[inline]

branches/beta/src/libcore/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1894,7 +1894,7 @@ impl StrExt for str {
18941894

18951895
#[inline]
18961896
fn as_ptr(&self) -> *const u8 {
1897-
self as *const str as *const u8
1897+
self.repr().data
18981898
}
18991899

19001900
#[inline]

branches/beta/src/libcore/str/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ impl<'a, F> Pattern<'a> for F where F: FnMut(char) -> bool {
492492
/////////////////////////////////////////////////////////////////////////////
493493

494494
/// Delegates to the `&str` impl.
495-
impl<'a, 'b, 'c> Pattern<'a> for &'c &'b str {
495+
impl<'a, 'b> Pattern<'a> for &'b &'b str {
496496
pattern_methods!(StrSearcher<'a, 'b>, |&s| s, |s| s);
497497
}
498498

branches/beta/src/librustc/dep_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &ty::ctxt<'tcx>,
198198
fn visit_item(&mut self, i: &'tcx hir::Item) {
199199
let item_def_id = self.tcx.map.local_def_id(i.id);
200200
let task_id = (self.dep_node_fn)(item_def_id);
201+
debug!("About to start task {:?}", task_id);
201202
let _task = self.tcx.dep_graph.in_task(task_id);
202-
debug!("Started task {:?}", task_id);
203203
self.tcx.dep_graph.read(DepNode::Hir(item_def_id));
204204
self.visitor.visit_item(i)
205205
}

branches/beta/src/librustc/front/map/collector.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
150150
for field in v.node.data.fields() {
151151
self.create_def_with_parent(
152152
Some(variant_def_index),
153-
field.id,
154-
DefPathData::Field(field.name));
153+
field.node.id,
154+
DefPathData::Field(field.node.kind));
155155
}
156156
}
157157
}
@@ -166,7 +166,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
166166
}
167167

168168
for field in struct_def.fields() {
169-
self.create_def(field.id, DefPathData::Field(field.name));
169+
self.create_def(field.node.id, DefPathData::Field(field.node.kind));
170170
}
171171
}
172172
ItemTrait(_, _, ref bounds, _) => {

branches/beta/src/librustc/front/map/definitions.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use middle::cstore::LOCAL_CRATE;
1212
use middle::def_id::{DefId, DefIndex};
1313
use rustc_data_structures::fnv::FnvHashMap;
14+
use rustc_front::hir;
1415
use syntax::ast;
1516
use syntax::parse::token::InternedString;
1617
use util::nodemap::NodeMap;
@@ -83,7 +84,8 @@ pub enum DefPathData {
8384
TypeParam(ast::Name),
8485
LifetimeDef(ast::Name),
8586
EnumVariant(ast::Name),
86-
Field(ast::Name),
87+
PositionalField,
88+
Field(hir::StructFieldKind),
8789
StructCtor, // implicit ctor for a tuple-like struct
8890
Initializer, // initializer for a const
8991
Binding(ast::Name), // pattern binding
@@ -184,11 +186,19 @@ impl DefPathData {
184186
LifetimeDef(name) |
185187
EnumVariant(name) |
186188
DetachedCrate(name) |
187-
Binding(name) |
188-
Field(name) => {
189+
Binding(name) => {
189190
name.as_str()
190191
}
191192

193+
Field(hir::StructFieldKind::NamedField(name, _)) => {
194+
name.as_str()
195+
}
196+
197+
PositionalField |
198+
Field(hir::StructFieldKind::UnnamedField(_)) => {
199+
InternedString::new("{{field}}")
200+
}
201+
192202
// note that this does not show up in user printouts
193203
CrateRoot => {
194204
InternedString::new("{{root}}")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
811811
}
812812

813813
fn visit_struct_field(&mut self, s: &hir::StructField) {
814-
self.with_lint_attrs(&s.attrs, |cx| {
814+
self.with_lint_attrs(&s.node.attrs, |cx| {
815815
run_lints!(cx, check_struct_field, late_passes, s);
816816
hir_visit::walk_struct_field(cx, s);
817817
})

branches/beta/src/librustc/middle/dead.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,12 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
221221
let has_extern_repr = self.struct_has_extern_repr;
222222
let inherited_pub_visibility = self.inherited_pub_visibility;
223223
let live_fields = def.fields().iter().filter(|f| {
224-
has_extern_repr || inherited_pub_visibility || f.vis == hir::Public
224+
has_extern_repr || inherited_pub_visibility || match f.node.kind {
225+
hir::NamedField(_, hir::Public) => true,
226+
_ => false
227+
}
225228
});
226-
self.live_symbols.extend(live_fields.map(|f| f.id));
229+
self.live_symbols.extend(live_fields.map(|f| f.node.id));
227230

228231
intravisit::walk_struct_def(self, def);
229232
}
@@ -428,16 +431,17 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> {
428431
should_warn && !self.symbol_is_live(item.id, ctor_id)
429432
}
430433

431-
fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool {
432-
let field_type = self.tcx.node_id_to_type(field.id);
434+
fn should_warn_about_field(&mut self, node: &hir::StructField_) -> bool {
435+
let is_named = node.name().is_some();
436+
let field_type = self.tcx.node_id_to_type(node.id);
433437
let is_marker_field = match field_type.ty_to_def_id() {
434438
Some(def_id) => self.tcx.lang_items.items().iter().any(|item| *item == Some(def_id)),
435439
_ => false
436440
};
437-
!field.is_positional()
438-
&& !self.symbol_is_live(field.id, None)
441+
is_named
442+
&& !self.symbol_is_live(node.id, None)
439443
&& !is_marker_field
440-
&& !has_allow_dead_code_or_lang_attr(&field.attrs)
444+
&& !has_allow_dead_code_or_lang_attr(&node.attrs)
441445
}
442446

443447
fn should_warn_about_variant(&mut self, variant: &hir::Variant_) -> bool {
@@ -543,9 +547,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> {
543547
}
544548

545549
fn visit_struct_field(&mut self, field: &hir::StructField) {
546-
if self.should_warn_about_field(&field) {
547-
self.warn_dead_code(field.id, field.span,
548-
field.name, "struct field");
550+
if self.should_warn_about_field(&field.node) {
551+
self.warn_dead_code(field.node.id, field.span,
552+
field.node.name().unwrap(), "struct field");
549553
}
550554

551555
intravisit::walk_struct_field(self, field);

branches/beta/src/librustc/middle/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Annotator<'a, 'tcx> {
259259
}
260260

261261
fn visit_struct_field(&mut self, s: &StructField) {
262-
self.annotate(s.id, &s.attrs, s.span, AnnotationKind::Required, |v| {
262+
self.annotate(s.node.id, &s.node.attrs, s.span, AnnotationKind::Required, |v| {
263263
intravisit::walk_struct_field(v, s);
264264
});
265265
}

branches/beta/src/librustc/middle/ty/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,8 @@ pub struct FieldDefData<'tcx, 'container: 'tcx> {
13711371
/// The field's DefId. NOTE: the fields of tuple-like enum variants
13721372
/// are not real items, and don't have entries in tcache etc.
13731373
pub did: DefId,
1374+
/// special_idents::unnamed_field.name
1375+
/// if this is a tuple-like field
13741376
pub name: Name,
13751377
pub vis: hir::Visibility,
13761378
/// TyIVar is used here to allow for variance (see the doc at

branches/beta/src/librustc_front/fold.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,15 @@ pub fn noop_fold_poly_trait_ref<T: Folder>(p: PolyTraitRef, fld: &mut T) -> Poly
700700
}
701701

702702
pub fn noop_fold_struct_field<T: Folder>(f: StructField, fld: &mut T) -> StructField {
703-
StructField {
704-
span: fld.new_span(f.span),
705-
id: fld.new_id(f.id),
706-
name: f.name,
707-
vis: f.vis,
708-
ty: fld.fold_ty(f.ty),
709-
attrs: fold_attrs(f.attrs, fld),
703+
let StructField {node: StructField_ {id, kind, ty, attrs}, span} = f;
704+
Spanned {
705+
node: StructField_ {
706+
id: fld.new_id(id),
707+
kind: kind,
708+
ty: fld.fold_ty(ty),
709+
attrs: fold_attrs(attrs, fld),
710+
},
711+
span: fld.new_span(span),
710712
}
711713
}
712714

branches/beta/src/librustc_front/hir.rs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub use self::Mutability::*;
2424
pub use self::PathListItem_::*;
2525
pub use self::PrimTy::*;
2626
pub use self::Stmt_::*;
27+
pub use self::StructFieldKind::*;
2728
pub use self::TraitItem_::*;
2829
pub use self::Ty_::*;
2930
pub use self::TyParamBound::*;
@@ -1241,20 +1242,43 @@ impl Visibility {
12411242
}
12421243

12431244
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
1244-
pub struct StructField {
1245-
pub span: Span,
1246-
pub name: Name,
1247-
pub vis: Visibility,
1245+
pub struct StructField_ {
1246+
pub kind: StructFieldKind,
12481247
pub id: NodeId,
12491248
pub ty: P<Ty>,
12501249
pub attrs: HirVec<Attribute>,
12511250
}
12521251

1253-
impl StructField {
1254-
// Still necessary in couple of places
1255-
pub fn is_positional(&self) -> bool {
1256-
let first = self.name.as_str().as_bytes()[0];
1257-
first >= b'0' && first <= b'9'
1252+
impl StructField_ {
1253+
pub fn name(&self) -> Option<Name> {
1254+
match self.kind {
1255+
NamedField(name, _) => Some(name),
1256+
UnnamedField(_) => None,
1257+
}
1258+
}
1259+
}
1260+
1261+
pub type StructField = Spanned<StructField_>;
1262+
1263+
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
1264+
pub enum StructFieldKind {
1265+
NamedField(Name, Visibility),
1266+
/// Element of a tuple-like struct
1267+
UnnamedField(Visibility),
1268+
}
1269+
1270+
impl StructFieldKind {
1271+
pub fn is_unnamed(&self) -> bool {
1272+
match *self {
1273+
UnnamedField(..) => true,
1274+
NamedField(..) => false,
1275+
}
1276+
}
1277+
1278+
pub fn visibility(&self) -> Visibility {
1279+
match *self {
1280+
NamedField(_, vis) | UnnamedField(vis) => vis,
1281+
}
12581282
}
12591283
}
12601284

branches/beta/src/librustc_front/intravisit.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,9 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, struct_definition: &
669669
}
670670

671671
pub fn walk_struct_field<'v, V: Visitor<'v>>(visitor: &mut V, struct_field: &'v StructField) {
672-
visitor.visit_name(struct_field.span, struct_field.name);
673-
visitor.visit_ty(&struct_field.ty);
674-
walk_list!(visitor, visit_attribute, &struct_field.attrs);
672+
walk_opt_name(visitor, struct_field.span, struct_field.node.name());
673+
visitor.visit_ty(&struct_field.node.ty);
674+
walk_list!(visitor, visit_attribute, &struct_field.node.attrs);
675675
}
676676

677677
pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block) {

0 commit comments

Comments
 (0)