19 lines
544 B
Rust
19 lines
544 B
Rust
|
|
use rustc_hir::def::DefKind;
|
||
|
|
use rustc_hir::def_id::CRATE_DEF_ID;
|
||
|
|
use rustc_middle::ty::TyCtxt;
|
||
|
|
use rustc_span::sym;
|
||
|
|
|
||
|
|
pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
|
||
|
|
if !tcx.has_attr(CRATE_DEF_ID, sym::rustc_hidden_type_of_opaques) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
for id in tcx.hir().items() {
|
||
|
|
let DefKind::OpaqueTy = tcx.def_kind(id.owner_id) else { continue };
|
||
|
|
|
||
|
|
let ty = tcx.type_of(id.owner_id).instantiate_identity();
|
||
|
|
|
||
|
|
tcx.dcx().emit_err(crate::errors::TypeOf { span: tcx.def_span(id.owner_id), ty });
|
||
|
|
}
|
||
|
|
}
|