Skip to content

Commit 34b8fe4

Browse files
committed
Create a new TyKind::DynStar variant
Not finished yet, just enough to make it compile.
1 parent 2773383 commit 34b8fe4

File tree

67 files changed

+270
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+270
-168
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use rustc_middle::ty::cast::CastTy;
3232
use rustc_middle::ty::subst::{SubstsRef, UserSubsts};
3333
use rustc_middle::ty::visit::TypeVisitable;
3434
use rustc_middle::ty::{
35-
self, Binder, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, Dynamic,
36-
OpaqueHiddenType, OpaqueTypeKey, RegionVid, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
35+
self, Binder, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, OpaqueHiddenType,
36+
OpaqueTypeKey, RegionVid, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
3737
};
3838
use rustc_span::def_id::CRATE_DEF_ID;
3939
use rustc_span::{Span, DUMMY_SP};
@@ -1928,7 +1928,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19281928
//
19291929
// apply them to prove that the source type `Foo` implements `Clone` etc
19301930
let (existential_predicates, region) = match ty.kind() {
1931-
Dynamic(predicates, region, ty::DynStar) => (predicates, region),
1931+
ty::DynStar(predicates, region) => (predicates, region),
19321932
_ => panic!("Invalid dyn* cast_ty"),
19331933
};
19341934

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use rustc_span::symbol::sym;
4040
use rustc_span::Symbol;
4141
use rustc_span::{DebuggerVisualizerFile, DebuggerVisualizerType};
4242
use rustc_target::abi::{Align, Size, VariantIdx};
43+
use rustc_type_ir::DynKind;
4344

