Skip to content

Commit 90e941a

Browse files
committed
mir: improve polymorphic constant bug
This commit changes the span and content of the "collection encountered polymorphic constant" bug in monomorphization collection to point to the use of the constant rather than the definition. Signed-off-by: David Wood <[email protected]>
1 parent 4825e12 commit 90e941a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustc_mir/monomorphize/collector.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,9 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
627627
Ok(val) => collect_const_value(self.tcx, val, self.output),
628628
Err(ErrorHandled::Reported(ErrorReported) | ErrorHandled::Linted) => {}
629629
Err(ErrorHandled::TooGeneric) => span_bug!(
630-
self.tcx.def_span(def.did),
631-
"collection encountered polymorphic constant",
630+
self.body.source_info(location).span,
631+
"collection encountered polymorphic constant: {}",
632+
substituted_constant
632633
),
633634
}
634635
}

0 commit comments

Comments
 (0)