diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2021-02-19 02:49:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-19 02:49:11 +0100 |
| commit | cc01bbe8f0cf7b19053c5f0578992cb7d2f4bba8 (patch) | |
| tree | df4b476cce5cf436042bd57e9e76e6d68bc1e78c /compiler/rustc_resolve/src | |
| parent | c244546626fb95b25df4713fa82c5f3877f7dbfc (diff) | |
| parent | 9889e44470cbc6ae3c8e2fcfb6016ed15ed8cf51 (diff) | |
| download | rust-cc01bbe8f0cf7b19053c5f0578992cb7d2f4bba8.tar.gz rust-cc01bbe8f0cf7b19053c5f0578992cb7d2f4bba8.zip | |
Rollup merge of #82259 - osa1:issue82156, r=petrochenkov
Fix popping singleton paths in when generating E0433 Fixes #82156 --- This was introduced with #72923, so pinging `@Patryk27` for reviews.
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/late.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 09ab84eaeb6..701d48a982d 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -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 @@ -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) = |
