Skip to content

Commit 3eb5241

Browse files
matthewjaspervarkor
andcommitted
Apply suggestions from code review
Co-Authored-By: varkor <[email protected]>
1 parent 465b862 commit 3eb5241

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/librustc/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ impl<'tcx> AdtDef {
22862286
self.flags.contains(AdtFlags::IS_BOX)
22872287
}
22882288

2289-
/// Returns `true` if this is ManuallyDrop<T>.
2289+
/// Returns `true` if this is `ManuallyDrop<T>`.
22902290
#[inline]
22912291
pub fn is_manually_drop(&self) -> bool {
22922292
self.flags.contains(AdtFlags::IS_MANUALLY_DROP)

src/librustc/ty/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1013,12 +1013,12 @@ pub fn needs_drop_components(
10131013
| ty::Ref(..)
10141014
| ty::Str => Ok(SmallVec::new()),
10151015

1016-
// Foreign types can never have destructors
1016+
// Foreign types can never have destructors.
10171017
ty::Foreign(..) => Ok(SmallVec::new()),
10181018

10191019
// Pessimistically assume that all generators will require destructors
10201020
// as we don't know if a destructor is a noop or not until after the MIR
1021-
// state transformation pass
1021+
// state transformation pass.
10221022
ty::Generator(..) | ty::Dynamic(..) | ty::Error => Err(AlwaysRequiresDrop),
10231023

10241024
ty::Slice(ty) => needs_drop_components(ty, target_layout),

src/librustc_ty/needs_drop.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ type NeedsDropResult<T> = Result<T, AlwaysRequiresDrop>;
1212
fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool {
1313
let adt_fields =
1414
move |adt_def: &ty::AdtDef| tcx.adt_drop_tys(adt_def.did).map(|tys| tys.iter().copied());
15-
// If we don't know a type doesn't need drop, say it's a type parameter
16-
// without a `Copy` bound, then we conservatively return that it needs
17-
// drop.
15+
// If we don't know a type doesn't need drop, for example if it's a type
16+
// parameter without a `Copy` bound, then we conservatively return that it
17+
// needs drop.
1818
let res = NeedsDropTypes::new(tcx, query.param_env, query.value, adt_fields).next().is_some();
1919
debug!("needs_drop_raw({:?}) = {:?}", query, res);
2020
res
@@ -25,9 +25,10 @@ struct NeedsDropTypes<'tcx, F> {
2525
param_env: ty::ParamEnv<'tcx>,
2626
query_ty: Ty<'tcx>,
2727
seen_tys: FxHashSet<Ty<'tcx>>,
28-
/// A stack of types left to process. Each round, we pop something from the
29-
/// stack and check if it needs drop. If the result depends on whether some
30-
/// other types need drop we push them onto the stack.
28+
/// A stack of types left to process, and the recursion depth when we
29+
/// pushed that type. Each round, we pop something from the stack and check
30+
/// if it needs drop. If the result depends on whether some other types
31+
/// need drop we push them onto the stack.
3132
unchecked_tys: Vec<(Ty<'tcx>, usize)>,
3233
recursion_limit: usize,
3334
adt_components: F,

0 commit comments

Comments
 (0)