Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit bea0a6d

Browse files
committed
address review
1 parent 372c4fd commit bea0a6d

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18191819
_ => None,
18201820
},
18211821
ConstantKind::Unevaluated(uv, _) => Some(uv),
1822-
_ => None,
1822+
ConstantKind::Val(..) => None,
18231823
};
18241824

18251825
if let Some(uv) = maybe_uneval {

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ pub enum ConstantKind<'tcx> {
20622062
/// This constant came from the type system
20632063
Ty(ty::Const<'tcx>),
20642064

2065-
/// An unevaluated constant that cannot go back into the type system.
2065+
/// An unevaluated mir constant which is not part of the type system.
20662066
Unevaluated(ty::Unevaluated<'tcx, Option<Promoted>>, Ty<'tcx>),
20672067

20682068
/// This constant cannot go back into the type system, as it represents

compiler/rustc_middle/src/mir/visit.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,20 +1077,12 @@ macro_rules! visit_place_fns {
10771077
location,
10781078
);
10791079

1080-
if new_local == local {
1081-
None
1082-
} else {
1083-
Some(PlaceElem::Index(new_local))
1084-
}
1080+
if new_local == local { None } else { Some(PlaceElem::Index(new_local)) }
10851081
}
10861082
PlaceElem::Field(field, ty) => {
10871083
let mut new_ty = ty;
10881084
self.visit_ty(&mut new_ty, TyContext::Location(location));
1089-
if ty != new_ty {
1090-
Some(PlaceElem::Field(field, new_ty))
1091-
} else {
1092-
None
1093-
}
1085+
if ty != new_ty { Some(PlaceElem::Field(field, new_ty)) } else { None }
10941086
}
10951087
PlaceElem::Deref
10961088
| PlaceElem::ConstantIndex { .. }

compiler/rustc_mir_transform/src/const_prop_lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
299299
let err = ConstEvalErr::new(&self.ecx, error, Some(c.span));
300300
if let Some(lint_root) = self.lint_root(source_info) {
301301
let lint_only = match c.literal {
302-
ConstantKind::Ty(_) => c.literal.needs_subst(),
302+
ConstantKind::Ty(ct) => ct.needs_subst(),
303303
ConstantKind::Unevaluated(
304304
ty::Unevaluated { def: _, substs: _, promoted: Some(_) },
305305
_,

0 commit comments

Comments
 (0)