Skip to content

Commit 7c81496

Browse files
committed
fix errors caused by cherry picking
1 parent 4b3b4d2 commit 7c81496

File tree

6 files changed

+21
-29
lines changed

6 files changed

+21
-29
lines changed

Diff for: src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3095,7 +3095,7 @@ impl<'a> LoweringContext<'a> {
30953095
// the stability of `use a::{};`, to avoid it showing up as
30963096
// a re-export by accident when `pub`, e.g. in documentation.
30973097
let def = self.expect_full_def_from_use(id).next().unwrap_or(Def::Err);
3098-
let path = P(self.lower_path_extra(def, &prefix, None, ParamMode::Explicit, None));
3098+
let path = P(self.lower_path_extra(def, &prefix, None, ParamMode::Explicit));
30993099
*vis = respan(prefix.span.shrink_to_lo(), hir::VisibilityKind::Inherited);
31003100
hir::ItemKind::Use(path, hir::UseKind::ListStem)
31013101
}

Diff for: src/librustc_resolve/build_reduced_graph.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
250250
uniform_paths_canary_emitted = true;
251251
}
252252

253-
let empty_for_self = |prefix: &[Segment]| {
253+
let empty_for_self = |prefix: &[Ident]| {
254254
prefix.is_empty() ||
255-
prefix.len() == 1 && prefix[0].ident.name == keywords::CrateRoot.name()
255+
prefix.len() == 1 && prefix[0].name == keywords::CrateRoot.name()
256256
};
257257
match use_tree.kind {
258258
ast::UseTreeKind::Simple(rename, ..) => {
@@ -400,7 +400,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
400400
// `a::b::c::{self as _}`, so that their prefixes are correctly
401401
// resolved and checked for privacy/stability/etc.
402402
if items.is_empty() && !empty_for_self(&prefix) {
403-
let new_span = prefix[prefix.len() - 1].ident.span;
403+
let new_span = prefix[prefix.len() - 1].span;
404404
let tree = ast::UseTree {
405405
prefix: ast::Path::from_ident(
406406
Ident::new(keywords::SelfValue.name(), new_span)

Diff for: src/librustc_resolve/error_reporting.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
2424
pub(crate) fn make_path_suggestion(
2525
&mut self,
2626
span: Span,
27-
path: Vec<Ident>
27+
path: Vec<Ident>,
2828
parent_scope: &ParentScope<'b>,
2929
) -> Option<(Vec<Ident>, Option<String>)> {
3030
debug!("make_path_suggestion: span={:?} path={:?}", span, path);
@@ -63,11 +63,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
6363
fn make_missing_self_suggestion(
6464
&mut self,
6565
span: Span,
66-
mut path: Vec<Ident>
66+
mut path: Vec<Ident>,
6767
parent_scope: &ParentScope<'b>,
6868
) -> Option<(Vec<Ident>, Option<String>)> {
6969
// Replace first ident with `self` and check if that is valid.
70-
path[0] = keywords::SelfValue.name();
70+
path[0].name = keywords::SelfValue.name();
7171
let result = self.resolve_path(None, &path, None, parent_scope, false, span, CrateLint::No);
7272
debug!("make_missing_self_suggestion: path={:?} result={:?}", path, result);
7373
if let PathResult::Module(..) = result {
@@ -87,11 +87,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
8787
fn make_missing_crate_suggestion(
8888
&mut self,
8989
span: Span,
90-
mut path: Vec<Ident>
90+
mut path: Vec<Ident>,
9191
parent_scope: &ParentScope<'b>,
9292
) -> Option<(Vec<Ident>, Option<String>)> {
9393
// Replace first ident with `crate` and check if that is valid.
94-
path[0] = keywords::Crate.name();
94+
path[0].name = keywords::Crate.name();
9595
let result = self.resolve_path(None, &path, None, parent_scope, false, span, CrateLint::No);
9696
debug!("make_missing_crate_suggestion: path={:?} result={:?}", path, result);
9797
if let PathResult::Module(..) = result {
@@ -118,12 +118,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
118118
fn make_missing_super_suggestion(
119119
&mut self,
120120
span: Span,
121-
mut path: Vec<Ident>
121+
mut path: Vec<Ident>,
122122
parent_scope: &ParentScope<'b>,
123123
) -> Option<(Vec<Ident>, Option<String>)> {
124124
// Replace first ident with `crate` and check if that is valid.
125-
path[0] = keywords::Super.name();
126-
let result = self.resolve_path(None, &path, None, false, span, CrateLint::No);
125+
path[0].name = keywords::Super.name();
127126
let result = self.resolve_path(None, &path, None, parent_scope, false, span, CrateLint::No);
128127
debug!("make_missing_super_suggestion: path={:?} result={:?}", path, result);
129128
if let PathResult::Module(..) = result {
@@ -146,7 +145,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
146145
fn make_external_crate_suggestion(
147146
&mut self,
148147
span: Span,
149-
mut path: Vec<Ident>
148+
mut path: Vec<Ident>,
150149
parent_scope: &ParentScope<'b>,
151150
) -> Option<(Vec<Ident>, Option<String>)> {
152151
// Need to clone else we can't call `resolve_path` without a borrow error. We also store

Diff for: src/librustc_resolve/lib.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ pub struct ModuleData<'a> {
10101010
resolutions: RefCell<FxHashMap<(Ident, Namespace), &'a RefCell<NameResolution<'a>>>>,
10111011
legacy_macro_resolutions: RefCell<Vec<(Ident, MacroKind, ParentScope<'a>,
10121012
Option<&'a NameBinding<'a>>)>>,
1013-
macro_resolutions: RefCell<Vec<(Vec<Segment>, ParentScope<'a>, Span)>>,
1013+
macro_resolutions: RefCell<Vec<(Vec<Ident>, ParentScope<'a>, Span)>>,
10141014
builtin_attrs: RefCell<Vec<(Ident, ParentScope<'a>)>>,
10151015

10161016
// Macro invocations that can expand into items in this module.
@@ -1627,17 +1627,10 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> {
16271627
*def = module.def().unwrap(),
16281628
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 =>
16291629
*def = path_res.base_def(),
1630-
PathResult::NonModule(..) =>
1631-
if let PathResult::Failed(span, msg, _) = self.resolve_path(
1632-
None,
1633-
&path,
1634-
None,
1635-
true,
1636-
span,
1637-
CrateLint::No,
1638-
) {
1639-
error_callback(self, span, ResolutionError::FailedToResolve(&msg));
1640-
},
1630+
PathResult::NonModule(..) => {
1631+
let msg = "type-relative paths are not supported in this context";
1632+
error_callback(self, span, ResolutionError::FailedToResolve(msg));
1633+
}
16411634
PathResult::Module(ModuleOrUniformRoot::UniformRoot(_)) |
16421635
PathResult::Indeterminate => unreachable!(),
16431636
PathResult::Failed(span, msg, _) => {

Diff for: src/librustc_resolve/macros.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
463463
force: bool,
464464
) -> Result<Def, Determinacy> {
465465
let path_span = path.span;
466-
let mut path: Vec<_> = segments.iter().map(|seg| seg.ident).collect();
466+
let mut path = path.segments.iter().map(|s| s.ident).collect::<Vec<_>>();
467467

468468
// Possibly apply the macro helper hack
469469
if kind == MacroKind::Bang && path.len() == 1 &&
@@ -497,7 +497,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
497497
};
498498

499499
parent_scope.module.macro_resolutions.borrow_mut()
500-
.push((path.into_boxed_slice(), parent_scope.clone(), span));
500+
.push((path, parent_scope.clone(), path_span));
501501

502502
def
503503
} else {
@@ -849,7 +849,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
849849

850850
let macro_resolutions =
851851
mem::replace(&mut *module.macro_resolutions.borrow_mut(), Vec::new());
852-
for (mut path, parent_scope, path_span) in macro_resolutions {
852+
for (path, parent_scope, path_span) in macro_resolutions {
853853
match self.resolve_path(None, &path, Some(MacroNS), &parent_scope,
854854
true, path_span, CrateLint::No) {
855855
PathResult::NonModule(_) => {},

Diff for: src/librustc_resolve/resolve_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
993993
) {
994994
Some((
995995
span,
996-
format!("Did you mean `{}`?", names_to_string(&suggested_path[..]))
996+
format!("Did you mean `{}`?", names_to_string(&suggested_path[..])),
997997
note,
998998
))
999999
} else {

0 commit comments

Comments
 (0)