Skip to content

Commit a010df9

Browse files
float and int vars are trivially copy
1 parent edabf59 commit a010df9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/rustc_hir_analysis/src/check/generator_interior/drop_ranges/record_consumed_borrow.rs

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> {
198198

199199
// If the type being assigned needs dropped, then the mutation counts as a borrow
200200
// since it is essentially doing `Drop::drop(&mut x); x = new_value;`.
201+
//
202+
// FIXME(drop-tracking): We need to be more responsible about inference
203+
// variables here, since `needs_drop` is a "raw" type query, i.e. it
204+
// basically requires types to have been fully resolved.
201205
if assignee_place.place.base_ty.needs_drop(self.tcx, self.param_env) {
202206
self.places
203207
.borrowed

compiler/rustc_middle/src/ty/sty.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,10 @@ impl<'tcx> Ty<'tcx> {
22052205
// These aren't even `Clone`
22062206
ty::Str | ty::Slice(..) | ty::Foreign(..) | ty::Dynamic(..) => false,
22072207

2208-
ty::Int(..) | ty::Uint(..) | ty::Float(..) => true,
2208+
ty::Infer(ty::InferTy::FloatVar(_) | ty::InferTy::IntVar(_))
2209+
| ty::Int(..)
2210+
| ty::Uint(..)
2211+
| ty::Float(..) => true,
22092212

22102213
// The voldemort ZSTs are fine.
22112214
ty::FnDef(..) => true,

0 commit comments

Comments
 (0)