Skip to content

Commit 65933a9

Browse files
committed
FRTs don't implement Drop
1 parent 24f6dfa commit 65933a9

File tree

12 files changed

+36
-0
lines changed

12 files changed

+36
-0
lines changed

compiler/rustc_middle/src/ty/significant_drop_order.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ pub fn ty_dtor_span<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Span> {
128128
| ty::Error(_)
129129
| ty::Str
130130
| ty::Never
131+
| ty::Field(_, _)
131132
| ty::RawPtr(_, _)
132133
| ty::Ref(_, _, _)
133134
| ty::FnPtr(_, _)

compiler/rustc_middle/src/ty/util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,7 @@ impl<'tcx> Ty<'tcx> {
12621262
| ty::RawPtr(..)
12631263
| ty::FnDef(..)
12641264
| ty::Error(_)
1265+
| ty::Field(..)
12651266
| ty::FnPtr(..) => true,
12661267
// FIXME(unsafe_binders):
12671268
ty::UnsafeBinder(_) => todo!(),
@@ -1507,6 +1508,7 @@ pub fn needs_drop_components_with_async<'tcx>(
15071508
| ty::FnDef(..)
15081509
| ty::FnPtr(..)
15091510
| ty::Char
1511+
| ty::Field(..)
15101512
| ty::RawPtr(_, _)
15111513
| ty::Ref(..)
15121514
| ty::Str => Ok(SmallVec::new()),

compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ pub(in crate::solve) fn const_conditions_for_destruct<I: Interner>(
789789
| ty::FnDef(..)
790790
| ty::FnPtr(..)
791791
| ty::Never
792+
| ty::Field(_, _)
792793
| ty::Infer(ty::InferTy::FloatVar(_) | ty::InferTy::IntVar(_))
793794
| ty::Error(_) => Ok(vec![]),
794795

compiler/rustc_next_trait_solver/src/solve/trait_goals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ where
743743
| ty::Slice(_)
744744
| ty::Foreign(..)
745745
| ty::Adt(..)
746+
| ty::Field(..)
746747
| ty::Alias(..)
747748
| ty::Param(_)
748749
| ty::Placeholder(..)

compiler/rustc_pattern_analysis/src/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> {
414414
| ty::UnsafeBinder(_)
415415
| ty::Alias(_, _)
416416
| ty::Param(_)
417+
| ty::Field(..)
417418
| ty::Error(_) => ConstructorSet::Unlistable,
418419
ty::CoroutineWitness(_, _) | ty::Bound(_, _) | ty::Placeholder(_) | ty::Infer(_) => {
419420
bug!("Encountered unexpected type in `ConstructorSet::for_ty`: {ty:?}")

compiler/rustc_trait_selection/src/traits/effects.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>(
366366
| ty::FnDef(..)
367367
| ty::FnPtr(..)
368368
| ty::Never
369+
| ty::Field(_, _)
369370
| ty::Infer(ty::InferTy::FloatVar(_) | ty::InferTy::IntVar(_))
370371
| ty::Error(_) => thin_vec![],
371372

compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
4242
| ty::RawPtr(_, _)
4343
| ty::Ref(..)
4444
| ty::Str
45+
| ty::Field(..)
4546
| ty::Foreign(..)
4647
| ty::Error(_) => true,
4748

@@ -278,6 +279,7 @@ pub fn dtorck_constraint_for_ty_inner<'tcx>(
278279
| ty::Foreign(..)
279280
| ty::RawPtr(..)
280281
| ty::Ref(..)
282+
| ty::Field(..)
281283
| ty::FnDef(..)
282284
| ty::FnPtr(..)
283285
| ty::CoroutineWitness(..) => {

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
14031403
match obligation.predicate.self_ty().skip_binder().kind() {
14041404
ty::Ref(..)
14051405
| ty::Adt(..)
1406+
| ty::Field(..)
14061407
| ty::Tuple(_)
14071408
| ty::Array(..)
14081409
| ty::FnDef(..)

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
13021302
| ty::Slice(_)
13031303
| ty::Foreign(..)
13041304
| ty::Adt(..)
1305+
| ty::Field(..)
13051306
| ty::Alias(..)
13061307
| ty::Param(_)
13071308
| ty::Placeholder(..)

compiler/rustc_ty_utils/src/needs_drop.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ where
293293
| ty::Tuple(_)
294294
| ty::Bound(..)
295295
| ty::Never
296+
| ty::Field(..)
296297
| ty::Infer(_)
297298
| ty::Error(_) => {
298299
bug!("unexpected type returned by `needs_drop_components`: {component}")

0 commit comments

Comments
 (0)