mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Rollup merge of #146664 - fmease:clean-up-dyn, r=jdonszelmann
Clean up `ty::Dynamic` 1. As a follow-up to PR rust-lang/rust#143036, remove `DynKind` entirely. 2. Inside HIR ty lowering, consolidate modules `dyn_compatibility` and `lint` into `dyn_trait` * `dyn_compatibility` wasn't about dyn compatibility itself, it's about lowering trait object types * `lint` contained dyn-Trait-specific diagnostics+lints only
This commit is contained in:
+1
-1
@@ -715,7 +715,7 @@ pub(crate) fn codegen_drop<'tcx>(
|
||||
fx.bcx.ins().jump(ret_block, &[]);
|
||||
} else {
|
||||
match ty.kind() {
|
||||
ty::Dynamic(_, _, ty::Dyn) => {
|
||||
ty::Dynamic(_, _) => {
|
||||
// IN THIS ARM, WE HAVE:
|
||||
// ty = *mut (dyn Trait)
|
||||
// which is: exists<T> ( *mut T, Vtable<T: Trait> )
|
||||
|
||||
+1
-3
@@ -30,9 +30,7 @@ pub(crate) fn unsized_info<'tcx>(
|
||||
fx.pointer_type,
|
||||
len.try_to_target_usize(fx.tcx).expect("expected monomorphic const in codegen") as i64,
|
||||
),
|
||||
(&ty::Dynamic(data_a, _, src_dyn_kind), &ty::Dynamic(data_b, _, target_dyn_kind))
|
||||
if src_dyn_kind == target_dyn_kind =>
|
||||
{
|
||||
(&ty::Dynamic(data_a, _), &ty::Dynamic(data_b, _)) => {
|
||||
let old_info =
|
||||
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
|
||||
let b_principal_def_id = data_b.principal_def_id();
|
||||
|
||||
@@ -909,8 +909,7 @@ pub(crate) fn assert_assignable<'tcx>(
|
||||
);
|
||||
// fn(&T) -> for<'l> fn(&'l T) is allowed
|
||||
}
|
||||
(&ty::Dynamic(from_traits, _, _from_kind), &ty::Dynamic(to_traits, _, _to_kind)) => {
|
||||
// FIXME(dyn-star): Do the right thing with DynKinds
|
||||
(&ty::Dynamic(from_traits, _), &ty::Dynamic(to_traits, _)) => {
|
||||
for (from, to) in from_traits.iter().zip(to_traits) {
|
||||
let from = fx.tcx.normalize_erasing_late_bound_regions(fx.typing_env(), from);
|
||||
let to = fx.tcx.normalize_erasing_late_bound_regions(fx.typing_env(), to);
|
||||
|
||||
Reference in New Issue
Block a user