4445
use std::collections::BTreeSet;
4546
use std::time::{Duration, Instant};
@@ -150,10 +151,8 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
150151
(&ty::Array(_, len), &ty::Slice(_)) => {
151152
cx.const_usize(len.eval_usize(cx.tcx(), ty::ParamEnv::reveal_all()))
152153
}
153-
(
154-
&ty::Dynamic(ref data_a, _, src_dyn_kind),
155-
&ty::Dynamic(ref data_b, _, target_dyn_kind),
156-
) if src_dyn_kind == target_dyn_kind => {
154+
(&ty::Dynamic(ref data_a, _), &ty::Dynamic(ref data_b, _))
155+
| (&ty::DynStar(ref data_a, _), &ty::DynStar(ref data_b, _)) => {
157156
let old_info =
158157
old_info.expect("unsized_info: missing old info for trait upcasting coercion");
159158
if data_a.principal_def_id() == data_b.principal_def_id() {
@@ -169,7 +168,15 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
169168
if let Some(entry_idx) = vptr_entry_idx {
170169
let ptr_ty = cx.type_i8p();
171170
let ptr_align = cx.tcx().data_layout.pointer_align.abi;
172-
let vtable_ptr_ty = vtable_ptr_ty(cx, target, target_dyn_kind);
171+
let vtable_ptr_ty = vtable_ptr_ty(
172+
cx,
173+
target,
174+
match target.kind() {
175+
ty::Dynamic(..) => DynKind::Dyn,
176+
ty::DynStar(..) => DynKind::DynStar,
177+
_ => unreachable!(),
178+
},
179+
);
173180
let llvtable = bx.pointercast(old_info, bx.type_ptr_to(ptr_ty));
174181
let gep = bx.inbounds_gep(
175182
ptr_ty,
@@ -185,8 +192,12 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
185192
old_info
186193
}
187194
}
188-
(_, &ty::Dynamic(ref data, _, target_dyn_kind)) => {
189-
let vtable_ptr_ty = vtable_ptr_ty(cx, target, target_dyn_kind);
195+
(_, &ty::Dynamic(ref data, _)) => {
196+
let vtable_ptr_ty = vtable_ptr_ty(cx, target, DynKind::Dyn);
197+
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()), vtable_ptr_ty)
198+
}
199+
(_, &ty::DynStar(ref data, _)) => {
200+
let vtable_ptr_ty = vtable_ptr_ty(cx, target, DynKind::DynStar);
190201
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()), vtable_ptr_ty)
191202
}
192203
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target),
@@ -197,14 +208,15 @@ pub fn unsized_info<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
197208
fn vtable_ptr_ty<'tcx, Cx: CodegenMethods<'tcx>>(
198209
cx: &Cx,
199210
target: Ty<'tcx>,
211+
// FIXME(dyn-star): This should be only place we need a `DynKind`, so move its definition here.
200212
kind: ty::DynKind,
201213
) -> <Cx as BackendTypes>::Type {
202214
cx.scalar_pair_element_backend_type(
203215
cx.layout_of(match kind {
204216
// vtable is the second field of `*mut dyn Trait`
205-
ty::Dyn => cx.tcx().mk_mut_ptr(target),
217+
DynKind::Dyn => cx.tcx().mk_mut_ptr(target),
206218
// vtable is the second field of `dyn* Trait`
207-
ty::DynStar => target,
219+
DynKind::DynStar => target,
208220
}),
209221
1,
210222
true,
@@ -269,10 +281,7 @@ pub fn cast_to_dyn_star<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
269281
old_info: Option<Bx::Value>,
270282
) -> (Bx::Value, Bx::Value) {
271283
debug!("cast_to_dyn_star: {:?} => {:?}", src_ty_and_layout.ty, dst_ty);
272-
assert!(
273-
matches!(dst_ty.kind(), ty::Dynamic(_, _, ty::DynStar)),
274-
"destination type must be a dyn*"
275-
);
284+
assert!(matches!(dst_ty.kind(), ty::DynStar(_, _)), "destination type must be a dyn*");
276285
// FIXME(dyn-star): this is probably not the best way to check if this is
277286
// a pointer, and really we should ensure that the value is a suitable
278287
// pointer earlier in the compilation process.

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ fn push_debuginfo_type_name<'tcx>(
209209
output.push(']');
210210
}
211211
}
212+
ty::DynStar(..) => unimplemented!(),
212213
ty::Dynamic(ref trait_data, ..) => {
213214
let auto_traits: SmallVec<[DefId; 4]> = trait_data.auto_traits().collect();
214215

compiler/rustc_codegen_ssa/src/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a, 'tcx> VirtualIndex {
6868
fn expect_dyn_trait_in_self(ty: Ty<'_>) -> ty::PolyExistentialTraitRef<'_> {
6969
for arg in ty.peel_refs().walk() {
7070
if let GenericArgKind::Type(ty) = arg.unpack() {
71-
if let ty::Dynamic(data, _, _) = ty.kind() {
71+
if let ty::Dynamic(data, _) | ty::DynStar(data, _) = ty.kind() {
7272
return data.principal().expect("expected principal trait object");
7373
}
7474
}

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
455455
let (drop_fn, fn_abi) = match ty.kind() {
456456
// FIXME(eddyb) perhaps move some of this logic into
457457
// `Instance::resolve_drop_in_place`?
458-
ty::Dynamic(_, _, ty::Dyn) => {
458+
ty::Dynamic(_, _) => {
459459
// IN THIS ARM, WE HAVE:
460460
// ty = *mut (dyn Trait)
461461
// which is: exists<T> ( *mut T, Vtable<T: Trait> )
@@ -485,7 +485,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
485485
fn_abi,
486486
)
487487
}
488-
ty::Dynamic(_, _, ty::DynStar) => {
488+
ty::DynStar(..) => {
489489
// IN THIS ARM, WE HAVE:
490490
// ty = *mut (dyn* Trait)
491491
// which is: *mut exists<T: sizeof(T) == sizeof(usize)> (T, Vtable<T: Trait>)

compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub(crate) fn const_to_valtree_inner<'tcx>(
118118
// resolving their backing type, even if we can do that at const eval time. We may
119119
// hypothetically be able to allow `dyn StructuralEq` trait objects in the future,
120120
// but it is unclear if this is useful.
121-
ty::Dynamic(..) => Err(ValTreeCreationError::NonSupportedType),
121+
ty::Dynamic(..) | ty::DynStar(..) => Err(ValTreeCreationError::NonSupportedType),
122122

123123
ty::Tuple(elem_tys) => {
124124
branches(ecx, place, elem_tys.len(), None, num_nodes)
@@ -319,7 +319,8 @@ pub fn valtree_to_const_value<'tcx>(
319319
| ty::RawPtr(_)
320320
| ty::Str
321321
| ty::Slice(_)
322-
| ty::Dynamic(..) => bug!("no ValTree should have been created for type {:?}", ty.kind()),
322+
| ty::Dynamic(..)
323+
| ty::DynStar(..) => bug!("no ValTree should have been created for type {:?}", ty.kind()),
323324
}
324325
}
325326

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
121121
}
122122

123123
DynStar => {
124-
if let ty::Dynamic(data, _, ty::DynStar) = cast_ty.kind() {
124+
if let ty::DynStar(data, _) = cast_ty.kind() {
125125
// Initial cast from sized to dyn trait
126126
let vtable = self.get_vtable_ptr(src.layout.ty, data.principal())?;
127127
let vtable = Scalar::from_maybe_pointer(vtable, self);
@@ -347,7 +347,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
347347
let new_vptr = self.get_vtable_ptr(ty, data_b.principal())?;
348348
self.write_immediate(Immediate::new_dyn_trait(old_data, new_vptr, self), dest)
349349
}
350-
(_, &ty::Dynamic(data, _, ty::Dyn)) => {
350+
(_, &ty::Dynamic(data, _)) => {
351351
// Initial cast from sized to dyn trait
352352
let vtable = self.get_vtable_ptr(src_pointee_ty, data.principal())?;
353353
let ptr = self.read_scalar(src)?;

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
9797
| ty::Ref(_, _, _)
9898
| ty::FnDef(_, _)
9999
| ty::FnPtr(_)
100-
| ty::Dynamic(_, _, _)
100+
| ty::Dynamic(_, _)
101+
| ty::DynStar(_, _)
101102
| ty::Closure(_, _)
102103
| ty::Generator(_, _, _)
103104
| ty::GeneratorWitness(_)

compiler/rustc_const_eval/src/interpret/validity.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
592592
| ty::Slice(..)
593593
| ty::Str
594594
| ty::Dynamic(..)
595+
| ty::DynStar(..)
595596
| ty::Closure(..)
596597
| ty::Generator(..) => Ok(false),
597598
// Some types only occur during typechecking, they have no layout.

compiler/rustc_const_eval/src/util/type_name.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
4747
| ty::FnPtr(_)
4848
| ty::Never
4949
| ty::Tuple(_)
50-
| ty::Dynamic(_, _, _) => self.pretty_print_type(ty),
50+
| ty::Dynamic(_, _)
51+
| ty::DynStar(_, _) => self.pretty_print_type(ty),
5152

5253
// Placeholders (all printed as `_` to uniformize them).
5354
ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => {

compiler/rustc_hir_analysis/src/astconv/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ use rustc_hir::{GenericArg, GenericArgs, OpaqueTyOrigin};
3030
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
3131
use rustc_middle::middle::stability::AllowUnstable;
3232
use rustc_middle::ty::subst::{self, GenericArgKind, InternalSubsts, SubstsRef};
33+
use rustc_middle::ty::EarlyBinder;
3334
use rustc_middle::ty::GenericParamDefKind;
3435
use rustc_middle::ty::{self, Const, DefIdTree, IsSuggestable, Ty, TyCtxt, TypeVisitable};
35-
use rustc_middle::ty::{DynKind, EarlyBinder};
3636
use rustc_session::lint::builtin::{AMBIGUOUS_ASSOCIATED_ITEMS, BARE_TRAIT_OBJECTS};
3737
use rustc_span::edition::Edition;
3838
use rustc_span::lev_distance::find_best_match_for_name;
@@ -46,6 +46,7 @@ use rustc_trait_selection::traits::error_reporting::{
4646
};
4747
use rustc_trait_selection::traits::wf::object_region_bounds;
4848

49+
use rustc_type_ir::DynKind;
4950
use smallvec::{smallvec, SmallVec};
5051
use std::collections::BTreeSet;
5152
use std::slice;
@@ -1628,7 +1629,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16281629
};
16291630
debug!("region_bound: {:?}", region_bound);
16301631

1631-
let ty = tcx.mk_dynamic(existential_predicates, region_bound, representation);
1632+
let ty = match representation {
1633+
DynKind::Dyn => tcx.mk_dynamic(existential_predicates, region_bound),
1634+
DynKind::DynStar => tcx.mk_dyn_star(existential_predicates, region_bound),
1635+
};
1636+
16321637
debug!("trait_object_type: {:?}", ty);
16331638
ty
16341639
}
@@ -2879,8 +2884,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
28792884
hir::TyKind::TraitObject(bounds, lifetime, repr) => {
28802885
self.maybe_lint_bare_trait(ast_ty, in_path);
28812886
let repr = match repr {
2882-
TraitObjectSyntax::Dyn | TraitObjectSyntax::None => ty::Dyn,
2883-
TraitObjectSyntax::DynStar => ty::DynStar,
2887+
TraitObjectSyntax::Dyn | TraitObjectSyntax::None => DynKind::Dyn,
2888+
TraitObjectSyntax::DynStar => DynKind::DynStar,
28842889
};
28852890
self.conv_object_ty_poly_trait_ref(ast_ty.span, bounds, lifetime, borrowed, repr)
28862891
}

compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl<'tcx> InherentCollect<'tcx> {
197197
ty::Dynamic(data, ..) if data.principal_def_id().is_some() => {
198198
self.check_def_id(item, self_ty, data.principal_def_id().unwrap());
199199
}
200-
ty::Dynamic(..) => {
200+
ty::Dynamic(..) | ty::DynStar(..) => {
201201
struct_span_err!(
202202
self.tcx.sess,
203203
ty.span,

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn do_orphan_check_impl<'tcx>(
181181
),
182182

183183
// impl AutoTrait for dyn Trait {}
184-
ty::Dynamic(..) => (
184+
ty::Dynamic(..) | ty::DynStar(..) => (
185185
LocalImpl::Disallow { problematic_kind: "trait object" },
186186
NonlocalImpl::DisallowOther,
187187
),

compiler/rustc_hir_analysis/src/variance/constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
256256
self.add_constraints_from_invariant_substs(current, data.substs, variance);
257257
}
258258

259-
ty::Dynamic(data, r, _) => {
259+
ty::Dynamic(data, r) | ty::DynStar(data, r) => {
260260
// The type `dyn Trait<T> +'a` is covariant w/r/t `'a`:
261261
self.add_constraints_from_region(current, r, variance);
262262

compiler/rustc_hir_typeck/src/cast.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
102102

103103
Ok(match *t.kind() {
104104
ty::Slice(_) | ty::Str => Some(PointerKind::Length),
105-
ty::Dynamic(ref tty, _, ty::Dyn) => Some(PointerKind::VTable(tty.principal_def_id())),
105+
ty::Dynamic(ref tty, _) => Some(PointerKind::VTable(tty.principal_def_id())),
106106
ty::Adt(def, substs) if def.is_struct() => match def.non_enum_variant().fields.last() {
107107
None => Some(PointerKind::Thin),
108108
Some(f) => {
@@ -139,7 +139,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
139139
| ty::Generator(..)
140140
| ty::Adt(..)
141141
| ty::Never
142-
| ty::Dynamic(_, _, ty::DynStar)
142+
| ty::DynStar(_, _)
143143
| ty::Error(_) => {
144144
let reported = self
145145
.tcx
@@ -218,9 +218,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
218218
// cases now. We do a more thorough check at the end, once
219219
// inference is more completely known.
220220
match cast_ty.kind() {
221-
ty::Dynamic(_, _, ty::Dyn) | ty::Slice(..) => {
222-
Err(check.report_cast_to_unsized_type(fcx))
223-
}
221+
ty::Dynamic(_, _) | ty::Slice(..) => Err(check.report_cast_to_unsized_type(fcx)),
224222
_ => Ok(check),
225223
}
226224
}

compiler/rustc_hir_typeck/src/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub(super) fn check_fn<'a, 'tcx>(
105105

106106
fcx.typeck_results.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig);
107107

108-
if let ty::Dynamic(_, _, ty::Dyn) = declared_ret_ty.kind() {
108+
if let ty::Dynamic(_, _) = declared_ret_ty.kind() {
109109
// FIXME: We need to verify that the return type is `Sized` after the return expression has
110110
// been evaluated so that we have types available for all the nodes being returned, but that
111111
// requires the coerced evaluated type to be stored. Moving `check_return_expr` before this

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
214214
ty::Ref(r_b, _, mutbl_b) => {
215215
return self.coerce_borrowed_pointer(a, b, r_b, mutbl_b);
216216
}
217-
ty::Dynamic(predicates, region, ty::DynStar) if self.tcx.features().dyn_star => {
217+
ty::DynStar(predicates, region) if self.tcx.features().dyn_star => {
218218
return self.coerce_dyn_star(a, b, predicates, region);
219219
}
220220
_ => {}
@@ -727,8 +727,8 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
727727
return Err(TypeError::Mismatch);
728728
}
729729

730-
if let ty::Dynamic(a_data, _, _) = a.kind()
731-
&& let ty::Dynamic(b_data, _, _) = b.kind()
730+
if let ty::Dynamic(a_data, _) | ty::DynStar(a_data, _) = a.kind()
731+
&& let ty::Dynamic(b_data, _) | ty::DynStar(b_data, _) = b.kind()
732732
&& a_data.principal_def_id() == b_data.principal_def_id()
733733
{
734734
return self.unify_and(a, b, |_| vec![]);

compiler/rustc_hir_typeck/src/generator_interior/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ fn check_must_not_suspend_ty<'tcx>(
595595
}
596596
has_emitted
597597
}
598-
ty::Dynamic(binder, _, _) => {
598+
ty::Dynamic(binder, _) | ty::DynStar(binder, _) => {
599599
let mut has_emitted = false;
600600
for predicate in binder.iter() {
601601
if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate.skip_binder() {

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
549549
// Point at the type that couldn't satisfy the bound.
550550
ty::Adt(def, _) => bound_spans.push((self.tcx.def_span(def.did()), msg)),
551551
// Point at the trait object that couldn't satisfy the bound.
552-
ty::Dynamic(preds, _, _) => {
552+
ty::Dynamic(preds, _) | ty::DynStar(preds, _) => {
553553
for pred in preds.iter() {
554554
match pred.skip_binder() {
555555
ty::ExistentialPredicate::Trait(tr) => {

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
450450
| ty::FnDef(..)
451451
| ty::FnPtr(_)
452452
| ty::Dynamic(..)
453+
| ty::DynStar(..)
453454
| ty::Never
454455
| ty::Tuple(..)
455456
| ty::Alias(..)

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ pub struct TraitObjectVisitor(pub FxIndexSet<DefId>);
542542
impl<'tcx> TypeVisitor<'tcx> for TraitObjectVisitor {
543543
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
544544
match t.kind() {
545-
ty::Dynamic(preds, re, _) if re.is_static() => {
545+
ty::Dynamic(preds, re) | ty::DynStar(preds, re) if re.is_static() => {
546546
if let Some(def_id) = preds.principal_def_id() {
547547
self.0.insert(def_id);
548548
}

compiler/rustc_infer/src/infer/outlives/components.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ fn compute_components<'tcx>(
176176
ty::Tuple(..) | // ...
177177
ty::FnPtr(_) | // OutlivesFunction (*)
178178
ty::Dynamic(..) | // OutlivesObject, OutlivesFragment (*)
179+
ty::DynStar(..) | // OutlivesObject, OutlivesFragment (*)
179180
ty::Placeholder(..) |
180181
ty::Bound(..) |
181182
ty::Error(_) => {

compiler/rustc_lint/src/deref_into_dyn_supertrait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ impl<'tcx> LateLintPass<'tcx> for DerefIntoDynSupertrait {
6363
&& let opt_did @ Some(did) = trait_.trait_def_id()
6464
&& opt_did == cx.tcx.lang_items().deref_trait()
6565
// `t` is `dyn t_principal`
66-
&& let ty::Dynamic(data, _, ty::Dyn) = t.kind()
66+
&& let ty::Dynamic(data, _) = t.kind()
6767
&& let Some(t_principal) = data.principal()
6868
// `<T as Deref>::Target` is `dyn target_principal`
6969
&& let Some(target) = cx.get_associated_type(t, did, "Target")
70-
&& let ty::Dynamic(data, _, ty::Dyn) = target.kind()
70+
&& let ty::Dynamic(data, _) = target.kind()
7171
&& let Some(target_principal) = data.principal()
7272
// `target_principal` is a supertrait of `t_principal`
7373
&& supertraits(cx.tcx, t_principal.with_self_ty(cx.tcx, cx.tcx.types.trait_object_dummy_self))

compiler/rustc_lint/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
10131013
help: Some(fluent::lint_improper_ctypes_slice_help),
10141014
},
10151015

1016-
ty::Dynamic(..) => {
1016+
ty::Dynamic(..) | ty::DynStar(..) => {
10171017
FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_dyn, help: None }
10181018
}
10191019

0 commit comments

Comments
 (0)