mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 00:53:48 +00:00
Rollup merge of #95517 - lcnr:rustc_borrowck-misc, r=jackh726
small rustc_borrowck cleanup r? `@jackh726` because of the second commit, seems like that comment was missed in #91243
This commit is contained in:
commit
1f86789bb3
@ -253,8 +253,10 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
|
|||||||
let constraint_sets: Vec<_> = unnormalized_input_output_tys
|
let constraint_sets: Vec<_> = unnormalized_input_output_tys
|
||||||
.flat_map(|ty| {
|
.flat_map(|ty| {
|
||||||
debug!("build: input_or_output={:?}", ty);
|
debug!("build: input_or_output={:?}", ty);
|
||||||
// We add implied bounds from both the unnormalized and normalized ty
|
// We only add implied bounds for the normalized type as the unnormalized
|
||||||
// See issue #87748
|
// type may not actually get checked by the caller.
|
||||||
|
//
|
||||||
|
// Can otherwise be unsound, see #91068.
|
||||||
let TypeOpOutput { output: norm_ty, constraints: constraints1, .. } = self
|
let TypeOpOutput { output: norm_ty, constraints: constraints1, .. } = self
|
||||||
.param_env
|
.param_env
|
||||||
.and(type_op::normalize::Normalize::new(ty))
|
.and(type_op::normalize::Normalize::new(ty))
|
||||||
|
@ -1899,7 +1899,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||||||
ObligationCause::new(
|
ObligationCause::new(
|
||||||
span,
|
span,
|
||||||
self.tcx().hir().local_def_id_to_hir_id(def_id),
|
self.tcx().hir().local_def_id_to_hir_id(def_id),
|
||||||
traits::ObligationCauseCode::RepeatVec(is_const_fn),
|
traits::ObligationCauseCode::RepeatElementCopy {
|
||||||
|
is_const_fn,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
self.param_env,
|
self.param_env,
|
||||||
ty::Binder::dummy(ty::TraitRef::new(
|
ty::Binder::dummy(ty::TraitRef::new(
|
||||||
|
@ -236,11 +236,12 @@ pub enum ObligationCauseCode<'tcx> {
|
|||||||
SizedBoxType,
|
SizedBoxType,
|
||||||
/// Inline asm operand type must be `Sized`.
|
/// Inline asm operand type must be `Sized`.
|
||||||
InlineAsmSized,
|
InlineAsmSized,
|
||||||
/// `[T, ..n]` implies that `T` must be `Copy`.
|
/// `[expr; N]` requires `type_of(expr): Copy`.
|
||||||
/// If the function in the array repeat expression is a `const fn`,
|
RepeatElementCopy {
|
||||||
/// display a help message suggesting to move the function call to a
|
/// If element is a `const fn` we display a help message suggesting to move the
|
||||||
/// new `const` item while saying that `T` doesn't implement `Copy`.
|
/// function call to a new `const` item while saying that `T` doesn't implement `Copy`.
|
||||||
RepeatVec(bool),
|
is_const_fn: bool,
|
||||||
|
},
|
||||||
|
|
||||||
/// Types of fields (other than the last, except for packed structs) in a struct must be sized.
|
/// Types of fields (other than the last, except for packed structs) in a struct must be sized.
|
||||||
FieldSized {
|
FieldSized {
|
||||||
|
@ -198,7 +198,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
|||||||
let kind = match pat.kind {
|
let kind = match pat.kind {
|
||||||
hir::PatKind::Wild => PatKind::Wild,
|
hir::PatKind::Wild => PatKind::Wild,
|
||||||
|
|
||||||
hir::PatKind::Lit(ref value) => self.lower_lit(value),
|
hir::PatKind::Lit(value) => self.lower_lit(value),
|
||||||
|
|
||||||
hir::PatKind::Range(ref lo_expr, ref hi_expr, end) => {
|
hir::PatKind::Range(ref lo_expr, ref hi_expr, end) => {
|
||||||
let (lo_expr, hi_expr) = (lo_expr.as_deref(), hi_expr.as_deref());
|
let (lo_expr, hi_expr) = (lo_expr.as_deref(), hi_expr.as_deref());
|
||||||
|
@ -1988,7 +1988,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||||||
ObligationCauseCode::Coercion { source: _, target } => {
|
ObligationCauseCode::Coercion { source: _, target } => {
|
||||||
err.note(&format!("required by cast to type `{}`", self.ty_to_string(target)));
|
err.note(&format!("required by cast to type `{}`", self.ty_to_string(target)));
|
||||||
}
|
}
|
||||||
ObligationCauseCode::RepeatVec(is_const_fn) => {
|
ObligationCauseCode::RepeatElementCopy { is_const_fn } => {
|
||||||
err.note(
|
err.note(
|
||||||
"the `Copy` trait is required because the repeated element will be copied",
|
"the `Copy` trait is required because the repeated element will be copied",
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user