Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix popping singleton paths in when generating E0433 #82259

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
crate_lint: CrateLint,
) -> PartialRes {
tracing::debug!(
"smart_resolve_path_fragment(id={:?},qself={:?},path={:?}",
"smart_resolve_path_fragment(id={:?}, qself={:?}, path={:?})",
id,
qself,
path
Expand Down Expand Up @@ -1841,11 +1841,10 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {

// Before we start looking for candidates, we have to get our hands
// on the type user is trying to perform invocation on; basically:
// we're transforming `HashMap::new` into just `HashMap`
let path = if let Some((_, path)) = path.split_last() {
path
} else {
return Some(parent_err);
// we're transforming `HashMap::new` into just `HashMap`.
let path = match path.split_last() {
Some((_, path)) if !path.is_empty() => path,
_ => return Some(parent_err),
};

let (mut err, candidates) =
Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/resolve/issue-82156.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
super(); //~ ERROR failed to resolve: there are too many leading `super` keywords
}
9 changes: 9 additions & 0 deletions src/test/ui/resolve/issue-82156.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0433]: failed to resolve: there are too many leading `super` keywords
--> $DIR/issue-82156.rs:2:5
|
LL | super();
| ^^^^^ there are too many leading `super` keywords

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.