|
4 | 4 | //! def-path. This is used for unit testing the code that generates |
5 | 5 | //! paths etc in all kinds of annoying scenarios. |
6 | 6 |
|
7 | | -use crate::errors::{AltInvalidTraitItem, InvalidDefPath, InvalidSymbolName, InvalidTraitItem}; |
| 7 | +use crate::errors::{Kind, TestOutput}; |
8 | 8 | use rustc_hir::def_id::LocalDefId; |
9 | 9 | use rustc_middle::ty::print::with_no_trimmed_paths; |
10 | 10 | use rustc_middle::ty::{subst::InternalSubsts, Instance, TyCtxt}; |
@@ -60,26 +60,30 @@ impl SymbolNamesTest<'_> { |
60 | 60 | tcx.erase_regions(InternalSubsts::identity_for_item(tcx, def_id)), |
61 | 61 | ); |
62 | 62 | let mangled = tcx.symbol_name(instance); |
63 | | - tcx.sess.emit_err(InvalidSymbolName { |
| 63 | + tcx.sess.emit_err(TestOutput { |
64 | 64 | span: attr.span, |
65 | | - mangled_formatted: format!("{mangled}"), |
| 65 | + kind: Kind::SymbolName, |
| 66 | + content: format!("{mangled}"), |
66 | 67 | }); |
67 | 68 | if let Ok(demangling) = rustc_demangle::try_demangle(mangled.name) { |
68 | | - tcx.sess.emit_err(InvalidTraitItem { |
| 69 | + tcx.sess.emit_err(TestOutput { |
69 | 70 | span: attr.span, |
70 | | - demangling_formatted: format!("{demangling}"), |
| 71 | + kind: Kind::Demangling, |
| 72 | + content: format!("{demangling}"), |
71 | 73 | }); |
72 | | - tcx.sess.emit_err(AltInvalidTraitItem { |
| 74 | + tcx.sess.emit_err(TestOutput { |
73 | 75 | span: attr.span, |
74 | | - alt_demangling_formatted: format!("{:#}", demangling), |
| 76 | + kind: Kind::DemanglingAlt, |
| 77 | + content: format!("{:#}", demangling), |
75 | 78 | }); |
76 | 79 | } |
77 | 80 | } |
78 | 81 |
|
79 | 82 | for attr in tcx.get_attrs(def_id.to_def_id(), DEF_PATH) { |
80 | | - tcx.sess.emit_err(InvalidDefPath { |
| 83 | + tcx.sess.emit_err(TestOutput { |
81 | 84 | span: attr.span, |
82 | | - def_path: with_no_trimmed_paths!(tcx.def_path_str(def_id.to_def_id())), |
| 85 | + kind: Kind::DefPath, |
| 86 | + content: with_no_trimmed_paths!(tcx.def_path_str(def_id.to_def_id())), |
83 | 87 | }); |
84 | 88 | } |
85 | 89 | } |
|
0 commit comments