about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/lib.rs
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2021-05-17 20:39:28 -0700
committerEric Huss <eric@huss.org>2021-05-18 07:37:14 -0700
commit1400cb0295210bc500aa27f6cca3ccb546b38814 (patch)
treece20ed1cdf2c9cb966ffc42755eee2332579044e /compiler/rustc_resolve/src/lib.rs
parent5f10d310f475b3ba583b9c590b8d19f6c2fde28f (diff)
downloadrust-1400cb0295210bc500aa27f6cca3ccb546b38814.tar.gz
rust-1400cb0295210bc500aa27f6cca3ccb546b38814.zip
Fix use placement for suggestions near main.
Diffstat (limited to 'compiler/rustc_resolve/src/lib.rs')
-rw-r--r--compiler/rustc_resolve/src/lib.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs
index 300d2c01cb5..c36aa91a5e8 100644
--- a/compiler/rustc_resolve/src/lib.rs
+++ b/compiler/rustc_resolve/src/lib.rs
@@ -330,15 +330,15 @@ impl UsePlacementFinder {
                     if self.span.map_or(true, |span| item.span < span)
                         && !item.span.from_expansion()
                     {
+                        self.span = Some(item.span.shrink_to_lo());
                         // don't insert between attributes and an item
-                        if item.attrs.is_empty() {
-                            self.span = Some(item.span.shrink_to_lo());
-                        } else {
-                            // find the first attribute on the item
-                            for attr in &item.attrs {
-                                if self.span.map_or(true, |span| attr.span < span) {
-                                    self.span = Some(attr.span.shrink_to_lo());
-                                }
+                        // find the first attribute on the item
+                        // FIXME: This is broken for active attributes.
+                        for attr in &item.attrs {
+                            if !attr.span.is_dummy()
+                                && self.span.map_or(true, |span| attr.span < span)
+                            {
+                                self.span = Some(attr.span.shrink_to_lo());
                             }
                         }
                     }