diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-06-19 13:11:18 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2024-06-20 20:31:32 +0200 |
| commit | bc12972bcd7fb93e515c14b9e1f514bc3d2683d8 (patch) | |
| tree | 8d496bedc9d219adf84f03bd844716760deeb209 /compiler/rustc_hir_analysis/src/variance/test.rs | |
| parent | cb8a7ea0ed866295e0f65725cea6662bea51971a (diff) | |
| download | rust-bc12972bcd7fb93e515c14b9e1f514bc3d2683d8.tar.gz rust-bc12972bcd7fb93e515c14b9e1f514bc3d2683d8.zip | |
Slightly refactor the dumping of HIR analysis data
Diffstat (limited to 'compiler/rustc_hir_analysis/src/variance/test.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/variance/test.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/compiler/rustc_hir_analysis/src/variance/test.rs b/compiler/rustc_hir_analysis/src/variance/test.rs deleted file mode 100644 index c211e1af046..00000000000 --- a/compiler/rustc_hir_analysis/src/variance/test.rs +++ /dev/null @@ -1,37 +0,0 @@ -use rustc_hir::def::DefKind; -use rustc_hir::def_id::CRATE_DEF_ID; -use rustc_middle::ty::TyCtxt; -use rustc_span::symbol::sym; -use rustc_span::ErrorGuaranteed; - -use crate::errors; - -pub fn test_variance(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { - let mut res = Ok(()); - if tcx.has_attr(CRATE_DEF_ID, sym::rustc_variance_of_opaques) { - for id in tcx.hir().items() { - if matches!(tcx.def_kind(id.owner_id), DefKind::OpaqueTy) { - let variances_of = tcx.variances_of(id.owner_id); - - res = Err(tcx.dcx().emit_err(errors::VariancesOf { - span: tcx.def_span(id.owner_id), - variances_of: format!("{variances_of:?}"), - })); - } - } - } - - // 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.owner_id, sym::rustc_variance) { - let variances_of = tcx.variances_of(id.owner_id); - - res = Err(tcx.dcx().emit_err(errors::VariancesOf { - span: tcx.def_span(id.owner_id), - variances_of: format!("{variances_of:?}"), - })); - } - } - res -} |
