remove VarianceTest
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
parent
03e955d812
commit
9c111dd209
2 changed files with 7 additions and 21 deletions
|
@ -185,4 +185,3 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,15 @@
|
|||
use rustc_errors::struct_span_err;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
pub fn test_variance(tcx: TyCtxt<'_>) {
|
||||
tcx.hir().visit_all_item_likes(&mut VarianceTest { tcx });
|
||||
}
|
||||
|
||||
struct VarianceTest<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'tcx> {
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||
// For unit testing: check for a special "rustc_variance"
|
||||
// attribute and report an error with various results if found.
|
||||
if self.tcx.has_attr(item.def_id.to_def_id(), sym::rustc_variance) {
|
||||
let variances_of = self.tcx.variances_of(item.def_id);
|
||||
struct_span_err!(self.tcx.sess, item.span, E0208, "{:?}", variances_of).emit();
|
||||
// For unit testing: check for a special "rustc_variance"
|
||||
// attribute and report an error with various results if found.
|
||||
for id in tcx.hir().items() {
|
||||
if tcx.has_attr(id.def_id.to_def_id(), sym::rustc_variance) {
|
||||
let variances_of = tcx.variances_of(id.def_id);
|
||||
struct_span_err!(tcx.sess, tcx.hir().span(id.hir_id()), E0208, "{:?}", variances_of)
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem<'tcx>) {}
|
||||
fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem<'tcx>) {}
|
||||
fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem<'tcx>) {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue