diff --git a/Cargo.lock b/Cargo.lock index 1acbcb00f65d6..4d6530508b3d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -891,11 +891,11 @@ dependencies = [ "diff", "getopts", "glob", - "lazy_static", "lazycell", "libc", - "miow 0.3.7", + "miow 0.5.0", "miropt-test-tools", + "once_cell", "regex", "rustfix", "serde", diff --git a/compiler/rustc_borrowck/src/constraints/mod.rs b/compiler/rustc_borrowck/src/constraints/mod.rs index 1f0b8adeaf16c..f370c02161b11 100644 --- a/compiler/rustc_borrowck/src/constraints/mod.rs +++ b/compiler/rustc_borrowck/src/constraints/mod.rs @@ -17,7 +17,7 @@ pub(crate) mod graph; /// constraints of the form `R1: R2`. Each constraint is identified by /// a unique `OutlivesConstraintIndex` and you can index into the set /// (`constraint_set[i]`) to access the constraint details. -#[derive(Clone, Default)] +#[derive(Clone, Debug, Default)] pub(crate) struct OutlivesConstraintSet<'tcx> { outlives: IndexVec>, } diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 98103af779d8b..622b57c7b7f2b 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -25,7 +25,9 @@ use rustc_hir as hir; use rustc_hir::def_id::LocalDefId; use rustc_index::bit_set::ChunkedBitSet; use rustc_index::vec::IndexVec; -use rustc_infer::infer::{DefiningAnchor, InferCtxt, TyCtxtInferExt}; +use rustc_infer::infer::{ + DefiningAnchor, InferCtxt, NllRegionVariableOrigin, RegionVariableOrigin, TyCtxtInferExt, +}; use rustc_middle::mir::{ traversal, Body, ClearCrossCrate, Local, Location, Mutability, NonDivergingIntrinsic, Operand, Place, PlaceElem, PlaceRef, VarDebugInfoContents, @@ -43,6 +45,7 @@ use smallvec::SmallVec; use std::cell::OnceCell; use std::cell::RefCell; use std::collections::BTreeMap; +use std::ops::Deref; use std::rc::Rc; use rustc_mir_dataflow::impls::{ @@ -94,6 +97,7 @@ use nll::{PoloniusOutput, ToRegionVid}; use place_ext::PlaceExt; use places_conflict::{places_conflict, PlaceConflictBias}; use region_infer::RegionInferenceContext; +use renumber::RegionCtxt; // FIXME(eddyb) perhaps move this somewhere more centrally. #[derive(Debug)] @@ -167,10 +171,10 @@ fn do_mir_borrowck<'tcx>( return_body_with_facts: bool, ) -> (BorrowCheckResult<'tcx>, Option>>) { let def = input_body.source.with_opt_param().as_local().unwrap(); - debug!(?def); let tcx = infcx.tcx; + let infcx = BorrowckInferCtxt::new(infcx); let param_env = tcx.param_env(def.did); let mut local_names = IndexVec::from_elem(None, &input_body.local_decls); @@ -218,7 +222,7 @@ fn do_mir_borrowck<'tcx>( let mut body_owned = input_body.clone(); let mut promoted = input_promoted.clone(); let free_regions = - nll::replace_regions_in_mir(infcx, param_env, &mut body_owned, &mut promoted); + nll::replace_regions_in_mir(&infcx, param_env, &mut body_owned, &mut promoted); let body = &body_owned; // no further changes let location_table_owned = LocationTable::new(body); @@ -256,7 +260,7 @@ fn do_mir_borrowck<'tcx>( opt_closure_req, nll_errors, } = nll::compute_regions( - infcx, + &infcx, free_regions, body, &promoted, @@ -271,12 +275,12 @@ fn do_mir_borrowck<'tcx>( // Dump MIR results into a file, if that is enabled. This let us // write unit-tests, as well as helping with debugging. - nll::dump_mir_results(infcx, &body, ®ioncx, &opt_closure_req); + nll::dump_mir_results(&infcx, &body, ®ioncx, &opt_closure_req); // We also have a `#[rustc_regions]` annotation that causes us to dump // information. nll::dump_annotation( - infcx, + &infcx, &body, ®ioncx, &opt_closure_req, @@ -320,7 +324,7 @@ fn do_mir_borrowck<'tcx>( if let Err((move_data, move_errors)) = move_data_results { let mut promoted_mbcx = MirBorrowckCtxt { - infcx, + infcx: &infcx, param_env, body: promoted_body, move_data: &move_data, @@ -349,7 +353,7 @@ fn do_mir_borrowck<'tcx>( } let mut mbcx = MirBorrowckCtxt { - infcx, + infcx: &infcx, param_env, body, move_data: &mdpe.move_data, @@ -481,8 +485,84 @@ pub struct BodyWithBorrowckFacts<'tcx> { pub location_table: LocationTable, } +pub struct BorrowckInferCtxt<'cx, 'tcx> { + pub(crate) infcx: &'cx InferCtxt<'tcx>, + pub(crate) reg_var_to_origin: RefCell>, +} + +impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> { + pub(crate) fn new(infcx: &'cx InferCtxt<'tcx>) -> Self { + BorrowckInferCtxt { infcx, reg_var_to_origin: RefCell::new(Default::default()) } + } + + pub(crate) fn next_region_var( + &self, + origin: RegionVariableOrigin, + get_ctxt_fn: F, + ) -> ty::Region<'tcx> + where + F: Fn() -> RegionCtxt, + { + let next_region = self.infcx.next_region_var(origin); + let vid = next_region + .as_var() + .unwrap_or_else(|| bug!("expected RegionKind::RegionVar on {:?}", next_region)); + + if cfg!(debug_assertions) { + debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin); + let ctxt = get_ctxt_fn(); + let mut var_to_origin = self.reg_var_to_origin.borrow_mut(); + let prev = var_to_origin.insert(vid, ctxt); + + // This only makes sense if not called in a canonicalization context. If this + // ever changes we either want to get rid of `BorrowckInferContext::reg_var_to_origin` + // or modify how we track nll region vars for that map. + assert!(matches!(prev, None)); + } + + next_region + } + + #[instrument(skip(self, get_ctxt_fn), level = "debug")] + pub(crate) fn next_nll_region_var( + &self, + origin: NllRegionVariableOrigin, + get_ctxt_fn: F, + ) -> ty::Region<'tcx> + where + F: Fn() -> RegionCtxt, + { + let next_region = self.infcx.next_nll_region_var(origin.clone()); + let vid = next_region + .as_var() + .unwrap_or_else(|| bug!("expected RegionKind::RegionVar on {:?}", next_region)); + + if cfg!(debug_assertions) { + debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin); + let ctxt = get_ctxt_fn(); + let mut var_to_origin = self.reg_var_to_origin.borrow_mut(); + let prev = var_to_origin.insert(vid, ctxt); + + // This only makes sense if not called in a canonicalization context. If this + // ever changes we either want to get rid of `BorrowckInferContext::reg_var_to_origin` + // or modify how we track nll region vars for that map. + assert!(matches!(prev, None)); + } + + next_region + } +} + +impl<'cx, 'tcx> Deref for BorrowckInferCtxt<'cx, 'tcx> { + type Target = InferCtxt<'tcx>; + + fn deref(&self) -> &'cx Self::Target { + self.infcx + } +} + struct MirBorrowckCtxt<'cx, 'tcx> { - infcx: &'cx InferCtxt<'tcx>, + infcx: &'cx BorrowckInferCtxt<'cx, 'tcx>, param_env: ParamEnv<'tcx>, body: &'cx Body<'tcx>, move_data: &'cx MoveData<'tcx>, diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index c71413e8e7c04..e5dbb83dd0728 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -5,7 +5,6 @@ use rustc_data_structures::vec_map::VecMap; use rustc_hir::def_id::LocalDefId; use rustc_index::vec::IndexVec; -use rustc_infer::infer::InferCtxt; use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere}; use rustc_middle::mir::{ BasicBlock, Body, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind, Location, @@ -37,7 +36,7 @@ use crate::{ renumber, type_check::{self, MirTypeckRegionConstraints, MirTypeckResults}, universal_regions::UniversalRegions, - Upvar, + BorrowckInferCtxt, Upvar, }; pub type PoloniusOutput = Output; @@ -58,7 +57,7 @@ pub(crate) struct NllOutput<'tcx> { /// `compute_regions`. #[instrument(skip(infcx, param_env, body, promoted), level = "debug")] pub(crate) fn replace_regions_in_mir<'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, param_env: ty::ParamEnv<'tcx>, body: &mut Body<'tcx>, promoted: &mut IndexVec>, @@ -157,7 +156,7 @@ fn populate_polonius_move_facts( /// /// This may result in errors being reported. pub(crate) fn compute_regions<'cx, 'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, universal_regions: UniversalRegions<'tcx>, body: &Body<'tcx>, promoted: &IndexVec>, @@ -259,6 +258,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>( ); let mut regioncx = RegionInferenceContext::new( + infcx, var_origins, universal_regions, placeholder_indices, @@ -322,7 +322,7 @@ pub(crate) fn compute_regions<'cx, 'tcx>( } pub(super) fn dump_mir_results<'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, body: &Body<'tcx>, regioncx: &RegionInferenceContext<'tcx>, closure_region_requirements: &Option>, @@ -372,7 +372,7 @@ pub(super) fn dump_mir_results<'tcx>( #[allow(rustc::diagnostic_outside_of_impl)] #[allow(rustc::untranslatable_diagnostic)] pub(super) fn dump_annotation<'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, body: &Body<'tcx>, regioncx: &RegionInferenceContext<'tcx>, closure_region_requirements: &Option>, diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index 83fdb6066c6b4..8c374c2164c7b 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -34,6 +34,7 @@ use crate::{ }, type_check::{free_region_relations::UniversalRegionRelations, Locations}, universal_regions::UniversalRegions, + BorrowckInferCtxt, }; mod dump_mir; @@ -243,6 +244,70 @@ pub enum ExtraConstraintInfo { PlaceholderFromPredicate(Span), } +#[instrument(skip(infcx, sccs), level = "debug")] +fn sccs_info<'cx, 'tcx>( + infcx: &'cx BorrowckInferCtxt<'cx, 'tcx>, + sccs: Rc>, +) { + use crate::renumber::RegionCtxt; + + let var_to_origin = infcx.reg_var_to_origin.borrow(); + + let mut var_to_origin_sorted = var_to_origin.clone().into_iter().collect::>(); + var_to_origin_sorted.sort_by(|a, b| a.0.cmp(&b.0)); + let mut debug_str = "region variables to origins:\n".to_string(); + for (reg_var, origin) in var_to_origin_sorted.into_iter() { + debug_str.push_str(&format!("{:?}: {:?}\n", reg_var, origin)); + } + debug!(debug_str); + + let num_components = sccs.scc_data().ranges().len(); + let mut components = vec![FxHashSet::default(); num_components]; + + for (reg_var_idx, scc_idx) in sccs.scc_indices().iter().enumerate() { + let reg_var = ty::RegionVid::from_usize(reg_var_idx); + let origin = var_to_origin.get(®_var).unwrap_or_else(|| &RegionCtxt::Unknown); + components[scc_idx.as_usize()].insert((reg_var, *origin)); + } + + let mut components_str = "strongly connected components:".to_string(); + for (scc_idx, reg_vars_origins) in components.iter().enumerate() { + let regions_info = reg_vars_origins.clone().into_iter().collect::>(); + components_str.push_str(&format!( + "{:?}: {:?})", + ConstraintSccIndex::from_usize(scc_idx), + regions_info, + )) + } + debug!(components_str); + + // calculate the best representative for each component + let components_representatives = components + .into_iter() + .enumerate() + .map(|(scc_idx, region_ctxts)| { + let repr = region_ctxts + .into_iter() + .map(|reg_var_origin| reg_var_origin.1) + .max_by(|x, y| x.preference_value().cmp(&y.preference_value())) + .unwrap(); + + (ConstraintSccIndex::from_usize(scc_idx), repr) + }) + .collect::>(); + + let mut scc_node_to_edges = FxHashMap::default(); + for (scc_idx, repr) in components_representatives.iter() { + let edges_range = sccs.scc_data().ranges()[*scc_idx].clone(); + let edges = &sccs.scc_data().all_successors()[edges_range]; + let edge_representatives = + edges.iter().map(|scc_idx| components_representatives[scc_idx]).collect::>(); + scc_node_to_edges.insert((scc_idx, repr), edge_representatives); + } + + debug!("SCC edges {:#?}", scc_node_to_edges); +} + impl<'tcx> RegionInferenceContext<'tcx> { /// Creates a new region inference context with a total of /// `num_region_variables` valid inference variables; the first N @@ -251,7 +316,8 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// /// The `outlives_constraints` and `type_tests` are an initial set /// of constraints produced by the MIR type check. - pub(crate) fn new( + pub(crate) fn new<'cx>( + _infcx: &BorrowckInferCtxt<'cx, 'tcx>, var_infos: VarInfos, universal_regions: Rc>, placeholder_indices: Rc, @@ -263,6 +329,11 @@ impl<'tcx> RegionInferenceContext<'tcx> { liveness_constraints: LivenessValues, elements: &Rc, ) -> Self { + debug!("universal_regions: {:#?}", universal_regions); + debug!("outlives constraints: {:#?}", outlives_constraints); + debug!("placeholder_indices: {:#?}", placeholder_indices); + debug!("type tests: {:#?}", type_tests); + // Create a RegionDefinition for each inference variable. let definitions: IndexVec<_, _> = var_infos .iter() @@ -274,6 +345,10 @@ impl<'tcx> RegionInferenceContext<'tcx> { let fr_static = universal_regions.fr_static; let constraint_sccs = Rc::new(constraints.compute_sccs(&constraint_graph, fr_static)); + if cfg!(debug_assertions) { + sccs_info(_infcx, constraint_sccs.clone()); + } + let mut scc_values = RegionValues::new(elements, universal_regions.len(), &placeholder_indices); diff --git a/compiler/rustc_borrowck/src/region_infer/values.rs b/compiler/rustc_borrowck/src/region_infer/values.rs index 6a3748fded554..c361357ca2134 100644 --- a/compiler/rustc_borrowck/src/region_infer/values.rs +++ b/compiler/rustc_borrowck/src/region_infer/values.rs @@ -181,7 +181,7 @@ impl LivenessValues { /// Maps from `ty::PlaceholderRegion` values that are used in the rest of /// rustc to the internal `PlaceholderIndex` values that are used in /// NLL. -#[derive(Default)] +#[derive(Debug, Default)] pub(crate) struct PlaceholderIndices { indices: FxIndexSet, } diff --git a/compiler/rustc_borrowck/src/renumber.rs b/compiler/rustc_borrowck/src/renumber.rs index 084754830bdbf..960dedc74efbb 100644 --- a/compiler/rustc_borrowck/src/renumber.rs +++ b/compiler/rustc_borrowck/src/renumber.rs @@ -1,18 +1,20 @@ #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] +use crate::BorrowckInferCtxt; use rustc_index::vec::IndexVec; -use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin}; +use rustc_infer::infer::NllRegionVariableOrigin; use rustc_middle::mir::visit::{MutVisitor, TyContext}; use rustc_middle::mir::Constant; use rustc_middle::mir::{Body, Location, Promoted}; use rustc_middle::ty::subst::SubstsRef; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable}; +use rustc_span::{Span, Symbol}; /// Replaces all free regions appearing in the MIR with fresh /// inference variables, returning the number of variables created. #[instrument(skip(infcx, body, promoted), level = "debug")] pub fn renumber_mir<'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, body: &mut Body<'tcx>, promoted: &mut IndexVec>, ) { @@ -29,27 +31,68 @@ pub fn renumber_mir<'tcx>( /// Replaces all regions appearing in `value` with fresh inference /// variables. -#[instrument(skip(infcx), level = "debug")] -pub fn renumber_regions<'tcx, T>(infcx: &InferCtxt<'tcx>, value: T) -> T +#[instrument(skip(infcx, get_ctxt_fn), level = "debug")] +pub(crate) fn renumber_regions<'tcx, T, F>( + infcx: &BorrowckInferCtxt<'_, 'tcx>, + value: T, + get_ctxt_fn: F, +) -> T where T: TypeFoldable<'tcx>, + F: Fn() -> RegionCtxt, { infcx.tcx.fold_regions(value, |_region, _depth| { let origin = NllRegionVariableOrigin::Existential { from_forall: false }; - infcx.next_nll_region_var(origin) + infcx.next_nll_region_var(origin, || get_ctxt_fn()) }) } +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub(crate) enum BoundRegionInfo { + Name(Symbol), + Span(Span), +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] +pub(crate) enum RegionCtxt { + Location(Location), + TyContext(TyContext), + Free(Symbol), + Bound(BoundRegionInfo), + LateBound(BoundRegionInfo), + Existential(Option), + Placeholder(BoundRegionInfo), + Unknown, +} + +impl RegionCtxt { + /// Used to determine the representative of a component in the strongly connected + /// constraint graph + pub(crate) fn preference_value(self) -> usize { + let _anon = Symbol::intern("anon"); + + match self { + RegionCtxt::Unknown => 1, + RegionCtxt::Existential(None) => 2, + RegionCtxt::Existential(Some(_anon)) | RegionCtxt::Free(_anon) => 2, + RegionCtxt::Location(_) => 3, + RegionCtxt::TyContext(_) => 4, + _ => 5, + } + } +} + struct NllVisitor<'a, 'tcx> { - infcx: &'a InferCtxt<'tcx>, + infcx: &'a BorrowckInferCtxt<'a, 'tcx>, } impl<'a, 'tcx> NllVisitor<'a, 'tcx> { - fn renumber_regions(&mut self, value: T) -> T + fn renumber_regions(&mut self, value: T, region_ctxt_fn: F) -> T where T: TypeFoldable<'tcx>, + F: Fn() -> RegionCtxt, { - renumber_regions(self.infcx, value) + renumber_regions(self.infcx, value, region_ctxt_fn) } } @@ -60,14 +103,14 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> { #[instrument(skip(self), level = "debug")] fn visit_ty(&mut self, ty: &mut Ty<'tcx>, ty_context: TyContext) { - *ty = self.renumber_regions(*ty); + *ty = self.renumber_regions(*ty, || RegionCtxt::TyContext(ty_context)); debug!(?ty); } #[instrument(skip(self), level = "debug")] fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) { - *substs = self.renumber_regions(*substs); + *substs = self.renumber_regions(*substs, || RegionCtxt::Location(location)); debug!(?substs); } @@ -75,7 +118,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> { #[instrument(skip(self), level = "debug")] fn visit_region(&mut self, region: &mut ty::Region<'tcx>, location: Location) { let old_region = *region; - *region = self.renumber_regions(old_region); + *region = self.renumber_regions(old_region, || RegionCtxt::Location(location)); debug!(?region); } @@ -83,7 +126,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> { #[instrument(skip(self), level = "debug")] fn visit_constant(&mut self, constant: &mut Constant<'tcx>, _location: Location) { let literal = constant.literal; - constant.literal = self.renumber_regions(literal); + constant.literal = self.renumber_regions(literal, || RegionCtxt::Location(_location)); debug!("constant: {:#?}", constant); } } diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index 5e1334559f5f3..f14f8f1906be7 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -64,7 +64,7 @@ use crate::{ region_infer::TypeTest, type_check::free_region_relations::{CreateResult, UniversalRegionRelations}, universal_regions::{DefiningTy, UniversalRegions}, - Upvar, + BorrowckInferCtxt, Upvar, }; macro_rules! span_mirbug { @@ -123,7 +123,7 @@ mod relate_tys; /// - `move_data` -- move-data constructed when performing the maybe-init dataflow analysis /// - `elements` -- MIR region map pub(crate) fn type_check<'mir, 'tcx>( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, param_env: ty::ParamEnv<'tcx>, body: &Body<'tcx>, promoted: &IndexVec>, @@ -866,7 +866,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> { /// way, it accrues region constraints -- these can later be used by /// NLL region checking. struct TypeChecker<'a, 'tcx> { - infcx: &'a InferCtxt<'tcx>, + infcx: &'a BorrowckInferCtxt<'a, 'tcx>, param_env: ty::ParamEnv<'tcx>, last_span: Span, body: &'a Body<'tcx>, @@ -1019,7 +1019,7 @@ impl Locations { impl<'a, 'tcx> TypeChecker<'a, 'tcx> { fn new( - infcx: &'a InferCtxt<'tcx>, + infcx: &'a BorrowckInferCtxt<'a, 'tcx>, body: &'a Body<'tcx>, param_env: ty::ParamEnv<'tcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, @@ -1356,11 +1356,34 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { } }; let (sig, map) = tcx.replace_late_bound_regions(sig, |br| { - self.infcx.next_region_var(LateBoundRegion( - term.source_info.span, - br.kind, - LateBoundRegionConversionTime::FnCall, - )) + use crate::renumber::{BoundRegionInfo, RegionCtxt}; + use rustc_span::Symbol; + + let region_ctxt_fn = || { + let reg_info = match br.kind { + ty::BoundRegionKind::BrAnon(_, Some(span)) => { + BoundRegionInfo::Span(span) + } + ty::BoundRegionKind::BrAnon(..) => { + BoundRegionInfo::Name(Symbol::intern("anon")) + } + ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name), + ty::BoundRegionKind::BrEnv => { + BoundRegionInfo::Name(Symbol::intern("env")) + } + }; + + RegionCtxt::LateBound(reg_info) + }; + + self.infcx.next_region_var( + LateBoundRegion( + term.source_info.span, + br.kind, + LateBoundRegionConversionTime::FnCall, + ), + region_ctxt_fn, + ) }); debug!(?sig); // IMPORTANT: We have to prove well formed for the function signature before diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index 8dd06187877c8..d96372fb99baa 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -4,11 +4,12 @@ use rustc_infer::traits::PredicateObligations; use rustc_middle::mir::ConstraintCategory; use rustc_middle::ty::relate::TypeRelation; use rustc_middle::ty::{self, Ty}; -use rustc_span::Span; +use rustc_span::{Span, Symbol}; use rustc_trait_selection::traits::query::Fallible; use crate::constraints::OutlivesConstraint; use crate::diagnostics::UniverseInfo; +use crate::renumber::{BoundRegionInfo, RegionCtxt}; use crate::type_check::{InstantiateOpaqueType, Locations, TypeChecker}; impl<'a, 'tcx> TypeChecker<'a, 'tcx> { @@ -100,23 +101,65 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> universe } - fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> { + #[instrument(skip(self), level = "debug")] + fn next_existential_region_var( + &mut self, + from_forall: bool, + _name: Option, + ) -> ty::Region<'tcx> { let origin = NllRegionVariableOrigin::Existential { from_forall }; - self.type_checker.infcx.next_nll_region_var(origin) + + let reg_var = + self.type_checker.infcx.next_nll_region_var(origin, || RegionCtxt::Existential(_name)); + + reg_var } + #[instrument(skip(self), level = "debug")] fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx> { - self.type_checker + let reg = self + .type_checker .borrowck_context .constraints - .placeholder_region(self.type_checker.infcx, placeholder) + .placeholder_region(self.type_checker.infcx, placeholder); + + let reg_info = match placeholder.name { + ty::BoundRegionKind::BrAnon(_, Some(span)) => BoundRegionInfo::Span(span), + ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(Symbol::intern("anon")), + ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name), + ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(Symbol::intern("env")), + }; + + let reg_var = + reg.as_var().unwrap_or_else(|| bug!("expected region {:?} to be of kind ReVar", reg)); + let mut var_to_origin = self.type_checker.infcx.reg_var_to_origin.borrow_mut(); + let prev = var_to_origin.insert(reg_var, RegionCtxt::Placeholder(reg_info)); + assert!(matches!(prev, None)); + + reg } + #[instrument(skip(self), level = "debug")] fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> { - self.type_checker.infcx.next_nll_region_var_in_universe( + let reg = self.type_checker.infcx.next_nll_region_var_in_universe( NllRegionVariableOrigin::Existential { from_forall: false }, universe, - ) + ); + + let reg_var = + reg.as_var().unwrap_or_else(|| bug!("expected region {:?} to be of kind ReVar", reg)); + + if cfg!(debug_assertions) { + let mut var_to_origin = self.type_checker.infcx.reg_var_to_origin.borrow_mut(); + let prev = var_to_origin.insert(reg_var, RegionCtxt::Existential(None)); + + // It only makes sense to track region vars in non-canonicalization contexts. If this + // ever changes we either want to get rid of `BorrowckInferContext::reg_var_to_origin` + // or modify how we track nll region vars for that map. + assert!(matches!(prev, None)); + } + + reg } fn push_outlives( diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index efa5a29c5ddf1..f3ca896cd0de1 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -20,15 +20,18 @@ use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::lang_items::LangItem; use rustc_hir::{BodyOwnerKind, HirId}; use rustc_index::vec::{Idx, IndexVec}; -use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin}; +use rustc_infer::infer::NllRegionVariableOrigin; use rustc_middle::ty::fold::TypeFoldable; use rustc_middle::ty::{ self, DefIdTree, InlineConstSubsts, InlineConstSubstsParts, RegionVid, Ty, TyCtxt, }; use rustc_middle::ty::{InternalSubsts, SubstsRef}; +use rustc_span::Symbol; use std::iter; use crate::nll::ToRegionVid; +use crate::renumber::{BoundRegionInfo, RegionCtxt}; +use crate::BorrowckInferCtxt; #[derive(Debug)] pub struct UniversalRegions<'tcx> { @@ -224,7 +227,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// signature. This will also compute the relationships that are /// known between those regions. pub fn new( - infcx: &InferCtxt<'tcx>, + infcx: &BorrowckInferCtxt<'_, 'tcx>, mir_def: ty::WithOptConstParam, param_env: ty::ParamEnv<'tcx>, ) -> Self { @@ -385,7 +388,7 @@ impl<'tcx> UniversalRegions<'tcx> { } struct UniversalRegionsBuilder<'cx, 'tcx> { - infcx: &'cx InferCtxt<'tcx>, + infcx: &'cx BorrowckInferCtxt<'cx, 'tcx>, mir_def: ty::WithOptConstParam, mir_hir_id: HirId, param_env: ty::ParamEnv<'tcx>, @@ -403,7 +406,10 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { assert_eq!(FIRST_GLOBAL_INDEX, self.infcx.num_region_vars()); // Create the "global" region that is always free in all contexts: 'static. - let fr_static = self.infcx.next_nll_region_var(FR).to_region_vid(); + let fr_static = self + .infcx + .next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("static"))) + .to_region_vid(); // We've now added all the global regions. The next ones we // add will be external. @@ -435,7 +441,17 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { |r| { debug!(?r); if !indices.indices.contains_key(&r) { - let region_vid = self.infcx.next_nll_region_var(FR); + let region_vid = { + let name = match r.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + + self.infcx.next_nll_region_var(FR, || { + RegionCtxt::LateBound(BoundRegionInfo::Name(name)) + }) + }; + debug!(?region_vid); indices.insert_late_bound_region(r, region_vid.to_region_vid()); } @@ -463,7 +479,17 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { for_each_late_bound_region_in_item(self.infcx.tcx, self.mir_def.did, |r| { debug!(?r); if !indices.indices.contains_key(&r) { - let region_vid = self.infcx.next_nll_region_var(FR); + let region_vid = { + let name = match r.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + + self.infcx.next_nll_region_var(FR, || { + RegionCtxt::LateBound(BoundRegionInfo::Name(name)) + }) + }; + debug!(?region_vid); indices.insert_late_bound_region(r, region_vid.to_region_vid()); } @@ -480,8 +506,13 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { LangItem::VaList, Some(self.infcx.tcx.def_span(self.mir_def.did)), ); - let region = - self.infcx.tcx.mk_re_var(self.infcx.next_nll_region_var(FR).to_region_vid()); + + let reg_vid = self + .infcx + .next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("c-variadic"))) + .to_region_vid(); + + let region = self.infcx.tcx.mk_re_var(reg_vid); let va_list_ty = self.infcx.tcx.type_of(va_list_did).subst(self.infcx.tcx, &[region.into()]); @@ -491,7 +522,11 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { } } - let fr_fn_body = self.infcx.next_nll_region_var(FR).to_region_vid(); + let fr_fn_body = self + .infcx + .next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("fn_body"))) + .to_region_vid(); + let num_universals = self.infcx.num_region_vars(); debug!("build: global regions = {}..{}", FIRST_GLOBAL_INDEX, first_extern_index); @@ -718,7 +753,8 @@ trait InferCtxtExt<'tcx> { ); } -impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { +impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> { + #[instrument(skip(self), level = "debug")] fn replace_free_regions_with_nll_infer_vars( &self, origin: NllRegionVariableOrigin, @@ -727,7 +763,17 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { where T: TypeFoldable<'tcx>, { - self.tcx.fold_regions(value, |_region, _depth| self.next_nll_region_var(origin)) + self.infcx.tcx.fold_regions(value, |region, _depth| { + let name = match region.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + debug!(?region, ?name); + + let reg_var = self.next_nll_region_var(origin, || RegionCtxt::Free(name)); + + reg_var + }) } #[instrument(level = "debug", skip(self, indices))] @@ -744,7 +790,15 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { let (value, _map) = self.tcx.replace_late_bound_regions(value, |br| { debug!(?br); let liberated_region = self.tcx.mk_re_free(all_outlive_scope.to_def_id(), br.kind); - let region_vid = self.next_nll_region_var(origin); + let region_vid = { + let name = match br.kind.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + + self.next_nll_region_var(origin, || RegionCtxt::Bound(BoundRegionInfo::Name(name))) + }; + indices.insert_late_bound_region(liberated_region, region_vid.to_region_vid()); debug!(?liberated_region, ?region_vid); region_vid @@ -770,7 +824,17 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { for_each_late_bound_region_in_recursive_scope(self.tcx, mir_def_id, |r| { debug!(?r); if !indices.indices.contains_key(&r) { - let region_vid = self.next_nll_region_var(FR); + let region_vid = { + let name = match r.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + + self.next_nll_region_var(FR, || { + RegionCtxt::LateBound(BoundRegionInfo::Name(name)) + }) + }; + debug!(?region_vid); indices.insert_late_bound_region(r, region_vid.to_region_vid()); } @@ -786,8 +850,17 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { for_each_late_bound_region_in_item(self.tcx, mir_def_id, |r| { debug!(?r); if !indices.indices.contains_key(&r) { - let region_vid = self.next_nll_region_var(FR); - debug!(?region_vid); + let region_vid = { + let name = match r.get_name() { + Some(name) => name, + _ => Symbol::intern("anon"), + }; + + self.next_nll_region_var(FR, || { + RegionCtxt::LateBound(BoundRegionInfo::Name(name)) + }) + }; + indices.insert_late_bound_region(r, region_vid.to_region_vid()); } }); diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs index c8e66eb672cc2..c4b11951ab7a0 100644 --- a/compiler/rustc_data_structures/src/graph/scc/mod.rs +++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs @@ -27,7 +27,7 @@ pub struct Sccs { scc_data: SccData, } -struct SccData { +pub struct SccData { /// For each SCC, the range of `all_successors` where its /// successors can be found. ranges: IndexVec>, @@ -43,6 +43,14 @@ impl Sccs { SccsConstruction::construct(graph) } + pub fn scc_indices(&self) -> &IndexVec { + &self.scc_indices + } + + pub fn scc_data(&self) -> &SccData { + &self.scc_data + } + /// Returns the number of SCCs in the graph. pub fn num_sccs(&self) -> usize { self.scc_data.len() @@ -115,6 +123,14 @@ impl SccData { self.ranges.len() } + pub fn ranges(&self) -> &IndexVec> { + &self.ranges + } + + pub fn all_successors(&self) -> &Vec { + &self.all_successors + } + /// Returns the successors of the given SCC. fn successors(&self, scc: S) -> &[S] { // Annoyingly, `range` does not implement `Copy`, so we have diff --git a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl index 41f458f6c1785..f8d28817fec88 100644 --- a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl +++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl @@ -124,3 +124,6 @@ hir_analysis_linkage_type = hir_analysis_auto_deref_reached_recursion_limit = reached the recursion limit while auto-dereferencing `{$ty}` .label = deref recursion limit reached .help = consider increasing the recursion limit by adding a `#![recursion_limit = "{$suggested_limit}"]` attribute to your crate (`{$crate_name}`) + +hir_analysis_track_caller_on_main = `main` function is not allowed to be `#[track_caller]` + .label = `main` function is not allowed to be `#[track_caller]` diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 04f5f3f62765a..f3c3c02a05f3f 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -312,3 +312,12 @@ pub struct AutoDerefReachedRecursionLimit<'a> { pub suggested_limit: rustc_session::Limit, pub crate_name: Symbol, } + +#[derive(Diagnostic)] +#[diag(hir_analysis_track_caller_on_main)] +pub(crate) struct TrackCallerOnMain { + #[primary_span] + pub span: Span, + #[label] + pub annotated: Span, +} diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index 11240cf22e4b1..73a7137666264 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -297,10 +297,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) { } for attr in tcx.get_attrs(main_def_id, sym::track_caller) { - tcx.sess - .struct_span_err(attr.span, "`main` function is not allowed to be `#[track_caller]`") - .span_label(main_span, "`main` function is not allowed to be `#[track_caller]`") - .emit(); + tcx.sess.emit_err(errors::TrackCallerOnMain { span: attr.span, annotated: main_span }); error = true; } diff --git a/compiler/rustc_infer/src/infer/canonical/query_response.rs b/compiler/rustc_infer/src/infer/canonical/query_response.rs index b9cb9732ca3ed..e993fb4c22bb9 100644 --- a/compiler/rustc_infer/src/infer/canonical/query_response.rs +++ b/compiler/rustc_infer/src/infer/canonical/query_response.rs @@ -27,7 +27,7 @@ use rustc_middle::ty::fold::TypeFoldable; use rustc_middle::ty::relate::TypeRelation; use rustc_middle::ty::subst::{GenericArg, GenericArgKind}; use rustc_middle::ty::{self, BoundVar, ToPredicate, Ty, TyCtxt}; -use rustc_span::Span; +use rustc_span::{Span, Symbol}; use std::fmt::Debug; use std::iter; @@ -683,7 +683,11 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> { self.infcx.create_next_universe() } - fn next_existential_region_var(&mut self, from_forall: bool) -> ty::Region<'tcx> { + fn next_existential_region_var( + &mut self, + from_forall: bool, + _name: Option, + ) -> ty::Region<'tcx> { let origin = NllRegionVariableOrigin::Existential { from_forall }; self.infcx.next_nll_region_var(origin) } diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 2dd57e4c039af..29c9af5c43fb9 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -1111,11 +1111,13 @@ impl<'tcx> InferCtxt<'tcx> { } /// Just a convenient wrapper of `next_region_var` for using during NLL. + #[instrument(skip(self), level = "debug")] pub fn next_nll_region_var(&self, origin: NllRegionVariableOrigin) -> ty::Region<'tcx> { self.next_region_var(RegionVariableOrigin::Nll(origin)) } /// Just a convenient wrapper of `next_region_var` for using during NLL. + #[instrument(skip(self), level = "debug")] pub fn next_nll_region_var_in_universe( &self, origin: NllRegionVariableOrigin, diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs index 644774c93c2a4..954334e88b0cb 100644 --- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs +++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs @@ -31,7 +31,7 @@ use rustc_middle::ty::error::TypeError; use rustc_middle::ty::relate::{self, Relate, RelateResult, TypeRelation}; use rustc_middle::ty::visit::{ir::TypeVisitor, TypeSuperVisitable, TypeVisitable}; use rustc_middle::ty::{self, InferConst, Ty, TyCtxt}; -use rustc_span::Span; +use rustc_span::{Span, Symbol}; use std::fmt::Debug; use std::ops::ControlFlow; @@ -100,7 +100,11 @@ pub trait TypeRelatingDelegate<'tcx> { /// we will invoke this method to instantiate `'a` with an /// inference variable (though `'b` would be instantiated first, /// as a placeholder). - fn next_existential_region_var(&mut self, was_placeholder: bool) -> ty::Region<'tcx>; + fn next_existential_region_var( + &mut self, + was_placeholder: bool, + name: Option, + ) -> ty::Region<'tcx>; /// Creates a new region variable representing a /// higher-ranked region that is instantiated universally. @@ -188,7 +192,7 @@ where let placeholder = ty::PlaceholderRegion { universe, name: br.kind }; delegate.next_placeholder_region(placeholder) } else { - delegate.next_existential_region_var(true) + delegate.next_existential_region_var(true, br.kind.get_name()) } } }; diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index 10b474efd5aeb..2f7c496161bca 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -186,7 +186,8 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> { #[instrument(skip(self), level = "debug")] fn tys(&mut self, pattern: Ty<'tcx>, value: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { - if let ty::Error(_) = pattern.kind() { + // FIXME(non_lifetime_binders): What to do here? + if matches!(pattern.kind(), ty::Error(_) | ty::Bound(..)) { // Unlike normal `TypeRelation` rules, `ty::Error` does not equal any type. self.no_match() } else if pattern == value { diff --git a/compiler/rustc_middle/src/mir/visit.rs b/compiler/rustc_middle/src/mir/visit.rs index 443c1b2d261ef..7f0935fb149fa 100644 --- a/compiler/rustc_middle/src/mir/visit.rs +++ b/compiler/rustc_middle/src/mir/visit.rs @@ -1214,7 +1214,7 @@ impl<'tcx> MirVisitable<'tcx> for Option> { /// Extra information passed to `visit_ty` and friends to give context /// about where the type etc appears. -#[derive(Debug)] +#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)] pub enum TyContext { LocalDecl { /// The index of the local variable we are visiting. diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index f8d17433cf770..35ff71d888501 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1751,6 +1751,13 @@ impl<'tcx> Region<'tcx> { pub fn is_var(self) -> bool { matches!(self.kind(), ty::ReVar(_)) } + + pub fn as_var(self) -> Option { + match self.kind() { + ty::ReVar(vid) => Some(vid), + _ => None, + } + } } /// Type utilities diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 33ee90ffc119d..cff3da720fc5c 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -13,11 +13,7 @@ use rustc_index::vec::IndexVec; use rustc_middle::mir::visit::{ MutVisitor, MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor, }; -use rustc_middle::mir::{ - BasicBlock, BinOp, Body, Constant, ConstantKind, Local, LocalDecl, LocalKind, Location, - Operand, Place, Rvalue, SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, - RETURN_PLACE, -}; +use rustc_middle::mir::*; use rustc_middle::ty::layout::{LayoutError, LayoutOf, LayoutOfHelpers, TyAndLayout}; use rustc_middle::ty::InternalSubsts; use rustc_middle::ty::{self, ConstKind, Instance, ParamEnv, Ty, TyCtxt, TypeVisitable}; @@ -456,27 +452,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { }; } - fn use_ecx(&mut self, f: F) -> Option - where - F: FnOnce(&mut Self) -> InterpResult<'tcx, T>, - { - match f(self) { - Ok(val) => Some(val), - Err(error) => { - trace!("InterpCx operation failed: {:?}", error); - // Some errors shouldn't come up because creating them causes - // an allocation, which we should avoid. When that happens, - // dedicated error variants should be introduced instead. - assert!( - !error.kind().formatted_string(), - "const-prop encountered formatting error: {}", - error - ); - None - } - } - } - /// Returns the value, if any, of evaluating `c`. fn eval_constant(&mut self, c: &Constant<'tcx>) -> Option> { // FIXME we need to revisit this for #67176 @@ -491,7 +466,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { /// Returns the value, if any, of evaluating `place`. fn eval_place(&mut self, place: Place<'tcx>) -> Option> { trace!("eval_place(place={:?})", place); - self.use_ecx(|this| this.ecx.eval_place_to_op(place, None)) + self.ecx.eval_place_to_op(place, None).ok() } /// Returns the value, if any, of evaluating `op`. Calls upon `eval_constant` @@ -595,35 +570,37 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { rvalue: &Rvalue<'tcx>, place: Place<'tcx>, ) -> Option<()> { - self.use_ecx(|this| match rvalue { + match rvalue { Rvalue::BinaryOp(op, box (left, right)) | Rvalue::CheckedBinaryOp(op, box (left, right)) => { - let l = this.ecx.eval_operand(left, None).and_then(|x| this.ecx.read_immediate(&x)); + let l = self.ecx.eval_operand(left, None).and_then(|x| self.ecx.read_immediate(&x)); let r = - this.ecx.eval_operand(right, None).and_then(|x| this.ecx.read_immediate(&x)); + self.ecx.eval_operand(right, None).and_then(|x| self.ecx.read_immediate(&x)); let const_arg = match (l, r) { (Ok(x), Err(_)) | (Err(_), Ok(x)) => x, // exactly one side is known - (Err(e), Err(_)) => return Err(e), // neither side is known - (Ok(_), Ok(_)) => return this.ecx.eval_rvalue_into_place(rvalue, place), // both sides are known + (Err(_), Err(_)) => return None, // neither side is known + (Ok(_), Ok(_)) => return self.ecx.eval_rvalue_into_place(rvalue, place).ok(), // both sides are known }; if !matches!(const_arg.layout.abi, abi::Abi::Scalar(..)) { // We cannot handle Scalar Pair stuff. // No point in calling `eval_rvalue_into_place`, since only one side is known - throw_machine_stop_str!("cannot optimize this") + return None; } - let arg_value = const_arg.to_scalar().to_bits(const_arg.layout.size)?; - let dest = this.ecx.eval_place(place)?; + let arg_value = const_arg.to_scalar().to_bits(const_arg.layout.size).ok()?; + let dest = self.ecx.eval_place(place).ok()?; match op { - BinOp::BitAnd if arg_value == 0 => this.ecx.write_immediate(*const_arg, &dest), + BinOp::BitAnd if arg_value == 0 => { + self.ecx.write_immediate(*const_arg, &dest).ok() + } BinOp::BitOr if arg_value == const_arg.layout.size.truncate(u128::MAX) || (const_arg.layout.ty.is_bool() && arg_value == 1) => { - this.ecx.write_immediate(*const_arg, &dest) + self.ecx.write_immediate(*const_arg, &dest).ok() } BinOp::Mul if const_arg.layout.ty.is_integral() && arg_value == 0 => { if let Rvalue::CheckedBinaryOp(_, _) = rvalue { @@ -631,16 +608,16 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { const_arg.to_scalar(), Scalar::from_bool(false), ); - this.ecx.write_immediate(val, &dest) + self.ecx.write_immediate(val, &dest).ok() } else { - this.ecx.write_immediate(*const_arg, &dest) + self.ecx.write_immediate(*const_arg, &dest).ok() } } - _ => throw_machine_stop_str!("cannot optimize this"), + _ => None, } } - _ => this.ecx.eval_rvalue_into_place(rvalue, place), - }) + _ => self.ecx.eval_rvalue_into_place(rvalue, place).ok(), + } } /// Creates a new `Operand::Constant` from a `Scalar` value @@ -682,7 +659,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } // FIXME> figure out what to do when read_immediate_raw fails - let imm = self.use_ecx(|this| this.ecx.read_immediate_raw(value)); + let imm = self.ecx.read_immediate_raw(value).ok(); if let Some(Right(imm)) = imm { match *imm { @@ -702,25 +679,23 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { if let ty::Tuple(types) = ty.kind() { // Only do it if tuple is also a pair with two scalars if let [ty1, ty2] = types[..] { - let alloc = self.use_ecx(|this| { - let ty_is_scalar = |ty| { - this.ecx.layout_of(ty).ok().map(|layout| layout.abi.is_scalar()) - == Some(true) - }; - if ty_is_scalar(ty1) && ty_is_scalar(ty2) { - let alloc = this - .ecx - .intern_with_temp_alloc(value.layout, |ecx, dest| { - ecx.write_immediate(*imm, dest) - }) - .unwrap(); - Ok(Some(alloc)) - } else { - Ok(None) - } - }); - - if let Some(Some(alloc)) = alloc { + let ty_is_scalar = |ty| { + self.ecx.layout_of(ty).ok().map(|layout| layout.abi.is_scalar()) + == Some(true) + }; + let alloc = if ty_is_scalar(ty1) && ty_is_scalar(ty2) { + let alloc = self + .ecx + .intern_with_temp_alloc(value.layout, |ecx, dest| { + ecx.write_immediate(*imm, dest) + }) + .unwrap(); + Some(alloc) + } else { + None + }; + + if let Some(alloc) = alloc { // Assign entire constant in a single statement. // We can't use aggregates, as we run after the aggregate-lowering `MirPhase`. let const_val = ConstValue::ByRef { alloc, offset: Size::ZERO }; @@ -921,84 +896,80 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> { trace!("visit_statement: {:?}", statement); let source_info = statement.source_info; self.source_info = Some(source_info); - if let StatementKind::Assign(box (place, ref mut rval)) = statement.kind { - let can_const_prop = self.ecx.machine.can_const_prop[place.local]; - if let Some(()) = self.const_prop(rval, place) { - // This will return None if the above `const_prop` invocation only "wrote" a - // type whose creation requires no write. E.g. a generator whose initial state - // consists solely of uninitialized memory (so it doesn't capture any locals). - if let Some(ref value) = self.get_const(place) && self.should_const_prop(value) { - trace!("replacing {:?} with {:?}", rval, value); - self.replace_with_const(rval, value, source_info); - if can_const_prop == ConstPropMode::FullConstProp - || can_const_prop == ConstPropMode::OnlyInsideOwnBlock - { - trace!("propagated into {:?}", place); + match statement.kind { + StatementKind::Assign(box (place, ref mut rval)) => { + let can_const_prop = self.ecx.machine.can_const_prop[place.local]; + if let Some(()) = self.const_prop(rval, place) { + // This will return None if the above `const_prop` invocation only "wrote" a + // type whose creation requires no write. E.g. a generator whose initial state + // consists solely of uninitialized memory (so it doesn't capture any locals). + if let Some(ref value) = self.get_const(place) && self.should_const_prop(value) { + trace!("replacing {:?} with {:?}", rval, value); + self.replace_with_const(rval, value, source_info); + if can_const_prop == ConstPropMode::FullConstProp + || can_const_prop == ConstPropMode::OnlyInsideOwnBlock + { + trace!("propagated into {:?}", place); + } } - } - match can_const_prop { - ConstPropMode::OnlyInsideOwnBlock => { - trace!( - "found local restricted to its block. \ + match can_const_prop { + ConstPropMode::OnlyInsideOwnBlock => { + trace!( + "found local restricted to its block. \ Will remove it from const-prop after block is finished. Local: {:?}", - place.local - ); - } - ConstPropMode::OnlyPropagateInto | ConstPropMode::NoPropagation => { - trace!("can't propagate into {:?}", place); - if place.local != RETURN_PLACE { - Self::remove_const(&mut self.ecx, place.local); + place.local + ); } - } - ConstPropMode::FullConstProp => {} - } - } else { - // Const prop failed, so erase the destination, ensuring that whatever happens - // from here on, does not know about the previous value. - // This is important in case we have - // ```rust - // let mut x = 42; - // x = SOME_MUTABLE_STATIC; - // // x must now be uninit - // ``` - // FIXME: we overzealously erase the entire local, because that's easier to - // implement. - trace!( - "propagation into {:?} failed. - Nuking the entire site from orbit, it's the only way to be sure", - place, - ); - Self::remove_const(&mut self.ecx, place.local); - } - } else { - match statement.kind { - StatementKind::SetDiscriminant { ref place, .. } => { - match self.ecx.machine.can_const_prop[place.local] { - ConstPropMode::FullConstProp | ConstPropMode::OnlyInsideOwnBlock => { - if self.use_ecx(|this| this.ecx.statement(statement)).is_some() { - trace!("propped discriminant into {:?}", place); - } else { + ConstPropMode::OnlyPropagateInto | ConstPropMode::NoPropagation => { + trace!("can't propagate into {:?}", place); + if place.local != RETURN_PLACE { Self::remove_const(&mut self.ecx, place.local); } } - ConstPropMode::OnlyPropagateInto | ConstPropMode::NoPropagation => { - Self::remove_const(&mut self.ecx, place.local); - } + ConstPropMode::FullConstProp => {} } + } else { + // Const prop failed, so erase the destination, ensuring that whatever happens + // from here on, does not know about the previous value. + // This is important in case we have + // ```rust + // let mut x = 42; + // x = SOME_MUTABLE_STATIC; + // // x must now be uninit + // ``` + // FIXME: we overzealously erase the entire local, because that's easier to + // implement. + trace!( + "propagation into {:?} failed. + Nuking the entire site from orbit, it's the only way to be sure", + place, + ); + Self::remove_const(&mut self.ecx, place.local); } - StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => { - let frame = self.ecx.frame_mut(); - frame.locals[local].value = - if let StatementKind::StorageLive(_) = statement.kind { - LocalValue::Live(interpret::Operand::Immediate( - interpret::Immediate::Uninit, - )) + } + StatementKind::SetDiscriminant { ref place, .. } => { + match self.ecx.machine.can_const_prop[place.local] { + ConstPropMode::FullConstProp | ConstPropMode::OnlyInsideOwnBlock => { + if self.ecx.statement(statement).is_ok() { + trace!("propped discriminant into {:?}", place); } else { - LocalValue::Dead - }; + Self::remove_const(&mut self.ecx, place.local); + } + } + ConstPropMode::OnlyPropagateInto | ConstPropMode::NoPropagation => { + Self::remove_const(&mut self.ecx, place.local); + } } - _ => {} } + StatementKind::StorageLive(local) | StatementKind::StorageDead(local) => { + let frame = self.ecx.frame_mut(); + frame.locals[local].value = if let StatementKind::StorageLive(_) = statement.kind { + LocalValue::Live(interpret::Operand::Immediate(interpret::Immediate::Uninit)) + } else { + LocalValue::Dead + }; + } + _ => {} } self.super_statement(statement, location); @@ -1008,12 +979,10 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> { let source_info = terminator.source_info; self.source_info = Some(source_info); self.super_terminator(terminator, location); - // Do NOT early return in this function, it does some crucial fixup of the state at the end! + match &mut terminator.kind { TerminatorKind::Assert { expected, ref mut cond, .. } => { if let Some(ref value) = self.eval_operand(&cond) - // FIXME should be used use_ecx rather than a local match... but we have - // quite a few of these read_scalar/read_immediate that need fixing. && let Ok(value_const) = self.ecx.read_scalar(&value) && self.should_const_prop(value) { @@ -1050,6 +1019,10 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> { // gated on `mir_opt_level=3`. TerminatorKind::Call { .. } => {} } + } + + fn visit_basic_block_data(&mut self, block: BasicBlock, data: &mut BasicBlockData<'tcx>) { + self.super_basic_block_data(block, data); // We remove all Locals which are restricted in propagation to their containing blocks and // which were modified in the current block. diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 91b463800a814..824264c21d0d0 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2784,7 +2784,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { _ => true, }; if ident.span.is_visible(sm) && !ident.span.overlaps(span) && !same_line { - multispan.push_span_label(ident.span, "required by a bound in this"); + multispan.push_span_label( + ident.span, + format!( + "required by a bound in this {}", + tcx.def_kind(item_def_id).descr(item_def_id) + ), + ); } } let descr = format!("required by a bound in `{item_name}`"); diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index deed6fbd4391f..0db043a4fcade 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -16,7 +16,7 @@ regex = "1.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" rustfix = "0.6.0" -lazy_static = "1.0" +once_cell = "1.16.0" walkdir = "2" glob = "0.3.0" lazycell = "1.3.0" @@ -25,5 +25,5 @@ lazycell = "1.3.0" libc = "0.2" [target.'cfg(windows)'.dependencies] -miow = "0.3" +miow = "0.5" winapi = { version = "0.3", features = ["winerror"] } diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index 054235ec16dcf..c33e66e02ac41 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -7,7 +7,7 @@ use std::io::BufReader; use std::path::Path; use std::str::FromStr; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; use tracing::*; @@ -117,10 +117,8 @@ fn parse_expected( // //~^^^^^ // //[cfg1]~ // //[cfg1,cfg2]~^^ - lazy_static! { - static ref RE: Regex = - Regex::new(r"//(?:\[(?P[\w,]+)])?~(?P\||\^*)").unwrap(); - } + static RE: Lazy = + Lazy::new(|| Regex::new(r"//(?:\[(?P[\w,]+)])?~(?P\||\^*)").unwrap()); let captures = RE.captures(line)?; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index c648b2f12f101..1760c29ec66b7 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -588,7 +588,8 @@ fn modified_tests(config: &Config, dir: &Path) -> Result, String> { let full_paths = { let mut full_paths: Vec = all_paths .into_iter() - .map(|f| fs::canonicalize(&f).unwrap().with_extension("").with_extension("rs")) + .map(|f| PathBuf::from(f).with_extension("").with_extension("rs")) + .filter_map(|f| if Path::new(&f).exists() { f.canonicalize().ok() } else { None }) .collect(); full_paths.dedup(); full_paths.sort_unstable(); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 51c9a27c83d51..7824ef81d7a93 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -32,7 +32,7 @@ use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::str; use glob::glob; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use tracing::*; use crate::extract_gdb_version; @@ -52,9 +52,8 @@ fn disable_error_reporting R, R>(f: F) -> R { use winapi::um::errhandlingapi::SetErrorMode; use winapi::um::winbase::SEM_NOGPFAULTERRORBOX; - lazy_static! { - static ref LOCK: Mutex<()> = Mutex::new(()); - } + static LOCK: Mutex<()> = Mutex::new(()); + // Error mode is a global variable, so lock it so only one thread will change it let _lock = LOCK.lock().unwrap(); @@ -2848,11 +2847,10 @@ impl<'test> TestCx<'test> { // the form .-in-., // remove all crate-disambiguators. fn remove_crate_disambiguator_from_cgu(cgu: &str) -> String { - lazy_static! { - static ref RE: Regex = - Regex::new(r"^[^\.]+(?P\.[[:alnum:]]+)(-in-[^\.]+(?P\.[[:alnum:]]+))?") - .unwrap(); - } + static RE: Lazy = Lazy::new(|| { + Regex::new(r"^[^\.]+(?P\.[[:alnum:]]+)(-in-[^\.]+(?P\.[[:alnum:]]+))?") + .unwrap() + }); let captures = RE.captures(cgu).unwrap_or_else(|| panic!("invalid cgu name encountered: {}", cgu)); @@ -3170,12 +3168,12 @@ impl<'test> TestCx<'test> { // 'uploaded "$TEST_BUILD_DIR/, waiting for result"' // is printed to stdout by the client and then captured in the ProcRes, // so it needs to be removed when comparing the run-pass test execution output - lazy_static! { - static ref REMOTE_TEST_RE: Regex = Regex::new( + static REMOTE_TEST_RE: Lazy = Lazy::new(|| { + Regex::new( "^uploaded \"\\$TEST_BUILD_DIR(/[[:alnum:]_\\-.]+)+\", waiting for result\n" ) - .unwrap(); - } + .unwrap() + }); REMOTE_TEST_RE .replace( &self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout), @@ -3620,10 +3618,8 @@ impl<'test> TestCx<'test> { // with placeholders as we do not want tests needing updated when compiler source code // changes. // eg. $SRC_DIR/libcore/mem.rs:323:14 becomes $SRC_DIR/libcore/mem.rs:LL:COL - lazy_static! { - static ref SRC_DIR_RE: Regex = - Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?").unwrap(); - } + static SRC_DIR_RE: Lazy = + Lazy::new(|| Regex::new("SRC_DIR(.+):\\d+:\\d+(: \\d+:\\d+)?").unwrap()); normalized = SRC_DIR_RE.replace_all(&normalized, "SRC_DIR$1:LL:COL").into_owned(); @@ -3634,19 +3630,17 @@ impl<'test> TestCx<'test> { // since they duplicate actual errors and make the output hard to read. // This mirrors the regex in src/tools/tidy/src/style.rs, please update // both if either are changed. - lazy_static! { - static ref ANNOTATION_RE: Regex = Regex::new("\\s*//(\\[.*\\])?~.*").unwrap(); - } + static ANNOTATION_RE: Lazy = + Lazy::new(|| Regex::new("\\s*//(\\[.*\\])?~.*").unwrap()); normalized = ANNOTATION_RE.replace_all(&normalized, "").into_owned(); // This code normalizes various hashes in v0 symbol mangling that is // emitted in the ui and mir-opt tests. - lazy_static! { - static ref V0_CRATE_HASH_PREFIX_RE: Regex = - Regex::new(r"_R.*?Cs[0-9a-zA-Z]+_").unwrap(); - static ref V0_CRATE_HASH_RE: Regex = Regex::new(r"Cs[0-9a-zA-Z]+_").unwrap(); - } + static V0_CRATE_HASH_PREFIX_RE: Lazy = + Lazy::new(|| Regex::new(r"_R.*?Cs[0-9a-zA-Z]+_").unwrap()); + static V0_CRATE_HASH_RE: Lazy = + Lazy::new(|| Regex::new(r"Cs[0-9a-zA-Z]+_").unwrap()); const V0_CRATE_HASH_PLACEHOLDER: &str = r"CsCRATE_HASH_"; if V0_CRATE_HASH_PREFIX_RE.is_match(&normalized) { @@ -3655,10 +3649,9 @@ impl<'test> TestCx<'test> { V0_CRATE_HASH_RE.replace_all(&normalized, V0_CRATE_HASH_PLACEHOLDER).into_owned(); } - lazy_static! { - static ref V0_BACK_REF_PREFIX_RE: Regex = Regex::new(r"\(_R.*?B[0-9a-zA-Z]_").unwrap(); - static ref V0_BACK_REF_RE: Regex = Regex::new(r"B[0-9a-zA-Z]_").unwrap(); - } + static V0_BACK_REF_PREFIX_RE: Lazy = + Lazy::new(|| Regex::new(r"\(_R.*?B[0-9a-zA-Z]_").unwrap()); + static V0_BACK_REF_RE: Lazy = Lazy::new(|| Regex::new(r"B[0-9a-zA-Z]_").unwrap()); const V0_BACK_REF_PLACEHOLDER: &str = r"B_"; if V0_BACK_REF_PREFIX_RE.is_match(&normalized) { @@ -3681,21 +3674,23 @@ impl<'test> TestCx<'test> { /// Replaces backslashes in paths with forward slashes, and replaces CRLF line endings /// with LF. fn normalize_platform_differences(output: &str) -> String { - lazy_static! { - /// Used to find Windows paths. - /// - /// It's not possible to detect paths in the error messages generally, but this is a - /// decent enough heuristic. - static ref PATH_BACKSLASH_RE: Regex = Regex::new(r#"(?x) + /// Used to find Windows paths. + /// + /// It's not possible to detect paths in the error messages generally, but this is a + /// decent enough heuristic. + static PATH_BACKSLASH_RE: Lazy = Lazy::new(|| { + Regex::new( + r#"(?x) (?: # Match paths that don't include spaces. (?:\\[\pL\pN\.\-_']+)+\.\pL+ | # If the path starts with a well-known root, then allow spaces. \$(?:DIR|SRC_DIR|TEST_BUILD_DIR|BUILD_DIR|LIB_DIR)(?:\\[\pL\pN\.\-_' ]+)+ - )"# - ).unwrap(); - } + )"#, + ) + .unwrap() + }); let output = output.replace(r"\\", r"\"); diff --git a/tests/ui/associated-types/associated-types-eq-hr.stderr b/tests/ui/associated-types/associated-types-eq-hr.stderr index 99db0c1bf3bc9..3e1142d5d9560 100644 --- a/tests/ui/associated-types/associated-types-eq-hr.stderr +++ b/tests/ui/associated-types/associated-types-eq-hr.stderr @@ -15,7 +15,7 @@ note: required by a bound in `foo` --> $DIR/associated-types-eq-hr.rs:45:36 | LL | fn foo() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: for<'x> TheTrait<&'x isize, A = &'x isize>, | ^^^^^^^^^^^^^ required by this bound in `foo` @@ -37,7 +37,7 @@ note: required by a bound in `bar` --> $DIR/associated-types-eq-hr.rs:52:36 | LL | fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: for<'x> TheTrait<&'x isize, A = &'x usize>, | ^^^^^^^^^^^^^ required by this bound in `bar` diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.stderr index eadad4cd5722f..2485758757b9b 100644 --- a/tests/ui/associated-types/defaults-suitability.stderr +++ b/tests/ui/associated-types/defaults-suitability.stderr @@ -27,7 +27,7 @@ LL | Self::Ty: Clone, | ^^^^^ required by this bound in `Tr2::Ty` LL | { LL | type Ty = NotClone; - | -- required by a bound in this + | -- required by a bound in this associated type help: consider annotating `NotClone` with `#[derive(Clone)]` | LL | #[derive(Clone)] @@ -75,7 +75,7 @@ LL | Self::Assoc: IsU8, | ^^^^^^^^^^^^^^^^^ required by this bound in `D::Assoc` ... LL | type Assoc = NotClone; - | ----- required by a bound in this + | ----- required by a bound in this associated type error[E0277]: the trait bound `>::Baz: Clone` is not satisfied --> $DIR/defaults-suitability.rs:65:23 @@ -124,7 +124,7 @@ LL | Self::Baz: Clone, | ^^^^^ required by this bound in `Foo3::Baz` ... LL | type Baz = T; - | --- required by a bound in this + | --- required by a bound in this associated type help: consider further restricting type parameter `T` | LL | Self::Baz: Clone, T: std::clone::Clone diff --git a/tests/ui/associated-types/hr-associated-type-bound-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-1.stderr index 73b5e1053fb9d..b380a1b6f0658 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-1.rs:3:33 | LL | trait X<'a> - | - required by a bound in this + | - required by a bound in this trait LL | where LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-object.stderr b/tests/ui/associated-types/hr-associated-type-bound-object.stderr index 6d19186bde49a..a0a6f76a58371 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-object.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-object.stderr @@ -8,7 +8,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-object.rs:3:33 | LL | trait X<'a> - | - required by a bound in this + | - required by a bound in this trait LL | where LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr index af2e616896a87..e249f2e0c2799 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Y` --> $DIR/hr-associated-type-bound-param-1.rs:4:36 | LL | trait Y<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::V: Clone, | ^^^^^ required by this bound in `Y` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr index 52294f8c94a56..366670269d7cd 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-2.stderr @@ -9,7 +9,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` @@ -25,7 +25,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` @@ -41,7 +41,7 @@ note: required by a bound in `Z` --> $DIR/hr-associated-type-bound-param-2.rs:6:35 | LL | trait Z<'a, T: ?Sized> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::W: Clone, | ^^^^^ required by this bound in `Z` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr index 84d5e0494cb69..f49439d3573d3 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-3.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-3.rs:4:33 | LL | trait X<'a, T> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr index ee1d5d324954a..f8733b423d778 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-4.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-4.rs:4:36 | LL | trait X<'a, T> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> <(T,) as X<'b, T>>::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr index ece3151ba978c..aae80a9b2e196 100644 --- a/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr +++ b/tests/ui/associated-types/hr-associated-type-bound-param-5.stderr @@ -9,7 +9,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-5.rs:17:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` @@ -25,7 +25,7 @@ note: required by a bound in `X` --> $DIR/hr-associated-type-bound-param-5.rs:17:45 | LL | trait X<'a, T: Cycle + for<'b> X<'b, T>> - | - required by a bound in this + | - required by a bound in this trait ... LL | for<'b> >::U: Clone, | ^^^^^ required by this bound in `X` diff --git a/tests/ui/associated-types/hr-associated-type-projection-1.stderr b/tests/ui/associated-types/hr-associated-type-projection-1.stderr index 2281d9419b461..dd0389c34e694 100644 --- a/tests/ui/associated-types/hr-associated-type-projection-1.stderr +++ b/tests/ui/associated-types/hr-associated-type-projection-1.stderr @@ -10,7 +10,7 @@ note: required by a bound in `UnsafeCopy` --> $DIR/hr-associated-type-projection-1.rs:3:64 | LL | trait UnsafeCopy<'a, T: Copy> - | ---------- required by a bound in this + | ---------- required by a bound in this trait LL | where LL | for<'b> >::Item: std::ops::Deref, | ^^^^^^^^^^ required by this bound in `UnsafeCopy` diff --git a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr index 2e7a1dd2a3186..3b4689e08ccfa 100644 --- a/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr +++ b/tests/ui/associated-types/point-at-type-on-obligation-failure-2.stderr @@ -23,7 +23,7 @@ LL | Self::Assoc: Bar, | ^^^ required by this bound in `Baz::Assoc` LL | { LL | type Assoc; - | ----- required by a bound in this + | ----- required by a bound in this associated type error[E0277]: the trait bound `bool: Bar` is not satisfied --> $DIR/point-at-type-on-obligation-failure-2.rs:30:18 @@ -38,7 +38,7 @@ LL | ::Assoc: Bar, | ^^^ required by this bound in `Bat::Assoc` LL | { LL | type Assoc; - | ----- required by a bound in this + | ----- required by a bound in this associated type error: aborting due to 3 previous errors diff --git a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 8dccf929b2bd1..c5089295063dd 100644 --- a/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/tests/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -12,7 +12,7 @@ note: required by a bound in `with_closure` --> $DIR/expect-infer-var-appearing-twice.rs:2:14 | LL | fn with_closure(_: F) - | ------------ required by a bound in this + | ------------ required by a bound in this function LL | where F: FnOnce(A, A) | ^^^^^^^^^^^^ required by this bound in `with_closure` diff --git a/tests/ui/const-generics/defaults/wfness.stderr b/tests/ui/const-generics/defaults/wfness.stderr index 25038f830befc..bd9bfcd7dadf6 100644 --- a/tests/ui/const-generics/defaults/wfness.stderr +++ b/tests/ui/const-generics/defaults/wfness.stderr @@ -23,7 +23,7 @@ note: required by a bound in `WhereClause` --> $DIR/wfness.rs:8:9 | LL | struct WhereClause - | ----------- required by a bound in this + | ----------- required by a bound in this struct LL | where LL | (): Trait; | ^^^^^^^^ required by this bound in `WhereClause` diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index bf6c35ad8fd86..ab2871ff28127 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -9,7 +9,7 @@ note: required by a bound in `bar` --> $DIR/ensure_is_evaluatable.rs:15:10 | LL | fn bar() -> [(); N] - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index 614e7e0d2fc20..c124010aab05b 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -9,7 +9,7 @@ note: required by a bound in `bar` --> $DIR/fn_with_two_const_inputs.rs:18:10 | LL | fn bar() -> [(); N] - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr b/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr index f2fddfbfbb52a..996b75493e618 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Arr` --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` @@ -26,7 +26,7 @@ note: required by a bound in `Arr` --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` diff --git a/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr b/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr index a253ec676f716..63e6fcc8e119b 100644 --- a/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr +++ b/tests/ui/const-generics/generic_const_exprs/obligation-cause.stderr @@ -10,7 +10,7 @@ note: required by a bound in `g` --> $DIR/obligation-cause.rs:13:44 | LL | fn g() - | - required by a bound in this + | - required by a bound in this function ... LL | Is<{ std::mem::size_of::() == 0 }>: True, | ^^^^ required by this bound in `g` diff --git a/tests/ui/const-generics/issues/issue-67185-2.stderr b/tests/ui/const-generics/issues/issue-67185-2.stderr index c7be8e14a10d5..032b0c41047fc 100644 --- a/tests/ui/const-generics/issues/issue-67185-2.stderr +++ b/tests/ui/const-generics/issues/issue-67185-2.stderr @@ -35,7 +35,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait ... LL | ::Quaks: Bar, | ^^^ required by this bound in `Foo` @@ -53,7 +53,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait LL | where LL | [::Quaks; 2]: Bar, | ^^^ required by this bound in `Foo` @@ -71,7 +71,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait LL | where LL | [::Quaks; 2]: Bar, | ^^^ required by this bound in `Foo` @@ -89,7 +89,7 @@ note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | LL | trait Foo - | --- required by a bound in this + | --- required by a bound in this trait ... LL | ::Quaks: Bar, | ^^^ required by this bound in `Foo` diff --git a/tests/ui/const-generics/issues/issue-73260.stderr b/tests/ui/const-generics/issues/issue-73260.stderr index f9ff0f28d51d2..c56b45cc8faf1 100644 --- a/tests/ui/const-generics/issues/issue-73260.stderr +++ b/tests/ui/const-generics/issues/issue-73260.stderr @@ -10,7 +10,7 @@ note: required by a bound in `Arr` --> $DIR/issue-73260.rs:5:37 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where LL | Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` @@ -27,7 +27,7 @@ note: required by a bound in `Arr` --> $DIR/issue-73260.rs:5:37 | LL | struct Arr - | --- required by a bound in this + | --- required by a bound in this struct LL | where LL | Assert::<{N < usize::MAX / 2}>: IsTrue, | ^^^^^^ required by this bound in `Arr` diff --git a/tests/ui/const-generics/issues/issue-79674.stderr b/tests/ui/const-generics/issues/issue-79674.stderr index 02b48b55f8b38..ba7fd2ca3ccf3 100644 --- a/tests/ui/const-generics/issues/issue-79674.stderr +++ b/tests/ui/const-generics/issues/issue-79674.stderr @@ -10,7 +10,7 @@ note: required by a bound in `requires_distinct` --> $DIR/issue-79674.rs:23:37 | LL | fn requires_distinct(_a: A, _b: B) where - | ----------------- required by a bound in this + | ----------------- required by a bound in this function LL | A: MiniTypeId, B: MiniTypeId, LL | Lift<{is_same_type::()}>: IsFalse {} | ^^^^^^^ required by this bound in `requires_distinct` diff --git a/tests/ui/const-generics/issues/issue-86530.stderr b/tests/ui/const-generics/issues/issue-86530.stderr index c63857b2314e9..620ed4f0fb2cc 100644 --- a/tests/ui/const-generics/issues/issue-86530.stderr +++ b/tests/ui/const-generics/issues/issue-86530.stderr @@ -10,7 +10,7 @@ note: required by a bound in `z` --> $DIR/issue-86530.rs:10:8 | LL | fn z(t: T) - | - required by a bound in this + | - required by a bound in this function LL | where LL | T: X, | ^ required by this bound in `z` diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr index a3c011d927b5a..51ef354e3ed4a 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -9,7 +9,7 @@ note: required by a bound in `A` --> $DIR/unused-substs-1.rs:9:11 | LL | struct A - | - required by a bound in this + | - required by a bound in this unit struct LL | where LL | A: Bar; | ^^^^^^ required by this bound in `A` diff --git a/tests/ui/const-generics/unify_with_nested_expr.stderr b/tests/ui/const-generics/unify_with_nested_expr.stderr index 8bab0dff7f263..d4d78b5962789 100644 --- a/tests/ui/const-generics/unify_with_nested_expr.stderr +++ b/tests/ui/const-generics/unify_with_nested_expr.stderr @@ -8,7 +8,7 @@ note: required by a bound in `bar` --> $DIR/unify_with_nested_expr.rs:14:10 | LL | fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` diff --git a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr index 43fba2573ff62..fa20077da7efe 100644 --- a/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr +++ b/tests/ui/consts/ct-var-in-collect_all_mismatches.stderr @@ -8,7 +8,7 @@ note: required by a bound in `Foo::::unsatisfied` --> $DIR/ct-var-in-collect_all_mismatches.rs:15:12 | LL | fn unsatisfied(self) - | ----------- required by a bound in this + | ----------- required by a bound in this associated function LL | where LL | T: Bar, | ^^^^^^ required by this bound in `Foo::::unsatisfied` diff --git a/tests/ui/generator/generator-yielding-or-returning-itself.stderr b/tests/ui/generator/generator-yielding-or-returning-itself.stderr index 8f5d2429a2892..a26dbf3f27c46 100644 --- a/tests/ui/generator/generator-yielding-or-returning-itself.stderr +++ b/tests/ui/generator/generator-yielding-or-returning-itself.stderr @@ -19,7 +19,7 @@ note: required by a bound in `want_cyclic_generator_return` --> $DIR/generator-yielding-or-returning-itself.rs:10:36 | LL | pub fn want_cyclic_generator_return(_: T) - | ---------------------------- required by a bound in this + | ---------------------------- required by a bound in this function LL | where T: Generator | ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return` @@ -44,7 +44,7 @@ note: required by a bound in `want_cyclic_generator_yield` --> $DIR/generator-yielding-or-returning-itself.rs:23:24 | LL | pub fn want_cyclic_generator_yield(_: T) - | --------------------------- required by a bound in this + | --------------------------- required by a bound in this function LL | where T: Generator | ^^^^^^^^^ required by this bound in `want_cyclic_generator_yield` diff --git a/tests/ui/generic-associated-types/bugs/issue-88460.stderr b/tests/ui/generic-associated-types/bugs/issue-88460.stderr index 6612c4b49446f..a2047f103d488 100644 --- a/tests/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/tests/ui/generic-associated-types/bugs/issue-88460.stderr @@ -11,7 +11,7 @@ note: required by a bound in `test` --> $DIR/issue-88460.rs:15:27 | LL | fn test(value: T) - | ---- required by a bound in this + | ---- required by a bound in this function ... LL | for<'a> T::Assoc<'a>: Marker, | ^^^^^^ required by this bound in `test` diff --git a/tests/ui/generic-associated-types/issue-101020.stderr b/tests/ui/generic-associated-types/issue-101020.stderr index 1f9273a8c4ab2..5c8db617c1731 100644 --- a/tests/ui/generic-associated-types/issue-101020.stderr +++ b/tests/ui/generic-associated-types/issue-101020.stderr @@ -13,7 +13,7 @@ note: required by a bound in `LendingIterator::consume` --> $DIR/issue-101020.rs:9:33 | LL | fn consume(self, _f: F) - | ------- required by a bound in this + | ------- required by a bound in this associated function ... LL | for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume` diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr index 8cda76b9490c2..b1b8ffa8c5483 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr @@ -10,7 +10,7 @@ note: required by a bound in `want_bar_for_any_ccx` --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:32:15 | LL | fn want_bar_for_any_ccx(b: &B) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound diff --git a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr index 88793a1525bfb..7f96909b6e76e 100644 --- a/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr +++ b/tests/ui/higher-rank-trait-bounds/hrtb-higher-ranker-supertraits.stderr @@ -10,7 +10,7 @@ note: required by a bound in `want_foo_for_any_tcx` --> $DIR/hrtb-higher-ranker-supertraits.rs:22:15 | LL | fn want_foo_for_any_tcx(f: &F) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where F : for<'tcx> Foo<'tcx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_foo_for_any_tcx` help: consider further restricting this bound @@ -30,7 +30,7 @@ note: required by a bound in `want_bar_for_any_ccx` --> $DIR/hrtb-higher-ranker-supertraits.rs:39:15 | LL | fn want_bar_for_any_ccx(b: &B) - | -------------------- required by a bound in this + | -------------------- required by a bound in this function LL | where B : for<'ccx> Bar<'ccx> | ^^^^^^^^^^^^^^^^^^^ required by this bound in `want_bar_for_any_ccx` help: consider further restricting this bound diff --git a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr index 86198c3f7fd79..4d470ae70229f 100644 --- a/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr +++ b/tests/ui/higher-rank-trait-bounds/issue-62203-hrtb-ice.stderr @@ -25,7 +25,7 @@ note: required by a bound in `T1::m` --> $DIR/issue-62203-hrtb-ice.rs:27:51 | LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 - | - required by a bound in this + | - required by a bound in this associated function LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` @@ -56,7 +56,7 @@ note: required by a bound in `T1::m` --> $DIR/issue-62203-hrtb-ice.rs:27:12 | LL | fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1 - | - required by a bound in this + | - required by a bound in this associated function LL | where LL | F: for<'r> T0<'r, (>::V,), O = >::V>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr index 62d0128fd85a0..edef6ccd34e61 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-89118.stderr @@ -15,7 +15,7 @@ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | LL | trait StackContext - | ------------ required by a bound in this + | ------------ required by a bound in this trait LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` @@ -37,7 +37,7 @@ note: required by a bound in `EthernetWorker` --> $DIR/issue-89118.rs:28:14 | LL | struct EthernetWorker(C) - | -------------- required by a bound in this + | -------------- required by a bound in this struct LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `EthernetWorker` @@ -59,7 +59,7 @@ note: required by a bound in `StackContext` --> $DIR/issue-89118.rs:9:14 | LL | trait StackContext - | ------------ required by a bound in this + | ------------ required by a bound in this trait LL | where LL | Ctx<()>: for<'a> BufferUdpStateContext<&'a ()>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StackContext` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr index 6206b167b0b8d..5be33bccdc317 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/issue-90950.stderr @@ -11,7 +11,7 @@ note: required by a bound in `upcast` --> $DIR/issue-90950.rs:27:42 | LL | fn upcast(x: Yoke) -> Yoke + 'static>> where - | ------ required by a bound in this + | ------ required by a bound in this function LL | Y: for<'a> Yokeable<'a>, LL | for<'a> >::Output: IsCovariant<'a> | ^^^^^^^^^^^^^^^ required by this bound in `upcast` diff --git a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr index 51c9646004afa..73388a72574e2 100644 --- a/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr +++ b/tests/ui/higher-rank-trait-bounds/normalize-under-binder/norm-before-method-resolution.stderr @@ -8,7 +8,7 @@ note: required by a bound in `weird_bound` --> $DIR/norm-before-method-resolution.rs:18:40 | LL | fn weird_bound() -> X - | ----------- required by a bound in this + | ----------- required by a bound in this function ... LL | for<'a> >::Out: Copy | ^^^^ required by this bound in `weird_bound` diff --git a/tests/ui/implied-bounds/issue-100690.stderr b/tests/ui/implied-bounds/issue-100690.stderr index 3f6af70d8ed93..dba0353377fa2 100644 --- a/tests/ui/implied-bounds/issue-100690.stderr +++ b/tests/ui/implied-bounds/issue-100690.stderr @@ -12,7 +12,7 @@ note: required by a bound in `real_dispatch` --> $DIR/issue-100690.rs:9:8 | LL | fn real_dispatch(f: F) -> Result<(), io::Error> - | ------------- required by a bound in this + | ------------- required by a bound in this function ... LL | F: FnOnce(&mut UIView) -> Result<(), io::Error> + Send + 'static, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `real_dispatch` diff --git a/tests/ui/issues/issue-60218.stderr b/tests/ui/issues/issue-60218.stderr index dd72b6515ddca..563690c9a5d6d 100644 --- a/tests/ui/issues/issue-60218.stderr +++ b/tests/ui/issues/issue-60218.stderr @@ -10,7 +10,7 @@ note: required by a bound in `trigger_error` --> $DIR/issue-60218.rs:13:72 | LL | pub fn trigger_error(iterable: I, functor: F) - | ------------- required by a bound in this + | ------------- required by a bound in this function ... LL | for<'t> ::IntoIter, F> as Iterator>::Item: Foo, | ^^^ required by this bound in `trigger_error` diff --git a/tests/ui/issues/issue-69683.stderr b/tests/ui/issues/issue-69683.stderr index 193de1a35cf1a..c428ea9ea2c5b 100644 --- a/tests/ui/issues/issue-69683.stderr +++ b/tests/ui/issues/issue-69683.stderr @@ -31,7 +31,7 @@ LL | u8: Element, | ^^^^^^^^^^ required by this bound in `Foo::foo` LL | { LL | fn foo(self, x: >::Array); - | --- required by a bound in this + | --- required by a bound in this associated function help: try using a fully qualified path to specify the expected types | LL | >::foo(0u16, b); diff --git a/tests/ui/mismatched_types/issue-47706.stderr b/tests/ui/mismatched_types/issue-47706.stderr index d9d408844d0a4..69d6ee5cbd5a0 100644 --- a/tests/ui/mismatched_types/issue-47706.stderr +++ b/tests/ui/mismatched_types/issue-47706.stderr @@ -27,7 +27,7 @@ note: required by a bound in `foo` --> $DIR/issue-47706.rs:22:8 | LL | fn foo(f: F) - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | F: Fn(), | ^^^^ required by this bound in `foo` diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index 864ab053520db..fc5a521746a51 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -12,7 +12,7 @@ note: required by a bound in `foo` --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20 | LL | fn foo(_: X) - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for<'b> &'b X: Trait, | ^^^^^ required by this bound in `foo` diff --git a/tests/ui/suggestions/issue-84973.stderr b/tests/ui/suggestions/issue-84973.stderr index ae2bf5aac40b0..55c89884a5f6c 100644 --- a/tests/ui/suggestions/issue-84973.stderr +++ b/tests/ui/suggestions/issue-84973.stderr @@ -13,7 +13,7 @@ LL | G: SomeTrait, | ^^^^^^^^^ required by this bound in `Other::<'a, G>::new` LL | { LL | pub fn new(g: G) -> Self { - | --- required by a bound in this + | --- required by a bound in this associated function help: consider borrowing here | LL | let o = Other::new(&f); diff --git a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr index 6e6172eea4746..e927f26e96dd9 100644 --- a/tests/ui/traits/multidispatch-convert-ambig-dest.stderr +++ b/tests/ui/traits/multidispatch-convert-ambig-dest.stderr @@ -29,7 +29,7 @@ note: required by a bound in `test` --> $DIR/multidispatch-convert-ambig-dest.rs:21:11 | LL | fn test(_: T, _: U) - | ---- required by a bound in this + | ---- required by a bound in this function LL | where T : Convert | ^^^^^^^^^^ required by this bound in `test` help: consider specifying the generic arguments diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr index 6480e490e8b30..ed9b57cb1bd59 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr @@ -18,7 +18,7 @@ note: required by a bound in `foo` --> $DIR/bad-sized-cond.rs:6:15 | LL | pub fn foo() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for V: Sized, | ^^^^^ required by this bound in `foo` @@ -35,7 +35,7 @@ note: required by a bound in `bar` --> $DIR/bad-sized-cond.rs:12:15 | LL | pub fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for V: IntoIterator, | ^^^^^^^^^^^^ required by this bound in `bar` @@ -52,7 +52,7 @@ note: required by a bound in `bar` --> $DIR/bad-sized-cond.rs:12:15 | LL | pub fn bar() - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | for V: IntoIterator, | ^^^^^^^^^^^^ required by this bound in `bar` diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr index c3f4fd6a88e4d..7bd02550fb384 100644 --- a/tests/ui/traits/non_lifetime_binders/fail.stderr +++ b/tests/ui/traits/non_lifetime_binders/fail.stderr @@ -17,7 +17,7 @@ note: required by a bound in `fail` --> $DIR/fail.rs:10:15 | LL | fn fail() - | ---- required by a bound in this + | ---- required by a bound in this function LL | where LL | for T: Trait, | ^^^^^ required by this bound in `fail` @@ -33,7 +33,7 @@ note: required by a bound in `auto_trait` --> $DIR/fail.rs:15:15 | LL | fn auto_trait() - | ---------- required by a bound in this + | ---------- required by a bound in this function LL | where LL | for T: Send, | ^^^^ required by this bound in `auto_trait` diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs new file mode 100644 index 0000000000000..5ff7089b993a8 --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.rs @@ -0,0 +1,14 @@ +// edition:2021 +// check-pass + +// Checks that test_type_match code doesn't ICE when predicates have late-bound types + +#![feature(non_lifetime_binders)] +//~^ WARN is incomplete and may not be safe to use + +async fn walk2<'a, T: 'a>(_: T) +where + for F: 'a, +{} + +fn main() {} diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr new file mode 100644 index 0000000000000..3609bed28dffb --- /dev/null +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -0,0 +1,11 @@ +warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/type-match-with-late-bound.rs:6:12 + | +LL | #![feature(non_lifetime_binders)] + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #108185 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/traits/object/enforce-supertrait-projection.stderr b/tests/ui/traits/object/enforce-supertrait-projection.stderr index cbf0938665447..848b4e69a4bb8 100644 --- a/tests/ui/traits/object/enforce-supertrait-projection.stderr +++ b/tests/ui/traits/object/enforce-supertrait-projection.stderr @@ -16,7 +16,7 @@ note: required by a bound in `foo` --> $DIR/enforce-supertrait-projection.rs:15:8 | LL | fn foo(x: T::A) -> B - | --- required by a bound in this + | --- required by a bound in this function LL | where LL | T: Trait, | ^^^^^^^^^^^^ required by this bound in `foo` diff --git a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr index 96a2fdc54dbb4..164e88ede202f 100644 --- a/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr +++ b/tests/ui/transmutability/arrays/should_require_well_defined_layout.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/primitive_reprs_should_have_correct_length.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:14:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_pad_variants.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_respect_endianness.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/bool.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/primitives/numbers.stderr b/tests/ui/transmutability/primitives/numbers.stderr index 7cb7ca8e6db52..c04a0e82aa283 100644 --- a/tests/ui/transmutability/primitives/numbers.stderr +++ b/tests/ui/transmutability/primitives/numbers.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -41,7 +41,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -57,7 +57,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -73,7 +73,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -89,7 +89,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -105,7 +105,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -121,7 +121,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -137,7 +137,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -153,7 +153,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -169,7 +169,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -185,7 +185,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -201,7 +201,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -217,7 +217,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -233,7 +233,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -249,7 +249,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -265,7 +265,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -281,7 +281,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -297,7 +297,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -313,7 +313,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -329,7 +329,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -345,7 +345,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -361,7 +361,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -377,7 +377,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -393,7 +393,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -409,7 +409,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -425,7 +425,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -441,7 +441,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -457,7 +457,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -473,7 +473,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -489,7 +489,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -505,7 +505,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -521,7 +521,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -537,7 +537,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -553,7 +553,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -569,7 +569,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -585,7 +585,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -601,7 +601,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -617,7 +617,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -633,7 +633,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -649,7 +649,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -665,7 +665,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -681,7 +681,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -697,7 +697,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -713,7 +713,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -729,7 +729,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -745,7 +745,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -761,7 +761,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -777,7 +777,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -793,7 +793,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -809,7 +809,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -825,7 +825,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -841,7 +841,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -857,7 +857,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -873,7 +873,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -889,7 +889,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -905,7 +905,7 @@ note: required by a bound in `is_transmutable` --> $DIR/numbers.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/primitives/unit.stderr b/tests/ui/transmutability/primitives/unit.stderr index 8cabe44a0538c..988cd33b3bf7b 100644 --- a/tests/ui/transmutability/primitives/unit.stderr +++ b/tests/ui/transmutability/primitives/unit.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/unit.rs:12:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/references.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_require_well_defined_layout.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_pad_variants.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom $DIR/should_reject_contraction.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/unions/should_reject_disjoint.stderr b/tests/ui/transmutability/unions/should_reject_disjoint.stderr index 4323f9740665f..880e4cd89403e 100644 --- a/tests/ui/transmutability/unions/should_reject_disjoint.stderr +++ b/tests/ui/transmutability/unions/should_reject_disjoint.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/should_reject_disjoint.rs:13:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_maybe_transmutable` diff --git a/tests/ui/transmutability/unions/should_reject_intersecting.stderr b/tests/ui/transmutability/unions/should_reject_intersecting.stderr index e009888ae8d31..501760b080960 100644 --- a/tests/ui/transmutability/unions/should_reject_intersecting.stderr +++ b/tests/ui/transmutability/unions/should_reject_intersecting.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` @@ -25,7 +25,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_intersecting.rs:14:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr index d5d6d431b6f62..afbba653b8345 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_field.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr index a1ca2ced53f29..f14b5d8b2cb58 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_private_variant.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_private_variant.rs:13:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr index 4e648664d5abb..01ae8bea25618 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_field.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_field.rs:15:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr index bd72d64ccd75f..20a680a748456 100644 --- a/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr +++ b/tests/ui/transmutability/visibility/should_reject_if_dst_has_unreachable_ty.stderr @@ -21,7 +21,7 @@ note: required by a bound in `is_transmutable` --> $DIR/should_reject_if_dst_has_unreachable_ty.rs:15:14 | LL | pub fn is_transmutable() - | --------------- required by a bound in this + | --------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom // safety is NOT assumed | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `is_transmutable` diff --git a/tests/ui/transmute/transmute-padding-ice.stderr b/tests/ui/transmute/transmute-padding-ice.stderr index c9233890f7aa9..87fd4fb663086 100644 --- a/tests/ui/transmute/transmute-padding-ice.stderr +++ b/tests/ui/transmute/transmute-padding-ice.stderr @@ -9,7 +9,7 @@ note: required by a bound in `is_maybe_transmutable` --> $DIR/transmute-padding-ice.rs:11:14 | LL | pub fn is_maybe_transmutable() - | --------------------- required by a bound in this + | --------------------- required by a bound in this function LL | where LL | Dst: BikeshedIntrinsicFrom< | ______________^ diff --git a/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 635ebbb71d070..846a44ce4d7a9 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/tests/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -14,7 +14,7 @@ note: required by a bound in `foo` --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:4:14 | LL | fn foo(f: F) - | --- required by a bound in this + | --- required by a bound in this function LL | where F: Fn() | ^^^^ required by this bound in `foo` diff --git a/tests/ui/unsized/issue-71659.stderr b/tests/ui/unsized/issue-71659.stderr index d7b95f55769fd..b57b3015e475d 100644 --- a/tests/ui/unsized/issue-71659.stderr +++ b/tests/ui/unsized/issue-71659.stderr @@ -8,7 +8,7 @@ note: required by a bound in `Cast::cast` --> $DIR/issue-71659.rs:19:15 | LL | fn cast(&self) -> &T - | ---- required by a bound in this + | ---- required by a bound in this associated function LL | where LL | Self: CastTo, | ^^^^^^^^^ required by this bound in `Cast::cast` diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr index 30248a7a397b3..191a8ca8ebcf3 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr @@ -8,7 +8,7 @@ note: required by a bound in `called` --> $DIR/higher-ranked-fn-type.rs:12:25 | LL | fn called() - | ------ required by a bound in this + | ------ required by a bound in this function LL | where LL | for<'b> fn(&'b ()): Foo, | ^^^ required by this bound in `called` diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr index 268cef6e27567..f4c7acd5c5897 100644 --- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr +++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr @@ -8,7 +8,7 @@ note: required by a bound in `called` --> $DIR/higher-ranked-fn-type.rs:12:25 | LL | fn called() - | ------ required by a bound in this + | ------ required by a bound in this function LL | where LL | for<'b> fn(&'b ()): Foo, | ^^^ required by this bound in `called`