diff options
| author | bors <bors@rust-lang.org> | 2020-03-23 06:02:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-23 06:02:34 +0000 |
| commit | 8ff785011be6625e32afceee3a08e5cff7470feb (patch) | |
| tree | f9a842b8f8e390c261192943061f48d6754f65da /src/librustc_resolve | |
| parent | 37c945dd6178cb520eb1e450a795f8c3b3cc5a3b (diff) | |
| parent | 5f91f30b0ace8a687e1acd2e057e27d4b57ad364 (diff) | |
Auto merge of #70296 - Centril:rollup-wvfmb3n, r=Centril
Rollup of 9 pull requests Successful merges: - #69251 (#[track_caller] in traits) - #69880 (miri engine: turn error sanity checks into assertions) - #70207 (Use getentropy(2) on macos) - #70227 (Only display definition when suggesting a typo) - #70236 (resolve: Avoid "self-confirming" import resolutions in one more case) - #70248 (parser: simplify & remove unused field) - #70249 (handle ConstKind::Unresolved after monomorphizing) - #70269 (remove redundant closures (clippy::redundant_closure)) - #70270 (Clean up E0449 explanation) Failed merges: r? @ghost
Diffstat (limited to 'src/librustc_resolve')
| -rw-r--r-- | src/librustc_resolve/diagnostics.rs | 2 | ||||
| -rw-r--r-- | src/librustc_resolve/imports.rs | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 9e5ff323914..c3d6baee0c7 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -796,7 +796,7 @@ impl<'a> Resolver<'a> { }); if let Some(span) = def_span { err.span_label( - span, + self.session.source_map().def_span(span), &format!( "similarly named {} `{}` defined here", suggestion.res.descr(), diff --git a/src/librustc_resolve/imports.rs b/src/librustc_resolve/imports.rs index 95597e8ebf1..d375ae4a447 100644 --- a/src/librustc_resolve/imports.rs +++ b/src/librustc_resolve/imports.rs @@ -874,6 +874,12 @@ impl<'a, 'b> ImportResolver<'a, 'b> { /// consolidate multiple unresolved import errors into a single diagnostic. fn finalize_import(&mut self, import: &'b Import<'b>) -> Option<UnresolvedImportError> { let orig_vis = import.vis.replace(ty::Visibility::Invisible); + let orig_blacklisted_binding = match &import.kind { + ImportKind::Single { target_bindings, .. } => { + Some(mem::replace(&mut self.r.blacklisted_binding, target_bindings[TypeNS].get())) + } + _ => None, + }; let prev_ambiguity_errors_len = self.r.ambiguity_errors.len(); let path_res = self.r.resolve_path( &import.module_path, @@ -884,6 +890,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> { import.crate_lint(), ); let no_ambiguity = self.r.ambiguity_errors.len() == prev_ambiguity_errors_len; + if let Some(orig_blacklisted_binding) = orig_blacklisted_binding { + self.r.blacklisted_binding = orig_blacklisted_binding; + } import.vis.set(orig_vis); if let PathResult::Failed { .. } | PathResult::NonModule(..) = path_res { // Consider erroneous imports used to avoid duplicate diagnostics. |
