Skip to content

Commit c27f308

Browse files
committed
remove OutlivesTest
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
1 parent 9c111dd commit c27f308

File tree

1 file changed

+4
-18
lines changed
  • compiler/rustc_typeck/src/outlives

1 file changed

+4
-18
lines changed
Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
use rustc_errors::struct_span_err;
2-
use rustc_hir as hir;
3-
use rustc_hir::itemlikevisit::ItemLikeVisitor;
42
use rustc_middle::ty::TyCtxt;
53
use rustc_span::symbol::sym;
64

75
pub fn test_inferred_outlives(tcx: TyCtxt<'_>) {
8-
tcx.hir().visit_all_item_likes(&mut OutlivesTest { tcx });
9-
}
10-
11-
struct OutlivesTest<'tcx> {
12-
tcx: TyCtxt<'tcx>,
13-
}
14-
15-
impl<'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> {
16-
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
6+
for id in tcx.hir().items() {
177
// For unit testing: check for a special "rustc_outlives"
188
// attribute and report an error with various results if found.
19-
if self.tcx.has_attr(item.def_id.to_def_id(), sym::rustc_outlives) {
20-
let inferred_outlives_of = self.tcx.inferred_outlives_of(item.def_id);
21-
struct_span_err!(self.tcx.sess, item.span, E0640, "{:?}", inferred_outlives_of).emit();
9+
if tcx.has_attr(id.def_id.to_def_id(), sym::rustc_outlives) {
10+
let inferred_outlives_of = tcx.inferred_outlives_of(id.def_id);
11+
struct_span_err!(tcx.sess, tcx.hir().span(id.hir_id()), E0640, "{:?}", inferred_outlives_of).emit();
2212
}
2313
}
24-
25-
fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem<'tcx>) {}
26-
fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem<'tcx>) {}
27-
fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem<'tcx>) {}
2814
}

0 commit comments

Comments
 (0)