]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_hir_analysis/src/variance/test.rs
Auto merge of #105924 - TimNN:ui-remap, r=Mark-Simulacrum
[rust.git] / compiler / rustc_hir_analysis / src / variance / test.rs
1 use rustc_middle::ty::TyCtxt;
2 use rustc_span::symbol::sym;
3
4 pub fn test_variance(tcx: TyCtxt<'_>) {
5     // For unit testing: check for a special "rustc_variance"
6     // attribute and report an error with various results if found.
7     for id in tcx.hir().items() {
8         if tcx.has_attr(id.owner_id.to_def_id(), sym::rustc_variance) {
9             let variances_of = tcx.variances_of(id.owner_id);
10
11             tcx.sess.struct_span_err(tcx.def_span(id.owner_id), format!("{variances_of:?}")).emit();
12         }
13     }
14 }