Skip to content

Commit bf8fcb8

Browse files
committed
---
yaml --- r: 232223 b: refs/heads/auto c: f07f4ef h: refs/heads/master i: 232221: e2770a7 232219: 2ed9103 232215: fa65fe3 232207: f8db1cc 232191: 6e95bd3 v: v3
1 parent 6d5ce46 commit bf8fcb8

File tree

28 files changed

+236
-86
lines changed

28 files changed

+236
-86
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 9a2402566102dd54c66f55a62da93e1c7d93f761
11+
refs/heads/auto: f07f4ef74366f70554cb0f2cef590e76bfd55791
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/liballoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
#![cfg_attr(stage0, feature(alloc_system))]
101101
#![cfg_attr(not(stage0), feature(needs_allocator))]
102102

103-
#![cfg_attr(test, feature(test, rustc_private))]
103+
#![cfg_attr(test, feature(test, rustc_private, box_heap))]
104104

105105
#[cfg(stage0)]
106106
extern crate alloc_system;

branches/auto/src/libcollections/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
#![feature(core_intrinsics)]
3939
#![feature(core_slice_ext)]
4040
#![feature(core_str_ext)]
41+
#![feature(fmt_internals)]
42+
#![feature(fmt_radix)]
4143
#![feature(heap_api)]
4244
#![feature(iter_order)]
4345
#![feature(iter_arith)]
@@ -47,6 +49,8 @@
4749
#![feature(oom)]
4850
#![feature(pattern)]
4951
#![feature(ptr_as_ref)]
52+
#![feature(ref_slice)]
53+
#![feature(slice_bytes)]
5054
#![feature(slice_patterns)]
5155
#![feature(staged_api)]
5256
#![feature(step_by)]

branches/auto/src/libcollections/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use slice::SliceConcatExt;
3838
use boxed::Box;
3939

4040
pub use core::str::{FromStr, Utf8Error};
41+
#[allow(deprecated)]
4142
pub use core::str::{Lines, LinesAny, CharRange};
4243
pub use core::str::{Split, RSplit};
4344
pub use core::str::{SplitN, RSplitN};

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,11 @@ impl<'a, 'tcx, 'v> hir_visit::Visitor<'v> for LateContext<'a, 'tcx> {
767767
hir_visit::walk_path(self, p);
768768
}
769769

770+
fn visit_path_list_item(&mut self, prefix: &hir::Path, item: &hir::PathListItem) {
771+
run_lints!(self, check_path_list_item, late_passes, item);
772+
hir_visit::walk_path_list_item(self, prefix, item);
773+
}
774+
770775
fn visit_attribute(&mut self, attr: &ast::Attribute) {
771776
run_lints!(self, check_attribute, late_passes, attr);
772777
}
@@ -915,6 +920,11 @@ impl<'a, 'v> ast_visit::Visitor<'v> for EarlyContext<'a> {
915920
ast_visit::walk_path(self, p);
916921
}
917922

923+
fn visit_path_list_item(&mut self, prefix: &ast::Path, item: &ast::PathListItem) {
924+
run_lints!(self, check_path_list_item, early_passes, item);
925+
ast_visit::walk_path_list_item(self, prefix, item);
926+
}
927+
918928
fn visit_attribute(&mut self, attr: &ast::Attribute) {
919929
run_lints!(self, check_attribute, early_passes, attr);
920930
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ pub trait LateLintPass: LintPass {
161161
fn check_lifetime_def(&mut self, _: &LateContext, _: &hir::LifetimeDef) { }
162162
fn check_explicit_self(&mut self, _: &LateContext, _: &hir::ExplicitSelf) { }
163163
fn check_path(&mut self, _: &LateContext, _: &hir::Path, _: ast::NodeId) { }
164+
fn check_path_list_item(&mut self, _: &LateContext, _: &hir::PathListItem) { }
164165
fn check_attribute(&mut self, _: &LateContext, _: &ast::Attribute) { }
165166

166167
/// Called when entering a syntax node that can have lint attributes such
@@ -206,6 +207,7 @@ pub trait EarlyLintPass: LintPass {
206207
fn check_lifetime_def(&mut self, _: &EarlyContext, _: &ast::LifetimeDef) { }
207208
fn check_explicit_self(&mut self, _: &EarlyContext, _: &ast::ExplicitSelf) { }
208209
fn check_path(&mut self, _: &EarlyContext, _: &ast::Path, _: ast::NodeId) { }
210+
fn check_path_list_item(&mut self, _: &EarlyContext, _: &ast::PathListItem) { }
209211
fn check_attribute(&mut self, _: &EarlyContext, _: &ast::Attribute) { }
210212

211213
/// Called when entering a syntax node that can have lint attributes such

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MarkSymbolVisitor<'a, 'tcx> {
279279
visit::walk_path(self, path);
280280
}
281281

282+
fn visit_path_list_item(&mut self, path: &hir::Path, item: &hir::PathListItem) {
283+
self.lookup_and_handle_definition(&item.node.id());
284+
visit::walk_path_list_item(self, path, item);
285+
}
286+
282287
fn visit_item(&mut self, _: &hir::Item) {
283288
// Do not recurse into items. These items will be added to the
284289
// worklist and recursed into manually if necessary.

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
355355
visit::walk_path(self, path)
356356
}
357357

358+
fn visit_path_list_item(&mut self, prefix: &hir::Path, item: &hir::PathListItem) {
359+
check_path_list_item(self.tcx, item,
360+
&mut |id, sp, stab| self.check(id, sp, stab));
361+
visit::walk_path_list_item(self, prefix, item)
362+
}
363+
358364
fn visit_pat(&mut self, pat: &hir::Pat) {
359365
check_pat(self.tcx, pat,
360366
&mut |id, sp, stab| self.check(id, sp, stab));
@@ -470,7 +476,17 @@ pub fn check_path(tcx: &ty::ctxt, path: &hir::Path, id: ast::NodeId,
470476
}
471477
None => {}
472478
}
479+
}
473480

481+
pub fn check_path_list_item(tcx: &ty::ctxt, item: &hir::PathListItem,
482+
cb: &mut FnMut(DefId, Span, &Option<&Stability>)) {
483+
match tcx.def_map.borrow().get(&item.node.id()).map(|d| d.full_def()) {
484+
Some(def::DefPrimTy(..)) => {}
485+
Some(def) => {
486+
maybe_do_stability_check(tcx, def.def_id(), item.span, cb);
487+
}
488+
None => {}
489+
}
474490
}
475491

476492
pub fn check_pat(tcx: &ty::ctxt, pat: &hir::Pat,

branches/auto/src/librustc_back/svh.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,10 @@ mod svh_visitor {
423423
SawPath.hash(self.st); visit::walk_path(self, path)
424424
}
425425

426+
fn visit_path_list_item(&mut self, prefix: &Path, item: &'v PathListItem) {
427+
SawPath.hash(self.st); visit::walk_path_list_item(self, prefix, item)
428+
}
429+
426430
fn visit_block(&mut self, b: &Block) {
427431
SawBlock.hash(self.st); visit::walk_block(self, b)
428432
}

branches/auto/src/librustc_front/hir.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// The Rust HIR.
1212

13-
pub use self::AsmDialect::*;
1413
pub use self::BindingMode::*;
1514
pub use self::BinOp_::*;
1615
pub use self::BlockCheckMode::*;
@@ -41,7 +40,7 @@ pub use self::PathParameters::*;
4140

4241
use syntax::codemap::{self, Span, Spanned, DUMMY_SP, ExpnId};
4342
use syntax::abi::Abi;
44-
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree};
43+
use syntax::ast::{Name, Ident, NodeId, DUMMY_NODE_ID, TokenTree, AsmDialect};
4544
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, CrateConfig};
4645
use syntax::owned_slice::OwnedSlice;
4746
use syntax::parse::token::InternedString;
@@ -876,12 +875,6 @@ pub enum Ty_ {
876875
TyInfer,
877876
}
878877

879-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
880-
pub enum AsmDialect {
881-
AsmAtt,
882-
AsmIntel
883-
}
884-
885878
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
886879
pub struct InlineAsm {
887880
pub asm: InternedString,

branches/auto/src/librustc_front/lowering.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ pub fn lower_expr(e: &Expr) -> P<hir::Expr> {
801801
clobbers: clobbers.clone(),
802802
volatile: volatile,
803803
alignstack: alignstack,
804-
dialect: lower_asm_dialect(dialect),
804+
dialect: dialect,
805805
expn_id: expn_id,
806806
}),
807807
ExprStruct(ref path, ref fields, ref maybe_expr) => {
@@ -863,13 +863,6 @@ pub fn lower_capture_clause(c: CaptureClause) -> hir::CaptureClause {
863863
}
864864
}
865865

866-
pub fn lower_asm_dialect(a: AsmDialect) -> hir::AsmDialect {
867-
match a {
868-
AsmAtt => hir::AsmAtt,
869-
AsmIntel => hir::AsmIntel,
870-
}
871-
}
872-
873866
pub fn lower_visibility(v: Visibility) -> hir::Visibility {
874867
match v {
875868
Public => hir::Public,

branches/auto/src/librustc_front/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ impl<'a> State<'a> {
15391539
if a.alignstack {
15401540
options.push("alignstack");
15411541
}
1542-
if a.dialect == hir::AsmDialect::AsmIntel {
1542+
if a.dialect == ast::AsmDialect::Intel {
15431543
options.push("intel");
15441544
}
15451545

branches/auto/src/librustc_front/visit.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ pub trait Visitor<'v> : Sized {
121121
fn visit_path(&mut self, path: &'v Path, _id: NodeId) {
122122
walk_path(self, path)
123123
}
124+
fn visit_path_list_item(&mut self, prefix: &'v Path, item: &'v PathListItem) {
125+
walk_path_list_item(self, prefix, item)
126+
}
124127
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment) {
125128
walk_path_segment(self, path_span, path_segment)
126129
}
@@ -203,26 +206,20 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
203206
ItemExternCrate(..) => {}
204207
ItemUse(ref vp) => {
205208
match vp.node {
206-
ViewPathSimple(ident, ref path) => {
207-
visitor.visit_ident(vp.span, ident);
209+
ViewPathSimple(_ident, ref path) => {
208210
visitor.visit_path(path, item.id);
209211
}
210212
ViewPathGlob(ref path) => {
211213
visitor.visit_path(path, item.id);
212214
}
213215
ViewPathList(ref prefix, ref list) => {
214-
for id in list {
215-
match id.node {
216-
PathListIdent { name, .. } => {
217-
visitor.visit_ident(id.span, name);
218-
}
219-
PathListMod { .. } => ()
216+
if !list.is_empty() {
217+
for item in list {
218+
visitor.visit_path_list_item(prefix, item)
220219
}
220+
} else {
221+
visitor.visit_path(prefix, item.id);
221222
}
222-
223-
// Note that the `prefix` here is not a complete
224-
// path, so we don't use `visit_path`.
225-
walk_path(visitor, prefix);
226223
}
227224
}
228225
}
@@ -400,6 +397,17 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
400397
}
401398
}
402399

400+
pub fn walk_path_list_item<'v, V: Visitor<'v>>(visitor: &mut V, prefix: &'v Path,
401+
item: &'v PathListItem) {
402+
for segment in &prefix.segments {
403+
visitor.visit_path_segment(prefix.span, segment);
404+
}
405+
406+
if let PathListIdent { name, .. } = item.node {
407+
visitor.visit_ident(item.span, name);
408+
}
409+
}
410+
403411
pub fn walk_path_segment<'v, V: Visitor<'v>>(visitor: &mut V,
404412
path_span: Span,
405413
segment: &'v PathSegment) {

branches/auto/src/librustc_lint/builtin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,13 @@ impl LateLintPass for Stability {
13861386
&stab.map(|s| hir_to_ast_stability(s)).as_ref()));
13871387
}
13881388

1389+
fn check_path_list_item(&mut self, cx: &LateContext, item: &hir::PathListItem) {
1390+
stability::check_path_list_item(cx.tcx, item,
1391+
&mut |id, sp, stab|
1392+
self.lint(cx, id, sp,
1393+
&stab.map(|s| hir_to_ast_stability(s)).as_ref()));
1394+
}
1395+
13891396
fn check_pat(&mut self, cx: &LateContext, pat: &hir::Pat) {
13901397
stability::check_pat(cx.tcx, pat,
13911398
&mut |id, sp, stab|

branches/auto/src/librustc_privacy/lib.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -859,23 +859,6 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
859859

860860
impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
861861
fn visit_item(&mut self, item: &hir::Item) {
862-
if let hir::ItemUse(ref vpath) = item.node {
863-
if let hir::ViewPathList(ref prefix, ref list) = vpath.node {
864-
for pid in list {
865-
match pid.node {
866-
hir::PathListIdent { id, name, .. } => {
867-
debug!("privacy - ident item {}", id);
868-
self.check_path(pid.span, id, name.name);
869-
}
870-
hir::PathListMod { id, .. } => {
871-
debug!("privacy - mod item {}", id);
872-
let name = prefix.segments.last().unwrap().identifier.name;
873-
self.check_path(pid.span, id, name);
874-
}
875-
}
876-
}
877-
}
878-
}
879862
let orig_curitem = replace(&mut self.curitem, item.id);
880863
visit::walk_item(self, item);
881864
self.curitem = orig_curitem;
@@ -997,8 +980,22 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
997980
}
998981

999982
fn visit_path(&mut self, path: &hir::Path, id: ast::NodeId) {
1000-
self.check_path(path.span, id, path.segments.last().unwrap().identifier.name);
1001-
visit::walk_path(self, path);
983+
if !path.segments.is_empty() {
984+
self.check_path(path.span, id, path.segments.last().unwrap().identifier.name);
985+
visit::walk_path(self, path);
986+
}
987+
}
988+
989+
fn visit_path_list_item(&mut self, prefix: &hir::Path, item: &hir::PathListItem) {
990+
let name = if let hir::PathListIdent { name, .. } = item.node {
991+
name.name
992+
} else if !prefix.segments.is_empty() {
993+
prefix.segments.last().unwrap().identifier.name
994+
} else {
995+
self.tcx.sess.bug("`self` import in an import list with empty prefix");
996+
};
997+
self.check_path(item.span, item.node.id(), name);
998+
visit::walk_path_list_item(self, prefix, item);
1002999
}
10031000
}
10041001

branches/auto/src/librustc_resolve/lib.rs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,23 +2210,39 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
22102210

22112211
ItemUse(ref view_path) => {
22122212
// check for imports shadowing primitive types
2213-
let check_rename = |id, ident: Ident| {
2214-
match self.def_map.borrow().get(&id).map(|d| d.full_def()) {
2213+
let check_rename = |this: &Self, id, ident: Ident| {
2214+
match this.def_map.borrow().get(&id).map(|d| d.full_def()) {
22152215
Some(DefTy(..)) | Some(DefStruct(..)) | Some(DefTrait(..)) | None => {
2216-
self.check_if_primitive_type_name(ident.name, item.span);
2216+
this.check_if_primitive_type_name(ident.name, item.span);
22172217
}
22182218
_ => {}
22192219
}
22202220
};
22212221

22222222
match view_path.node {
22232223
hir::ViewPathSimple(ident, _) => {
2224-
check_rename(item.id, ident);
2224+
check_rename(self, item.id, ident);
22252225
}
2226-
hir::ViewPathList(_, ref items) => {
2226+
hir::ViewPathList(ref prefix, ref items) => {
22272227
for item in items {
22282228
if let Some(ident) = item.node.rename() {
2229-
check_rename(item.node.id(), ident);
2229+
check_rename(self, item.node.id(), ident);
2230+
}
2231+
}
2232+
2233+
// Resolve prefix of an import with empty braces (issue #28388)
2234+
if items.is_empty() && !prefix.segments.is_empty() {
2235+
match self.resolve_crate_relative_path(prefix.span,
2236+
&prefix.segments,
2237+
TypeNS) {
2238+
Some((def, lp)) => self.record_def(item.id,
2239+
PathResolution::new(def, lp, 0)),
2240+
None => {
2241+
resolve_error(self,
2242+
prefix.span,
2243+
ResolutionError::FailedToResolve(
2244+
&path_names_to_string(prefix, 0)));
2245+
}
22302246
}
22312247
}
22322248
}

0 commit comments

Comments
 (0)