diff options
| author | Andy Wang <cbeuw.andy@gmail.com> | 2021-04-19 23:27:02 +0100 |
|---|---|---|
| committer | Andy Wang <cbeuw.andy@gmail.com> | 2021-05-05 15:31:28 +0100 |
| commit | 5417b45c2676dcd396f007bd89ed0cd55d085768 (patch) | |
| tree | 25a9819f523855d604aa373edb93c850f817532f /compiler/rustc_infer/src | |
| parent | fb4f6439f62d4b940bdfab3f78771d76eacab379 (diff) | |
| download | rust-5417b45c2676dcd396f007bd89ed0cd55d085768.tar.gz rust-5417b45c2676dcd396f007bd89ed0cd55d085768.zip | |
Use local and remapped paths where appropriate
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/mod.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index a91bd9ce2ff..dd3fa248bff 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -1604,13 +1604,19 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { match (&terr, expected == found) { (TypeError::Sorts(values), extra) => { let sort_string = |ty: Ty<'tcx>| match (extra, ty.kind()) { - (true, ty::Opaque(def_id, _)) => format!( - " (opaque type at {})", - self.tcx + (true, ty::Opaque(def_id, _)) => { + let pos = self + .tcx .sess .source_map() - .mk_substr_filename(self.tcx.def_span(*def_id)), - ), + .lookup_char_pos(self.tcx.def_span(*def_id).lo()); + format!( + " (opaque type at <{}:{}:{}>)", + pos.file.name.prefer_local(), + pos.line, + pos.col.to_usize() + 1, + ) + } (true, _) => format!(" ({})", ty.sort_string(self.tcx)), (false, _) => "".to_string(), }; |
