mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 14:23:45 +00:00
review
This commit is contained in:
parent
9cba14b95b
commit
2e087d2eaa
@ -707,7 +707,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
|
|||||||
// Test the callee's predicates, substituting in `ref_ty` for the moved argument type.
|
// Test the callee's predicates, substituting in `ref_ty` for the moved argument type.
|
||||||
clauses.instantiate(tcx, new_args).predicates.iter().all(|&(mut clause)| {
|
clauses.instantiate(tcx, new_args).predicates.iter().all(|&(mut clause)| {
|
||||||
// Normalize before testing to see through type aliases and projections.
|
// Normalize before testing to see through type aliases and projections.
|
||||||
if let Ok(normalized) = tcx.try_normalize_erasing_regions(self.param_env, clause) {
|
if let Ok(normalized) =
|
||||||
|
tcx.try_normalize_erasing_regions(self.infcx.typing_env(self.param_env), clause)
|
||||||
|
{
|
||||||
clause = normalized;
|
clause = normalized;
|
||||||
}
|
}
|
||||||
self.infcx.predicate_must_hold_modulo_regions(&Obligation::new(
|
self.infcx.predicate_must_hold_modulo_regions(&Obligation::new(
|
||||||
|
@ -1126,7 +1126,7 @@ fn check_type_defn<'tcx>(
|
|||||||
let ty = tcx.type_of(variant.tail().did).instantiate_identity();
|
let ty = tcx.type_of(variant.tail().did).instantiate_identity();
|
||||||
let ty = tcx.erase_regions(ty);
|
let ty = tcx.erase_regions(ty);
|
||||||
assert!(!ty.has_infer());
|
assert!(!ty.has_infer());
|
||||||
ty.needs_drop(tcx, ty::TypingEnv::non_body_analysis(tcx, item.owner_id.def_id))
|
ty.needs_drop(tcx, wfcx.infcx.typing_env(wfcx.param_env))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// All fields (except for possibly the last) should be sized.
|
// All fields (except for possibly the last) should be sized.
|
||||||
|
@ -1286,7 +1286,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
u
|
u
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract [ty::TypingMode] of this inference context to get a `TypingEnv`
|
/// Extract [`ty::TypingMode`] of this inference context to get a `TypingEnv`
|
||||||
/// which contains the necessary information to use the trait system without
|
/// which contains the necessary information to use the trait system without
|
||||||
/// using canonicalization or carrying this inference context around.
|
/// using canonicalization or carrying this inference context around.
|
||||||
pub fn typing_env(&self, param_env: ty::ParamEnv<'tcx>) -> ty::TypingEnv<'tcx> {
|
pub fn typing_env(&self, param_env: ty::ParamEnv<'tcx>) -> ty::TypingEnv<'tcx> {
|
||||||
@ -1304,8 +1304,8 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
ty::TypingEnv { typing_mode, param_env }
|
ty::TypingEnv { typing_mode, param_env }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Similar to [Self::canonicalize_query], except that it returns
|
/// Similar to [`Self::canonicalize_query`], except that it returns
|
||||||
/// a [PseudoCanonicalInput] and requires both the `value` and the
|
/// a [`PseudoCanonicalInput`] and requires both the `value` and the
|
||||||
/// `param_env` to not contain any inference variables or placeholders.
|
/// `param_env` to not contain any inference variables or placeholders.
|
||||||
pub fn pseudo_canonicalize_query<V>(
|
pub fn pseudo_canonicalize_query<V>(
|
||||||
&self,
|
&self,
|
||||||
|
@ -1197,7 +1197,8 @@ impl<'tcx> TypingEnv<'tcx> {
|
|||||||
// as these placeholders are also local to the current inference context. However, we
|
// as these placeholders are also local to the current inference context. However, we
|
||||||
// currently use pseudo-canonical queries in the trait solver which replaces params with
|
// currently use pseudo-canonical queries in the trait solver which replaces params with
|
||||||
// placeholders. We should also simply not use pseudo-canonical queries in the trait
|
// placeholders. We should also simply not use pseudo-canonical queries in the trait
|
||||||
// solver, at which point we can readd this assert.
|
// solver, at which point we can readd this assert. As of writing this comment, this is
|
||||||
|
// only used by `fn layout_is_pointer_like` when calling `layout_of`.
|
||||||
//
|
//
|
||||||
// debug_assert!(!value.has_placeholders());
|
// debug_assert!(!value.has_placeholders());
|
||||||
PseudoCanonicalInput { typing_env: self, value }
|
PseudoCanonicalInput { typing_env: self, value }
|
||||||
|
@ -227,6 +227,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||||||
if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr };
|
if range.start <= range.end { BinOp::BitAnd } else { BinOp::BitOr };
|
||||||
|
|
||||||
let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> {
|
let mut comparer = |range: u128, bin_op: BinOp| -> Place<'tcx> {
|
||||||
|
// We can use `ty::TypingEnv::fully_monomorphized()`` here
|
||||||
|
// as we only need it to compute the layout of a primitive.
|
||||||
let range_val = Const::from_bits(
|
let range_val = Const::from_bits(
|
||||||
this.tcx,
|
this.tcx,
|
||||||
range,
|
range,
|
||||||
|
Loading…
Reference in New Issue
Block a user