Skip to content

Commit 3cabe7d

Browse files
committed
Only mark spans in incremental mode.
1 parent a487993 commit 3cabe7d

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_resolve/src/def_collector.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ impl<'a, 'b, 'tcx> DefCollector<'a, 'b, 'tcx> {
129129

130130
impl<'a, 'b, 'tcx> mut_visit::MutVisitor for DefCollector<'a, 'b, 'tcx> {
131131
fn visit_span(&mut self, span: &mut Span) {
132-
*span = span.with_parent(Some(self.parent_def));
132+
if self.resolver.tcx.sess.opts.incremental.is_some() {
133+
*span = span.with_parent(Some(self.parent_def));
134+
}
133135
}
134136

135137
#[tracing::instrument(level = "trace", skip(self))]

tests/ui/macros/issue-69396-const-no-type-in-macro.stderr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ error[E0428]: the name `A` is defined multiple times
22
--> $DIR/issue-69396-const-no-type-in-macro.rs:4:13
33
|
44
LL | const A = "A".$fn();
5-
| ^^^^^^^^^^^^^^^^^^^^
6-
| |
7-
| `A` redefined here
8-
| previous definition of the value `A` here
5+
| ^^^^^^^^^^^^^^^^^^^^ `A` redefined here
96
...
107
LL | / suite! {
118
LL | | len;

0 commit comments

Comments
 (0)