Revert "Make ClosureOutlivesRequirement not rely on an unresolved type"
This reverts commit a6b5f95fb0
.
This commit is contained in:
parent
0da281b606
commit
dce44faf5b
20 changed files with 93 additions and 94 deletions
|
@ -92,7 +92,7 @@ pub struct OutlivesConstraint<'tcx> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
/// What caused this constraint?
|
/// What caused this constraint?
|
||||||
pub category: ConstraintCategory,
|
pub category: ConstraintCategory<'tcx>,
|
||||||
|
|
||||||
/// Variance diagnostic information
|
/// Variance diagnostic information
|
||||||
pub variance_info: VarianceDiagInfo<'tcx>,
|
pub variance_info: VarianceDiagInfo<'tcx>,
|
||||||
|
|
|
@ -983,7 +983,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
err: &mut Diagnostic,
|
err: &mut Diagnostic,
|
||||||
location: Location,
|
location: Location,
|
||||||
issued_borrow: &BorrowData<'tcx>,
|
issued_borrow: &BorrowData<'tcx>,
|
||||||
explanation: BorrowExplanation,
|
explanation: BorrowExplanation<'tcx>,
|
||||||
) {
|
) {
|
||||||
let used_in_call = matches!(
|
let used_in_call = matches!(
|
||||||
explanation,
|
explanation,
|
||||||
|
@ -1333,7 +1333,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
borrow: &BorrowData<'tcx>,
|
borrow: &BorrowData<'tcx>,
|
||||||
drop_span: Span,
|
drop_span: Span,
|
||||||
borrow_spans: UseSpans<'tcx>,
|
borrow_spans: UseSpans<'tcx>,
|
||||||
explanation: BorrowExplanation,
|
explanation: BorrowExplanation<'tcx>,
|
||||||
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
||||||
debug!(
|
debug!(
|
||||||
"report_local_value_does_not_live_long_enough(\
|
"report_local_value_does_not_live_long_enough(\
|
||||||
|
@ -1539,7 +1539,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
drop_span: Span,
|
drop_span: Span,
|
||||||
borrow_spans: UseSpans<'tcx>,
|
borrow_spans: UseSpans<'tcx>,
|
||||||
proper_span: Span,
|
proper_span: Span,
|
||||||
explanation: BorrowExplanation,
|
explanation: BorrowExplanation<'tcx>,
|
||||||
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
||||||
if let BorrowExplanation::MustBeValidFor { category, span, from_closure: false, .. } =
|
if let BorrowExplanation::MustBeValidFor { category, span, from_closure: false, .. } =
|
||||||
explanation
|
explanation
|
||||||
|
@ -1653,7 +1653,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
borrow: &BorrowData<'tcx>,
|
borrow: &BorrowData<'tcx>,
|
||||||
borrow_span: Span,
|
borrow_span: Span,
|
||||||
return_span: Span,
|
return_span: Span,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
opt_place_desc: Option<&String>,
|
opt_place_desc: Option<&String>,
|
||||||
) -> Option<DiagnosticBuilder<'cx, ErrorGuaranteed>> {
|
) -> Option<DiagnosticBuilder<'cx, ErrorGuaranteed>> {
|
||||||
let return_kind = match category {
|
let return_kind = match category {
|
||||||
|
@ -1748,7 +1748,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
use_span: UseSpans<'tcx>,
|
use_span: UseSpans<'tcx>,
|
||||||
var_span: Span,
|
var_span: Span,
|
||||||
fr_name: &RegionName,
|
fr_name: &RegionName,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
constraint_span: Span,
|
constraint_span: Span,
|
||||||
captured_var: &str,
|
captured_var: &str,
|
||||||
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'cx, ErrorGuaranteed> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ use crate::{
|
||||||
use super::{find_use, RegionName, UseSpans};
|
use super::{find_use, RegionName, UseSpans};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) enum BorrowExplanation {
|
pub(crate) enum BorrowExplanation<'tcx> {
|
||||||
UsedLater(LaterUseKind, Span, Option<Span>),
|
UsedLater(LaterUseKind, Span, Option<Span>),
|
||||||
UsedLaterInLoop(LaterUseKind, Span, Option<Span>),
|
UsedLaterInLoop(LaterUseKind, Span, Option<Span>),
|
||||||
UsedLaterWhenDropped {
|
UsedLaterWhenDropped {
|
||||||
|
@ -30,7 +30,7 @@ pub(crate) enum BorrowExplanation {
|
||||||
should_note_order: bool,
|
should_note_order: bool,
|
||||||
},
|
},
|
||||||
MustBeValidFor {
|
MustBeValidFor {
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
from_closure: bool,
|
from_closure: bool,
|
||||||
span: Span,
|
span: Span,
|
||||||
region_name: RegionName,
|
region_name: RegionName,
|
||||||
|
@ -49,7 +49,7 @@ pub(crate) enum LaterUseKind {
|
||||||
Other,
|
Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> BorrowExplanation {
|
impl<'tcx> BorrowExplanation<'tcx> {
|
||||||
pub(crate) fn is_explained(&self) -> bool {
|
pub(crate) fn is_explained(&self) -> bool {
|
||||||
!matches!(self, BorrowExplanation::Unexplained)
|
!matches!(self, BorrowExplanation::Unexplained)
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ impl<'tcx> BorrowExplanation {
|
||||||
fn add_lifetime_bound_suggestion_to_diagnostic(
|
fn add_lifetime_bound_suggestion_to_diagnostic(
|
||||||
&self,
|
&self,
|
||||||
err: &mut Diagnostic,
|
err: &mut Diagnostic,
|
||||||
category: &ConstraintCategory,
|
category: &ConstraintCategory<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
region_name: &RegionName,
|
region_name: &RegionName,
|
||||||
) {
|
) {
|
||||||
|
@ -316,7 +316,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
&self,
|
&self,
|
||||||
borrow_region: RegionVid,
|
borrow_region: RegionVid,
|
||||||
outlived_region: RegionVid,
|
outlived_region: RegionVid,
|
||||||
) -> (ConstraintCategory, bool, Span, Option<RegionName>, Vec<ExtraConstraintInfo>) {
|
) -> (ConstraintCategory<'tcx>, bool, Span, Option<RegionName>, Vec<ExtraConstraintInfo>) {
|
||||||
let (blame_constraint, extra_info) = self.regioncx.best_blame_constraint(
|
let (blame_constraint, extra_info) = self.regioncx.best_blame_constraint(
|
||||||
borrow_region,
|
borrow_region,
|
||||||
NllRegionVariableOrigin::FreeRegion,
|
NllRegionVariableOrigin::FreeRegion,
|
||||||
|
@ -348,7 +348,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
location: Location,
|
location: Location,
|
||||||
borrow: &BorrowData<'tcx>,
|
borrow: &BorrowData<'tcx>,
|
||||||
kind_place: Option<(WriteKind, Place<'tcx>)>,
|
kind_place: Option<(WriteKind, Place<'tcx>)>,
|
||||||
) -> BorrowExplanation {
|
) -> BorrowExplanation<'tcx> {
|
||||||
let regioncx = &self.regioncx;
|
let regioncx = &self.regioncx;
|
||||||
let body: &Body<'_> = &self.body;
|
let body: &Body<'_> = &self.body;
|
||||||
let tcx = self.infcx.tcx;
|
let tcx = self.infcx.tcx;
|
||||||
|
|
|
@ -161,7 +161,7 @@ impl OutlivesSuggestionBuilder {
|
||||||
pub(crate) fn intermediate_suggestion(
|
pub(crate) fn intermediate_suggestion(
|
||||||
&mut self,
|
&mut self,
|
||||||
mbcx: &MirBorrowckCtxt<'_, '_>,
|
mbcx: &MirBorrowckCtxt<'_, '_>,
|
||||||
errci: &ErrorConstraintInfo,
|
errci: &ErrorConstraintInfo<'_>,
|
||||||
diag: &mut Diagnostic,
|
diag: &mut Diagnostic,
|
||||||
) {
|
) {
|
||||||
// Emit an intermediate note.
|
// Emit an intermediate note.
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||||
//! Error reporting machinery for lifetime errors.
|
//! Error reporting machinery for lifetime errors.
|
||||||
|
|
||||||
use either::Either;
|
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan};
|
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, MultiSpan};
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
|
@ -17,7 +16,7 @@ use rustc_infer::infer::{
|
||||||
NllRegionVariableOrigin, RelateParamBound,
|
NllRegionVariableOrigin, RelateParamBound,
|
||||||
};
|
};
|
||||||
use rustc_middle::hir::place::PlaceBase;
|
use rustc_middle::hir::place::PlaceBase;
|
||||||
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint, TerminatorKind};
|
use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
|
||||||
use rustc_middle::ty::subst::InternalSubsts;
|
use rustc_middle::ty::subst::InternalSubsts;
|
||||||
use rustc_middle::ty::Region;
|
use rustc_middle::ty::Region;
|
||||||
use rustc_middle::ty::TypeVisitor;
|
use rustc_middle::ty::TypeVisitor;
|
||||||
|
@ -40,7 +39,7 @@ use crate::{
|
||||||
MirBorrowckCtxt,
|
MirBorrowckCtxt,
|
||||||
};
|
};
|
||||||
|
|
||||||
impl ConstraintDescription for ConstraintCategory {
|
impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
|
||||||
fn description(&self) -> &'static str {
|
fn description(&self) -> &'static str {
|
||||||
// Must end with a space. Allows for empty names to be provided.
|
// Must end with a space. Allows for empty names to be provided.
|
||||||
match self {
|
match self {
|
||||||
|
@ -116,7 +115,7 @@ pub(crate) enum RegionErrorKind<'tcx> {
|
||||||
|
|
||||||
/// Information about the various region constraints involved in a borrow checker error.
|
/// Information about the various region constraints involved in a borrow checker error.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ErrorConstraintInfo {
|
pub struct ErrorConstraintInfo<'tcx> {
|
||||||
// fr: outlived_fr
|
// fr: outlived_fr
|
||||||
pub(super) fr: RegionVid,
|
pub(super) fr: RegionVid,
|
||||||
pub(super) fr_is_local: bool,
|
pub(super) fr_is_local: bool,
|
||||||
|
@ -124,7 +123,7 @@ pub struct ErrorConstraintInfo {
|
||||||
pub(super) outlived_fr_is_local: bool,
|
pub(super) outlived_fr_is_local: bool,
|
||||||
|
|
||||||
// Category and span for best blame constraint
|
// Category and span for best blame constraint
|
||||||
pub(super) category: ConstraintCategory,
|
pub(super) category: ConstraintCategory<'tcx>,
|
||||||
pub(super) span: Span,
|
pub(super) span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +498,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
/// ```
|
/// ```
|
||||||
fn report_fnmut_error(
|
fn report_fnmut_error(
|
||||||
&self,
|
&self,
|
||||||
errci: &ErrorConstraintInfo,
|
errci: &ErrorConstraintInfo<'tcx>,
|
||||||
kind: ReturnConstraint,
|
kind: ReturnConstraint,
|
||||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||||
let ErrorConstraintInfo { outlived_fr, span, .. } = errci;
|
let ErrorConstraintInfo { outlived_fr, span, .. } = errci;
|
||||||
|
@ -572,7 +571,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
fn report_escaping_data_error(
|
fn report_escaping_data_error(
|
||||||
&self,
|
&self,
|
||||||
errci: &ErrorConstraintInfo,
|
errci: &ErrorConstraintInfo<'tcx>,
|
||||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||||
let ErrorConstraintInfo { span, category, .. } = errci;
|
let ErrorConstraintInfo { span, category, .. } = errci;
|
||||||
|
|
||||||
|
@ -676,7 +675,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
/// ```
|
/// ```
|
||||||
fn report_general_error(
|
fn report_general_error(
|
||||||
&self,
|
&self,
|
||||||
errci: &ErrorConstraintInfo,
|
errci: &ErrorConstraintInfo<'tcx>,
|
||||||
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {
|
||||||
let ErrorConstraintInfo {
|
let ErrorConstraintInfo {
|
||||||
fr,
|
fr,
|
||||||
|
@ -789,7 +788,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
diag: &mut Diagnostic,
|
diag: &mut Diagnostic,
|
||||||
f: Region<'tcx>,
|
f: Region<'tcx>,
|
||||||
o: Region<'tcx>,
|
o: Region<'tcx>,
|
||||||
category: &ConstraintCategory,
|
category: &ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
if !o.is_static() {
|
if !o.is_static() {
|
||||||
return;
|
return;
|
||||||
|
@ -797,12 +796,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let tcx = self.infcx.tcx;
|
let tcx = self.infcx.tcx;
|
||||||
|
|
||||||
let instance =
|
let instance = if let ConstraintCategory::CallArgument(Some(func_ty)) = category {
|
||||||
if let ConstraintCategory::CallArgument(location) = category
|
|
||||||
&& let Either::Right(term) = self.body.stmt_at(*location)
|
|
||||||
&& let TerminatorKind::Call { func, .. } = &term.kind
|
|
||||||
{
|
|
||||||
let func_ty = func.ty(self.body, tcx);
|
|
||||||
let (fn_did, substs) = match func_ty.kind() {
|
let (fn_did, substs) = match func_ty.kind() {
|
||||||
ty::FnDef(fn_did, substs) => (fn_did, substs),
|
ty::FnDef(fn_did, substs) => (fn_did, substs),
|
||||||
_ => return,
|
_ => return,
|
||||||
|
|
|
@ -91,7 +91,7 @@ pub struct RegionInferenceContext<'tcx> {
|
||||||
|
|
||||||
/// Map closure bounds to a `Span` that should be used for error reporting.
|
/// Map closure bounds to a `Span` that should be used for error reporting.
|
||||||
closure_bounds_mapping:
|
closure_bounds_mapping:
|
||||||
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
|
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory<'tcx>, Span)>>,
|
||||||
|
|
||||||
/// Map universe indexes to information on why we created it.
|
/// Map universe indexes to information on why we created it.
|
||||||
universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
||||||
|
@ -267,7 +267,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
member_constraints_in: MemberConstraintSet<'tcx, RegionVid>,
|
member_constraints_in: MemberConstraintSet<'tcx, RegionVid>,
|
||||||
closure_bounds_mapping: FxHashMap<
|
closure_bounds_mapping: FxHashMap<
|
||||||
Location,
|
Location,
|
||||||
FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>,
|
FxHashMap<(RegionVid, RegionVid), (ConstraintCategory<'tcx>, Span)>,
|
||||||
>,
|
>,
|
||||||
universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
||||||
type_tests: Vec<TypeTest<'tcx>>,
|
type_tests: Vec<TypeTest<'tcx>>,
|
||||||
|
@ -1807,7 +1807,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
pub(crate) fn retrieve_closure_constraint_info(
|
pub(crate) fn retrieve_closure_constraint_info(
|
||||||
&self,
|
&self,
|
||||||
constraint: OutlivesConstraint<'tcx>,
|
constraint: OutlivesConstraint<'tcx>,
|
||||||
) -> Option<(ConstraintCategory, Span)> {
|
) -> Option<(ConstraintCategory<'tcx>, Span)> {
|
||||||
match constraint.locations {
|
match constraint.locations {
|
||||||
Locations::All(_) => None,
|
Locations::All(_) => None,
|
||||||
Locations::Single(loc) => {
|
Locations::Single(loc) => {
|
||||||
|
@ -1822,7 +1822,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
fr1: RegionVid,
|
fr1: RegionVid,
|
||||||
fr1_origin: NllRegionVariableOrigin,
|
fr1_origin: NllRegionVariableOrigin,
|
||||||
fr2: RegionVid,
|
fr2: RegionVid,
|
||||||
) -> (ConstraintCategory, ObligationCause<'tcx>) {
|
) -> (ConstraintCategory<'tcx>, ObligationCause<'tcx>) {
|
||||||
let BlameConstraint { category, cause, .. } = self
|
let BlameConstraint { category, cause, .. } = self
|
||||||
.best_blame_constraint(fr1, fr1_origin, |r| self.provides_universal_region(r, fr1, fr2))
|
.best_blame_constraint(fr1, fr1_origin, |r| self.provides_universal_region(r, fr1, fr2))
|
||||||
.0;
|
.0;
|
||||||
|
@ -2362,7 +2362,7 @@ impl<'tcx> ClosureRegionRequirementsExt<'tcx> for ClosureRegionRequirements<'tcx
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct BlameConstraint<'tcx> {
|
pub struct BlameConstraint<'tcx> {
|
||||||
pub category: ConstraintCategory,
|
pub category: ConstraintCategory<'tcx>,
|
||||||
pub from_closure: bool,
|
pub from_closure: bool,
|
||||||
pub cause: ObligationCause<'tcx>,
|
pub cause: ObligationCause<'tcx>,
|
||||||
pub variance_info: ty::VarianceDiagInfo<'tcx>,
|
pub variance_info: ty::VarianceDiagInfo<'tcx>,
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
pub(super) fn fully_perform_op<R: fmt::Debug, Op>(
|
pub(super) fn fully_perform_op<R: fmt::Debug, Op>(
|
||||||
&mut self,
|
&mut self,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
op: Op,
|
op: Op,
|
||||||
) -> Fallible<R>
|
) -> Fallible<R>
|
||||||
where
|
where
|
||||||
|
@ -85,7 +85,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
trait_ref: ty::TraitRef<'tcx>,
|
trait_ref: ty::TraitRef<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
self.prove_predicate(
|
self.prove_predicate(
|
||||||
ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate {
|
ty::Binder::dummy(ty::PredicateKind::Trait(ty::TraitPredicate {
|
||||||
|
@ -124,7 +124,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
|
predicates: impl IntoIterator<Item = impl ToPredicate<'tcx>>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
for predicate in predicates {
|
for predicate in predicates {
|
||||||
let predicate = predicate.to_predicate(self.tcx());
|
let predicate = predicate.to_predicate(self.tcx());
|
||||||
|
@ -139,7 +139,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
predicate: ty::Predicate<'tcx>,
|
predicate: ty::Predicate<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
let param_env = self.param_env;
|
let param_env = self.param_env;
|
||||||
self.fully_perform_op(
|
self.fully_perform_op(
|
||||||
|
@ -164,7 +164,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
value: T,
|
value: T,
|
||||||
location: impl NormalizeLocation,
|
location: impl NormalizeLocation,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> T
|
) -> T
|
||||||
where
|
where
|
||||||
T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
|
T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub(crate) struct ConstraintConversion<'a, 'tcx> {
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
span: Span,
|
span: Span,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
||||||
param_env: ty::ParamEnv<'tcx>,
|
param_env: ty::ParamEnv<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
span: Span,
|
span: Span,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -175,7 +175,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
||||||
&mut self,
|
&mut self,
|
||||||
sup: ty::RegionVid,
|
sup: ty::RegionVid,
|
||||||
sub: ty::RegionVid,
|
sub: ty::RegionVid,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
let category = match self.category {
|
let category = match self.category {
|
||||||
ConstraintCategory::Boring | ConstraintCategory::BoringNoLocation => category,
|
ConstraintCategory::Boring | ConstraintCategory::BoringNoLocation => category,
|
||||||
|
@ -203,7 +203,7 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
|
||||||
_origin: SubregionOrigin<'tcx>,
|
_origin: SubregionOrigin<'tcx>,
|
||||||
a: ty::Region<'tcx>,
|
a: ty::Region<'tcx>,
|
||||||
b: ty::Region<'tcx>,
|
b: ty::Region<'tcx>,
|
||||||
constraint_category: ConstraintCategory,
|
constraint_category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
let b = self.to_region_vid(b);
|
let b = self.to_region_vid(b);
|
||||||
let a = self.to_region_vid(a);
|
let a = self.to_region_vid(a);
|
||||||
|
|
|
@ -942,7 +942,7 @@ pub(crate) struct MirTypeckRegionConstraints<'tcx> {
|
||||||
pub(crate) member_constraints: MemberConstraintSet<'tcx, RegionVid>,
|
pub(crate) member_constraints: MemberConstraintSet<'tcx, RegionVid>,
|
||||||
|
|
||||||
pub(crate) closure_bounds_mapping:
|
pub(crate) closure_bounds_mapping:
|
||||||
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
|
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory<'tcx>, Span)>>,
|
||||||
|
|
||||||
pub(crate) universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
pub(crate) universe_causes: FxHashMap<ty::UniverseIndex, UniverseInfo<'tcx>>,
|
||||||
|
|
||||||
|
@ -1133,7 +1133,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
fn push_region_constraints(
|
fn push_region_constraints(
|
||||||
&mut self,
|
&mut self,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
data: &QueryRegionConstraints<'tcx>,
|
data: &QueryRegionConstraints<'tcx>,
|
||||||
) {
|
) {
|
||||||
debug!("constraints generated: {:#?}", data);
|
debug!("constraints generated: {:#?}", data);
|
||||||
|
@ -1158,7 +1158,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
sub: Ty<'tcx>,
|
sub: Ty<'tcx>,
|
||||||
sup: Ty<'tcx>,
|
sup: Ty<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
// Use this order of parameters because the sup type is usually the
|
// Use this order of parameters because the sup type is usually the
|
||||||
// "expected" type in diagnostics.
|
// "expected" type in diagnostics.
|
||||||
|
@ -1171,7 +1171,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
expected: Ty<'tcx>,
|
expected: Ty<'tcx>,
|
||||||
found: Ty<'tcx>,
|
found: Ty<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
self.relate_types(expected, ty::Variance::Invariant, found, locations, category)
|
self.relate_types(expected, ty::Variance::Invariant, found, locations, category)
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1183,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
v: ty::Variance,
|
v: ty::Variance,
|
||||||
user_ty: &UserTypeProjection,
|
user_ty: &UserTypeProjection,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty;
|
let annotated_type = self.user_type_annotations[user_ty.base].inferred_ty;
|
||||||
let mut curr_projected_ty = PlaceTy::from_ty(annotated_type);
|
let mut curr_projected_ty = PlaceTy::from_ty(annotated_type);
|
||||||
|
@ -1618,12 +1618,19 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
span_mirbug!(self, term, "call to {:?} with wrong # of args", sig);
|
span_mirbug!(self, term, "call to {:?} with wrong # of args", sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let func_ty = if let TerminatorKind::Call { func, .. } = &term.kind {
|
||||||
|
Some(func.ty(body, self.infcx.tcx))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
debug!(?func_ty);
|
||||||
|
|
||||||
for (n, (fn_arg, op_arg)) in iter::zip(sig.inputs(), args).enumerate() {
|
for (n, (fn_arg, op_arg)) in iter::zip(sig.inputs(), args).enumerate() {
|
||||||
let op_arg_ty = op_arg.ty(body, self.tcx());
|
let op_arg_ty = op_arg.ty(body, self.tcx());
|
||||||
|
|
||||||
let op_arg_ty = self.normalize(op_arg_ty, term_location);
|
let op_arg_ty = self.normalize(op_arg_ty, term_location);
|
||||||
let category = if from_hir_call {
|
let category = if from_hir_call {
|
||||||
ConstraintCategory::CallArgument(term_location)
|
ConstraintCategory::CallArgument(func_ty)
|
||||||
} else {
|
} else {
|
||||||
ConstraintCategory::Boring
|
ConstraintCategory::Boring
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,7 +28,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
v: ty::Variance,
|
v: ty::Variance,
|
||||||
b: Ty<'tcx>,
|
b: Ty<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
TypeRelating::new(
|
TypeRelating::new(
|
||||||
self.infcx,
|
self.infcx,
|
||||||
|
@ -45,7 +45,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
a: ty::SubstsRef<'tcx>,
|
a: ty::SubstsRef<'tcx>,
|
||||||
b: ty::SubstsRef<'tcx>,
|
b: ty::SubstsRef<'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) -> Fallible<()> {
|
) -> Fallible<()> {
|
||||||
TypeRelating::new(
|
TypeRelating::new(
|
||||||
self.infcx,
|
self.infcx,
|
||||||
|
@ -64,7 +64,7 @@ struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
|
|
||||||
/// What category do we assign the resulting `'a: 'b` relationships?
|
/// What category do we assign the resulting `'a: 'b` relationships?
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
|
|
||||||
/// Information so that error reporting knows what types we are relating
|
/// Information so that error reporting knows what types we are relating
|
||||||
/// when reporting a bound region error.
|
/// when reporting a bound region error.
|
||||||
|
@ -75,7 +75,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
|
||||||
fn new(
|
fn new(
|
||||||
type_checker: &'me mut TypeChecker<'bccx, 'tcx>,
|
type_checker: &'me mut TypeChecker<'bccx, 'tcx>,
|
||||||
locations: Locations,
|
locations: Locations,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
universe_info: UniverseInfo<'tcx>,
|
universe_info: UniverseInfo<'tcx>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self { type_checker, locations, category, universe_info }
|
Self { type_checker, locations, category, universe_info }
|
||||||
|
|
|
@ -632,7 +632,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
/// creates query region constraints.
|
/// creates query region constraints.
|
||||||
pub fn make_query_region_constraints<'tcx>(
|
pub fn make_query_region_constraints<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>, ConstraintCategory)>,
|
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>, ConstraintCategory<'tcx>)>,
|
||||||
region_constraints: &RegionConstraintData<'tcx>,
|
region_constraints: &RegionConstraintData<'tcx>,
|
||||||
) -> QueryRegionConstraints<'tcx> {
|
) -> QueryRegionConstraints<'tcx> {
|
||||||
let RegionConstraintData { constraints, verifys, givens, member_constraints } =
|
let RegionConstraintData { constraints, verifys, givens, member_constraints } =
|
||||||
|
|
|
@ -425,7 +425,7 @@ pub enum SubregionOrigin<'tcx> {
|
||||||
static_assert_size!(SubregionOrigin<'_>, 32);
|
static_assert_size!(SubregionOrigin<'_>, 32);
|
||||||
|
|
||||||
impl<'tcx> SubregionOrigin<'tcx> {
|
impl<'tcx> SubregionOrigin<'tcx> {
|
||||||
pub fn to_constraint_category(&self) -> ConstraintCategory {
|
pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> {
|
||||||
match self {
|
match self {
|
||||||
Self::Subtype(type_trace) => type_trace.cause.to_constraint_category(),
|
Self::Subtype(type_trace) => type_trace.cause.to_constraint_category(),
|
||||||
Self::AscribeUserTypeProvePredicate(span) => ConstraintCategory::Predicate(*span),
|
Self::AscribeUserTypeProvePredicate(span) => ConstraintCategory::Predicate(*span),
|
||||||
|
|
|
@ -210,7 +210,7 @@ pub trait TypeOutlivesDelegate<'tcx> {
|
||||||
origin: SubregionOrigin<'tcx>,
|
origin: SubregionOrigin<'tcx>,
|
||||||
a: ty::Region<'tcx>,
|
a: ty::Region<'tcx>,
|
||||||
b: ty::Region<'tcx>,
|
b: ty::Region<'tcx>,
|
||||||
constraint_category: ConstraintCategory,
|
constraint_category: ConstraintCategory<'tcx>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn push_verify(
|
fn push_verify(
|
||||||
|
@ -259,7 +259,7 @@ where
|
||||||
origin: infer::SubregionOrigin<'tcx>,
|
origin: infer::SubregionOrigin<'tcx>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
region: ty::Region<'tcx>,
|
region: ty::Region<'tcx>,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
assert!(!ty.has_escaping_bound_vars());
|
assert!(!ty.has_escaping_bound_vars());
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ where
|
||||||
origin: infer::SubregionOrigin<'tcx>,
|
origin: infer::SubregionOrigin<'tcx>,
|
||||||
components: &[Component<'tcx>],
|
components: &[Component<'tcx>],
|
||||||
region: ty::Region<'tcx>,
|
region: ty::Region<'tcx>,
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
for component in components.iter() {
|
for component in components.iter() {
|
||||||
let origin = origin.clone();
|
let origin = origin.clone();
|
||||||
|
@ -529,7 +529,7 @@ impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'tcx> {
|
||||||
origin: SubregionOrigin<'tcx>,
|
origin: SubregionOrigin<'tcx>,
|
||||||
a: ty::Region<'tcx>,
|
a: ty::Region<'tcx>,
|
||||||
b: ty::Region<'tcx>,
|
b: ty::Region<'tcx>,
|
||||||
_constraint_category: ConstraintCategory,
|
_constraint_category: ConstraintCategory<'tcx>,
|
||||||
) {
|
) {
|
||||||
self.sub_regions(origin, a, b)
|
self.sub_regions(origin, a, b)
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,8 +302,10 @@ impl<'tcx, V> Canonical<'tcx, V> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type QueryOutlivesConstraint<'tcx> =
|
pub type QueryOutlivesConstraint<'tcx> = (
|
||||||
(ty::Binder<'tcx, ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>>, ConstraintCategory);
|
ty::Binder<'tcx, ty::OutlivesPredicate<GenericArg<'tcx>, Region<'tcx>>>,
|
||||||
|
ConstraintCategory<'tcx>,
|
||||||
|
);
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
TrivialTypeTraversalAndLiftImpls! {
|
||||||
for <'tcx> {
|
for <'tcx> {
|
||||||
|
|
|
@ -2904,7 +2904,7 @@ fn pretty_print_const_value<'tcx>(
|
||||||
/// `Location` represents the position of the start of the statement; or, if
|
/// `Location` represents the position of the start of the statement; or, if
|
||||||
/// `statement_index` equals the number of statements, then the start of the
|
/// `statement_index` equals the number of statements, then the start of the
|
||||||
/// terminator.
|
/// terminator.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable, TyEncodable, TyDecodable)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, Ord, PartialOrd, HashStable)]
|
||||||
pub struct Location {
|
pub struct Location {
|
||||||
/// The block that the location is within.
|
/// The block that the location is within.
|
||||||
pub block: BasicBlock,
|
pub block: BasicBlock,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use smallvec::SmallVec;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
|
|
||||||
use super::{Field, Location, SourceInfo};
|
use super::{Field, SourceInfo};
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
|
#[derive(Copy, Clone, PartialEq, TyEncodable, TyDecodable, HashStable, Debug)]
|
||||||
pub enum UnsafetyViolationKind {
|
pub enum UnsafetyViolationKind {
|
||||||
|
@ -314,12 +314,12 @@ pub struct ClosureOutlivesRequirement<'tcx> {
|
||||||
pub blame_span: Span,
|
pub blame_span: Span,
|
||||||
|
|
||||||
// ... due to this reason.
|
// ... due to this reason.
|
||||||
pub category: ConstraintCategory,
|
pub category: ConstraintCategory<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure this enum doesn't unintentionally grow
|
// Make sure this enum doesn't unintentionally grow
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
rustc_data_structures::static_assert_size!(ConstraintCategory, 16);
|
rustc_data_structures::static_assert_size!(ConstraintCategory<'_>, 16);
|
||||||
|
|
||||||
/// Outlives-constraints can be categorized to determine whether and why they
|
/// Outlives-constraints can be categorized to determine whether and why they
|
||||||
/// are interesting (for error reporting). Order of variants indicates sort
|
/// are interesting (for error reporting). Order of variants indicates sort
|
||||||
|
@ -327,8 +327,8 @@ rustc_data_structures::static_assert_size!(ConstraintCategory, 16);
|
||||||
///
|
///
|
||||||
/// See also `rustc_const_eval::borrow_check::constraints`.
|
/// See also `rustc_const_eval::borrow_check::constraints`.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable)]
|
#[derive(TyEncodable, TyDecodable, HashStable, Lift, TypeVisitable, TypeFoldable)]
|
||||||
pub enum ConstraintCategory {
|
pub enum ConstraintCategory<'tcx> {
|
||||||
Return(ReturnConstraint),
|
Return(ReturnConstraint),
|
||||||
Yield,
|
Yield,
|
||||||
UseAsConst,
|
UseAsConst,
|
||||||
|
@ -342,7 +342,7 @@ pub enum ConstraintCategory {
|
||||||
ClosureBounds,
|
ClosureBounds,
|
||||||
|
|
||||||
/// Contains the function type if available.
|
/// Contains the function type if available.
|
||||||
CallArgument(Location),
|
CallArgument(Option<Ty<'tcx>>),
|
||||||
CopyBound,
|
CopyBound,
|
||||||
SizedBound,
|
SizedBound,
|
||||||
Assignment,
|
Assignment,
|
||||||
|
@ -368,10 +368,6 @@ pub enum ConstraintCategory {
|
||||||
Internal,
|
Internal,
|
||||||
}
|
}
|
||||||
|
|
||||||
TrivialTypeTraversalAndLiftImpls! {
|
|
||||||
ConstraintCategory,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash)]
|
||||||
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
|
#[derive(TyEncodable, TyDecodable, HashStable, TypeVisitable, TypeFoldable)]
|
||||||
pub enum ReturnConstraint {
|
pub enum ReturnConstraint {
|
||||||
|
|
|
@ -185,7 +185,7 @@ impl<'tcx> ObligationCause<'tcx> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_constraint_category(&self) -> ConstraintCategory {
|
pub fn to_constraint_category(&self) -> ConstraintCategory<'tcx> {
|
||||||
match self.code() {
|
match self.code() {
|
||||||
MatchImpl(cause, _) => cause.to_constraint_category(),
|
MatchImpl(cause, _) => cause.to_constraint_category(),
|
||||||
AscribeUserTypeProvePredicate(predicate_span) => {
|
AscribeUserTypeProvePredicate(predicate_span) => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0521]: borrowed data escapes outside of associated function
|
error[E0521]: borrowed data escapes outside of associated function
|
||||||
--> $DIR/issue-72312.rs:12:24
|
--> $DIR/issue-72312.rs:12:9
|
||||||
|
|
|
|
||||||
LL | pub async fn start(&self) {
|
LL | pub async fn start(&self) {
|
||||||
| -----
|
| -----
|
||||||
|
@ -7,8 +7,7 @@ LL | pub async fn start(&self) {
|
||||||
| `self` is a reference that is only valid in the associated function body
|
| `self` is a reference that is only valid in the associated function body
|
||||||
| let's call the lifetime of this reference `'1`
|
| let's call the lifetime of this reference `'1`
|
||||||
...
|
...
|
||||||
LL | require_static(async move {
|
LL | / require_static(async move {
|
||||||
| ________________________^
|
|
||||||
LL | |
|
LL | |
|
||||||
LL | |
|
LL | |
|
||||||
LL | |
|
LL | |
|
||||||
|
@ -16,7 +15,7 @@ LL | | &self;
|
||||||
LL | | });
|
LL | | });
|
||||||
| | ^
|
| | ^
|
||||||
| | |
|
| | |
|
||||||
| |_________`self` escapes the associated function body here
|
| |__________`self` escapes the associated function body here
|
||||||
| argument requires that `'1` must outlive `'static`
|
| argument requires that `'1` must outlive `'static`
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
|
@ -54,11 +54,12 @@ error[E0597]: `a` does not live long enough
|
||||||
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
|
||||||
|
|
|
|
||||||
LL | let cell = Cell::new(&a);
|
LL | let cell = Cell::new(&a);
|
||||||
| ----------^^-
|
| ^^ borrowed value does not live long enough
|
||||||
| | |
|
|
||||||
| | borrowed value does not live long enough
|
|
||||||
| argument requires that `a` is borrowed for `'static`
|
|
||||||
...
|
...
|
||||||
|
LL | / foo(cell, |cell_a, cell_x| {
|
||||||
|
LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
|
||||||
|
LL | | })
|
||||||
|
| |______- argument requires that `a` is borrowed for `'static`
|
||||||
LL | }
|
LL | }
|
||||||
| - `a` dropped here while still borrowed
|
| - `a` dropped here while still borrowed
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
error[E0597]: `c` does not live long enough
|
error[E0597]: `c` does not live long enough
|
||||||
--> $DIR/adt-nullary-enums.rs:33:41
|
--> $DIR/adt-nullary-enums.rs:33:41
|
||||||
|
|
|
|
||||||
LL | SomeEnum::SomeVariant(Cell::new(&c)),
|
LL | / combine(
|
||||||
| ----------^^-
|
LL | | SomeEnum::SomeVariant(Cell::new(&c)),
|
||||||
| | |
|
| | ^^ borrowed value does not live long enough
|
||||||
| | borrowed value does not live long enough
|
LL | | SomeEnum::SomeOtherVariant::<Cell<&'static u32>>,
|
||||||
| argument requires that `c` is borrowed for `'static`
|
LL | | );
|
||||||
...
|
| |_____- argument requires that `c` is borrowed for `'static`
|
||||||
LL | }
|
LL | }
|
||||||
| - `c` dropped here while still borrowed
|
| - `c` dropped here while still borrowed
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue