diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-04-27 19:58:46 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-09-10 20:18:26 +0200 |
| commit | fb5ced0fbd7625316ee28d4f2f7230aac35753dd (patch) | |
| tree | 0523ed2d831d5ca8c07b046e896f458a0f8e694c /compiler/rustc_interface/src/callbacks.rs | |
| parent | 940fa9251e3c538a4c9d35d84dcaa09065e45687 (diff) | |
| download | rust-fb5ced0fbd7625316ee28d4f2f7230aac35753dd.tar.gz rust-fb5ced0fbd7625316ee28d4f2f7230aac35753dd.zip | |
Add sanity check.
We force the relative span's parent to be absolute. This avoids having to handle long dependency chains.
Diffstat (limited to 'compiler/rustc_interface/src/callbacks.rs')
| -rw-r--r-- | compiler/rustc_interface/src/callbacks.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_interface/src/callbacks.rs b/compiler/rustc_interface/src/callbacks.rs index 03c75655d6a..95bd2993456 100644 --- a/compiler/rustc_interface/src/callbacks.rs +++ b/compiler/rustc_interface/src/callbacks.rs @@ -28,7 +28,9 @@ fn span_debug(span: rustc_span::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result fn track_span_parent(def_id: rustc_span::def_id::LocalDefId) { tls::with_opt(|tcx| { if let Some(tcx) = tcx { - let _ = tcx.source_span(def_id); + let _span = tcx.source_span(def_id); + // Sanity check: relative span's parent must be an absolute span. + debug_assert_eq!(_span.data_untracked().parent, None); } }) } |
