|  | 
| 1 | 1 | use rustc_errors::StashKey; | 
| 2 | 2 | use rustc_hir::def::DefKind; | 
| 3 |  | -use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID}; | 
|  | 3 | +use rustc_hir::def_id::LocalDefId; | 
| 4 | 4 | use rustc_hir::intravisit::{self, Visitor}; | 
| 5 | 5 | use rustc_hir::{self as hir, def, Expr, ImplItem, Item, Node, TraitItem}; | 
| 6 | 6 | use rustc_middle::bug; | 
| 7 | 7 | use rustc_middle::hir::nested_filter; | 
| 8 | 8 | use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt}; | 
| 9 |  | -use rustc_span::{sym, ErrorGuaranteed, DUMMY_SP}; | 
|  | 9 | +use rustc_span::DUMMY_SP; | 
| 10 | 10 | 
 | 
| 11 |  | -use crate::errors::{TaitForwardCompat, TaitForwardCompat2, TypeOf, UnconstrainedOpaqueType}; | 
| 12 |  | - | 
| 13 |  | -pub fn test_opaque_hidden_types(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> { | 
| 14 |  | -    let mut res = Ok(()); | 
| 15 |  | -    if tcx.has_attr(CRATE_DEF_ID, sym::rustc_hidden_type_of_opaques) { | 
| 16 |  | -        for id in tcx.hir().items() { | 
| 17 |  | -            if matches!(tcx.def_kind(id.owner_id), DefKind::OpaqueTy) { | 
| 18 |  | -                let type_of = tcx.type_of(id.owner_id).instantiate_identity(); | 
| 19 |  | - | 
| 20 |  | -                res = Err(tcx.dcx().emit_err(TypeOf { span: tcx.def_span(id.owner_id), type_of })); | 
| 21 |  | -            } | 
| 22 |  | -        } | 
| 23 |  | -    } | 
| 24 |  | -    res | 
| 25 |  | -} | 
|  | 11 | +use crate::errors::{TaitForwardCompat, TaitForwardCompat2, UnconstrainedOpaqueType}; | 
| 26 | 12 | 
 | 
| 27 | 13 | /// Checks "defining uses" of opaque `impl Trait` in associated types. | 
| 28 | 14 | /// These can only be defined by associated items of the same trait. | 
|  | 
0 commit comments