change usages of type_of to bound_type_of

This commit is contained in:
Kyle Matsuda 2023-02-06 17:48:12 -07:00
parent 9a7cc6c32f
commit d822b97a27
136 changed files with 385 additions and 262 deletions

View file

@ -2174,7 +2174,7 @@ impl CheckAttrVisitor<'_> {
let tcx = self.tcx;
if target == Target::Fn {
let Some(tokenstream) = tcx.get_diagnostic_item(sym::TokenStream) else {return};
let tokenstream = tcx.type_of(tokenstream);
let tokenstream = tcx.bound_type_of(tokenstream).subst_identity();
let id = hir_id.expect_owner();
let hir_sig = tcx.hir().fn_sig_by_hir_id(hir_id).unwrap();

View file

@ -315,7 +315,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
//// This is done to handle the case where, for example, the static
//// method of a private type is used, but the type itself is never
//// called directly.
let self_ty = self.tcx.type_of(item);
let self_ty = self.tcx.bound_type_of(item).subst_identity();
match *self_ty.kind() {
ty::Adt(def, _) => self.check_def_id(def.did()),
ty::Foreign(did) => self.check_def_id(did),
@ -654,7 +654,7 @@ impl<'tcx> DeadVisitor<'tcx> {
if self.live_symbols.contains(&field.did.expect_local()) {
return ShouldWarnAboutField::No;
}
let field_type = self.tcx.type_of(field.did);
let field_type = self.tcx.bound_type_of(field.did).subst_identity();
if field_type.is_phantom_data() {
return ShouldWarnAboutField::No;
}

View file

@ -29,7 +29,7 @@ pub fn test_layout(tcx: TyCtxt<'_>) {
fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) {
let tcx = tcx;
let param_env = tcx.param_env(item_def_id);
let ty = tcx.type_of(item_def_id);
let ty = tcx.bound_type_of(item_def_id).subst_identity();
match tcx.layout_of(param_env.and(ty)) {
Ok(ty_layout) => {
// Check out the `#[rustc_layout(..)]` attribute to tell what to dump.