diff options
Diffstat (limited to 'compiler/rustc_resolve/src')
| -rw-r--r-- | compiler/rustc_resolve/src/diagnostics.rs | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index af4d7a8eaff..0b60952ae3c 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -2126,26 +2126,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> { let source_map = self.r.session.source_map(); // Make sure this is actually crate-relative. - let use_and_crate = import.use_span.with_hi(after_crate_name.lo()); - let is_definitely_crate = - source_map.span_to_snippet(use_and_crate).map_or(false, |s| { - let mut s = s.trim(); - debug!("check_for_module_export_macro: s={s:?}",); - s = s - .split_whitespace() - .rev() - .next() - .expect("split_whitespace always yields at least once"); - debug!("check_for_module_export_macro: s={s:?}",); - if s.ends_with("::") { - s = &s[..s.len() - 2]; - } else { - return false; - } - s = s.trim(); - debug!("check_for_module_export_macro: s={s:?}",); - s != "self" && s != "super" - }); + let is_definitely_crate = import + .module_path + .first() + .map_or(false, |f| f.ident.name != kw::SelfLower && f.ident.name != kw::Super); // Add the import to the start, with a `{` if required. let start_point = source_map.start_point(after_crate_name); |
