Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts")
 - #91984 (Remove `in_band_lifetimes` from `rustc_middle`)
 - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets)
 - #92042 (Enable `#[thread_local]` for all windows-msvc targets)
 - #92071 (Update example code for Vec::splice to change the length)
 - #92077 (rustdoc: Remove unused `collapsed` field)
 - #92081 (rustdoc: Remove unnecessary `need_backline` function)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors
2021-12-19 12:36:56 +00:00
77 changed files with 228 additions and 277 deletions

View File

@@ -23,13 +23,13 @@ pub struct Match<'tcx> {
param_env: ty::ParamEnv<'tcx>,
}
impl Match<'tcx> {
impl<'tcx> Match<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Match<'tcx> {
Match { tcx, param_env }
}
}
impl TypeRelation<'tcx> for Match<'tcx> {
impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
fn tag(&self) -> &'static str {
"Match"
}

View File

@@ -83,7 +83,7 @@ pub struct Adjustment<'tcx> {
pub target: Ty<'tcx>,
}
impl Adjustment<'tcx> {
impl<'tcx> Adjustment<'tcx> {
pub fn is_region_borrow(&self) -> bool {
matches!(self.kind, Adjust::Borrow(AutoBorrow::Ref(..)))
}

View File

@@ -139,7 +139,7 @@ impl<'tcx> AssocItems<'tcx> {
/// Multiple items may have the same name if they are in different `Namespace`s. For example,
/// an associated type can have the same name as a method. Use one of the `find_by_name_and_*`
/// methods below if you know which item you are looking for.
pub fn filter_by_name(
pub fn filter_by_name<'a>(
&'a self,
tcx: TyCtxt<'a>,
ident: Ident,

View File

@@ -156,7 +156,7 @@ pub struct CapturedPlace<'tcx> {
pub mutability: hir::Mutability,
}
impl CapturedPlace<'tcx> {
impl<'tcx> CapturedPlace<'tcx> {
pub fn to_string(&self, tcx: TyCtxt<'tcx>) -> String {
place_to_string_for_capture(tcx, &self.place)
}
@@ -328,7 +328,7 @@ pub struct CaptureInfo<'tcx> {
pub capture_kind: UpvarCapture<'tcx>,
}
pub fn place_to_string_for_capture(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String {
pub fn place_to_string_for_capture<'tcx>(tcx: TyCtxt<'tcx>, place: &HirPlace<'tcx>) -> String {
let mut curr_string: String = match place.base {
HirPlaceBase::Upvar(upvar_id) => tcx.hir().name(upvar_id.var_path.hir_id).to_string(),
_ => bug!("Capture_information should only contain upvars"),

View File

@@ -76,7 +76,11 @@ pub trait RefDecodable<'tcx, D: TyDecoder<'tcx>> {
}
/// Encode the given value or a previously cached shorthand.
pub fn encode_with_shorthand<E, T, M>(encoder: &mut E, value: &T, cache: M) -> Result<(), E::Error>
pub fn encode_with_shorthand<'tcx, E, T, M>(
encoder: &mut E,
value: &T,
cache: M,
) -> Result<(), E::Error>
where
E: TyEncoder<'tcx>,
M: for<'b> Fn(&'b mut E) -> &'b mut FxHashMap<T, usize>,

View File

@@ -234,7 +234,7 @@ impl ScalarInt {
}
#[inline]
pub fn try_to_machine_usize(&self, tcx: TyCtxt<'tcx>) -> Result<u64, Size> {
pub fn try_to_machine_usize<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Result<u64, Size> {
Ok(self.to_bits(tcx.data_layout.pointer_size)? as u64)
}
}

View File

@@ -27,7 +27,7 @@ pub enum ValTree<'tcx> {
Branch(&'tcx [ValTree<'tcx>]),
}
impl ValTree<'tcx> {
impl<'tcx> ValTree<'tcx> {
pub fn zst() -> Self {
Self::Branch(&[])
}

View File

@@ -824,7 +824,7 @@ pub struct CanonicalUserTypeAnnotation<'tcx> {
/// Canonicalized user type annotation.
pub type CanonicalUserType<'tcx> = Canonical<'tcx, UserType<'tcx>>;
impl CanonicalUserType<'tcx> {
impl<'tcx> CanonicalUserType<'tcx> {
/// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`,
/// i.e., each thing is mapped to a canonical variable with the same index.
pub fn is_identity(&self) -> bool {
@@ -1893,7 +1893,7 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn debug_stats(self) -> impl std::fmt::Debug + 'tcx {
struct DebugStats<'tcx>(TyCtxt<'tcx>);
impl std::fmt::Debug for DebugStats<'tcx> {
impl<'tcx> std::fmt::Debug for DebugStats<'tcx> {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
sty_debug_print!(
fmt,
@@ -2711,7 +2711,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
}
impl TyCtxtAt<'tcx> {
impl<'tcx> TyCtxtAt<'tcx> {
/// Constructs a `TyKind::Error` type and registers a `delay_span_bug` to ensure it gets used.
#[track_caller]
pub fn ty_error(self) -> Ty<'tcx> {

View File

@@ -37,7 +37,7 @@ struct RegionEraserVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl TypeFolder<'tcx> for RegionEraserVisitor<'tcx> {
impl<'tcx> TypeFolder<'tcx> for RegionEraserVisitor<'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx
}

View File

@@ -22,7 +22,7 @@ impl FlagComputation {
result
}
pub fn for_predicate(binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) -> FlagComputation {
pub fn for_predicate<'tcx>(binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) -> FlagComputation {
let mut result = FlagComputation::new();
result.add_predicate(binder);
result
@@ -216,7 +216,7 @@ impl FlagComputation {
}
}
fn add_predicate(&mut self, binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) {
fn add_predicate(&mut self, binder: ty::Binder<'_, ty::PredicateKind<'_>>) {
self.bound_computation(binder, |computation, atom| computation.add_predicate_atom(atom));
}
@@ -310,7 +310,7 @@ impl FlagComputation {
}
}
fn add_unevaluated_const<P>(&mut self, ct: ty::Unevaluated<'tcx, P>) {
fn add_unevaluated_const<P>(&mut self, ct: ty::Unevaluated<'_, P>) {
// The generic arguments of unevaluated consts are a bit special,
// see the `rustc-dev-guide` for more information.
//

View File

@@ -199,7 +199,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
}
}
impl TypeFoldable<'tcx> for hir::Constness {
impl<'tcx> TypeFoldable<'tcx> for hir::Constness {
fn try_super_fold_with<F: TypeFolder<'tcx>>(self, _: &mut F) -> Result<Self, F::Error> {
Ok(self)
}
@@ -1060,13 +1060,13 @@ struct Shifter<'tcx> {
amount: u32,
}
impl Shifter<'tcx> {
impl<'tcx> Shifter<'tcx> {
pub fn new(tcx: TyCtxt<'tcx>, amount: u32) -> Self {
Shifter { tcx, current_index: ty::INNERMOST, amount }
}
}
impl TypeFolder<'tcx> for Shifter<'tcx> {
impl<'tcx> TypeFolder<'tcx> for Shifter<'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx> {
self.tcx
}
@@ -1257,7 +1257,7 @@ struct HasTypeFlagsVisitor<'tcx> {
flags: ty::TypeFlags,
}
impl std::fmt::Debug for HasTypeFlagsVisitor<'tcx> {
impl<'tcx> std::fmt::Debug for HasTypeFlagsVisitor<'tcx> {
fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.flags.fmt(fmt)
}
@@ -1454,7 +1454,7 @@ struct LateBoundRegionsCollector<'tcx> {
just_constrained: bool,
}
impl LateBoundRegionsCollector<'tcx> {
impl<'tcx> LateBoundRegionsCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx>, just_constrained: bool) -> Self {
LateBoundRegionsCollector {
tcx,

View File

@@ -30,7 +30,7 @@ pub enum DefIdForest {
/// Tests whether a slice of roots contains a given DefId.
#[inline]
fn slice_contains(tcx: TyCtxt<'tcx>, slice: &[DefId], id: DefId) -> bool {
fn slice_contains<'tcx>(tcx: TyCtxt<'tcx>, slice: &[DefId], id: DefId) -> bool {
slice.iter().any(|root_id| tcx.is_descendant_of(id, *root_id))
}

View File

@@ -635,7 +635,7 @@ fn polymorphize<'tcx>(
tcx: TyCtxt<'tcx>,
}
impl ty::TypeFolder<'tcx> for PolymorphizationFolder<'tcx> {
impl<'tcx> ty::TypeFolder<'tcx> for PolymorphizationFolder<'tcx> {
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
self.tcx
}

View File

@@ -168,7 +168,7 @@ impl PrimitiveExt for Primitive {
/// Return an *integer* type matching this primitive.
/// Useful in particular when dealing with enum discriminants.
#[inline]
fn to_int_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
fn to_int_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
Int(i, signed) => i.to_ty(tcx, signed),
Pointer => tcx.types.usize,
@@ -2195,9 +2195,9 @@ pub trait LayoutOf<'tcx>: LayoutOfHelpers<'tcx> {
}
}
impl<C: LayoutOfHelpers<'tcx>> LayoutOf<'tcx> for C {}
impl<'tcx, C: LayoutOfHelpers<'tcx>> LayoutOf<'tcx> for C {}
impl LayoutOfHelpers<'tcx> for LayoutCx<'tcx, TyCtxt<'tcx>> {
impl<'tcx> LayoutOfHelpers<'tcx> for LayoutCx<'tcx, TyCtxt<'tcx>> {
type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>;
#[inline]
@@ -2206,7 +2206,7 @@ impl LayoutOfHelpers<'tcx> for LayoutCx<'tcx, TyCtxt<'tcx>> {
}
}
impl LayoutOfHelpers<'tcx> for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
impl<'tcx> LayoutOfHelpers<'tcx> for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx>> {
type LayoutOfResult = Result<TyAndLayout<'tcx>, LayoutError<'tcx>>;
#[inline]
@@ -2282,7 +2282,7 @@ where
TyAndLayout(TyAndLayout<'tcx>),
}
fn field_ty_or_layout(
fn field_ty_or_layout<'tcx>(
this: TyAndLayout<'tcx>,
cx: &(impl HasTyCtxt<'tcx> + HasParamEnv<'tcx>),
i: usize,
@@ -2724,7 +2724,7 @@ impl<'tcx> ty::Instance<'tcx> {
/// with `-Cpanic=abort` will look like they can't unwind when in fact they
/// might (from a foreign exception or similar).
#[inline]
pub fn fn_can_unwind(
pub fn fn_can_unwind<'tcx>(
tcx: TyCtxt<'tcx>,
codegen_fn_attr_flags: CodegenFnAttrFlags,
abi: SpecAbi,
@@ -2842,7 +2842,7 @@ pub enum FnAbiError<'tcx> {
AdjustForForeignAbi(call::AdjustForForeignAbiError),
}
impl From<LayoutError<'tcx>> for FnAbiError<'tcx> {
impl<'tcx> From<LayoutError<'tcx>> for FnAbiError<'tcx> {
fn from(err: LayoutError<'tcx>) -> Self {
Self::Layout(err)
}
@@ -2942,7 +2942,7 @@ pub trait FnAbiOf<'tcx>: FnAbiOfHelpers<'tcx> {
}
}
impl<C: FnAbiOfHelpers<'tcx>> FnAbiOf<'tcx> for C {}
impl<'tcx, C: FnAbiOfHelpers<'tcx>> FnAbiOf<'tcx> for C {}
fn fn_abi_of_fn_ptr<'tcx>(
tcx: TyCtxt<'tcx>,

View File

@@ -852,7 +852,7 @@ pub trait ToPredicate<'tcx> {
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx>;
}
impl ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
impl<'tcx> ToPredicate<'tcx> for Binder<'tcx, PredicateKind<'tcx>> {
#[inline(always)]
fn to_predicate(self, tcx: TyCtxt<'tcx>) -> Predicate<'tcx> {
tcx.mk_predicate(self)
@@ -1418,7 +1418,7 @@ impl<'tcx> ParamEnv<'tcx> {
// FIXME(ecstaticmorse): Audit all occurrences of `without_const().to_predicate(tcx)` to ensure that
// the constness of trait bounds is being propagated correctly.
impl PolyTraitRef<'tcx> {
impl<'tcx> PolyTraitRef<'tcx> {
#[inline]
pub fn with_constness(self, constness: BoundConstness) -> PolyTraitPredicate<'tcx> {
self.map_bound(|trait_ref| ty::TraitPredicate {

View File

@@ -183,7 +183,7 @@ impl<'tcx> NormalizeAfterErasingRegionsFolder<'tcx> {
}
}
impl TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
impl<'tcx> TypeFolder<'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
@@ -228,7 +228,7 @@ impl<'tcx> TryNormalizeAfterErasingRegionsFolder<'tcx> {
}
}
impl TypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
impl<'tcx> TypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
type Error = NormalizationError<'tcx>;
fn tcx(&self) -> TyCtxt<'tcx> {
@@ -236,7 +236,7 @@ impl TypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
}
}
impl FallibleTypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
impl<'tcx> FallibleTypeFolder<'tcx> for TryNormalizeAfterErasingRegionsFolder<'tcx> {
fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
match self.try_normalize_generic_arg_after_erasing_regions(ty.into()) {
Ok(t) => Ok(t.expect_ty()),

View File

@@ -37,7 +37,7 @@ pub trait Printer<'tcx>: Sized {
type DynExistential;
type Const;
fn tcx(&'a self) -> TyCtxt<'tcx>;
fn tcx<'a>(&'a self) -> TyCtxt<'tcx>;
fn print_def_path(
self,

View File

@@ -1513,7 +1513,7 @@ pub struct FmtPrinterData<'a, 'tcx, F> {
pub name_resolver: Option<Box<&'a dyn Fn(ty::TyVid) -> Option<String>>>,
}
impl<F> Deref for FmtPrinter<'a, 'tcx, F> {
impl<'a, 'tcx, F> Deref for FmtPrinter<'a, 'tcx, F> {
type Target = FmtPrinterData<'a, 'tcx, F>;
fn deref(&self) -> &Self::Target {
&self.0
@@ -1526,7 +1526,7 @@ impl<F> DerefMut for FmtPrinter<'_, '_, F> {
}
}
impl<F> FmtPrinter<'a, 'tcx, F> {
impl<'a, 'tcx, F> FmtPrinter<'a, 'tcx, F> {
pub fn new(tcx: TyCtxt<'tcx>, fmt: F, ns: Namespace) -> Self {
FmtPrinter(Box::new(FmtPrinterData {
tcx,
@@ -1563,7 +1563,7 @@ fn guess_def_namespace(tcx: TyCtxt<'_>, def_id: DefId) -> Namespace {
}
}
impl TyCtxt<'t> {
impl<'t> TyCtxt<'t> {
/// Returns a string identifying this `DefId`. This string is
/// suitable for user output.
pub fn def_path_str(self, def_id: DefId) -> String {
@@ -1585,7 +1585,7 @@ impl<F: fmt::Write> fmt::Write for FmtPrinter<'_, '_, F> {
}
}
impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
impl<'tcx, F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
type Error = fmt::Error;
type Path = Self;
@@ -1594,7 +1594,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
type DynExistential = Self;
type Const = Self;
fn tcx(&'a self) -> TyCtxt<'tcx> {
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
self.tcx
}
@@ -1792,7 +1792,7 @@ impl<F: fmt::Write> Printer<'tcx> for FmtPrinter<'_, 'tcx, F> {
}
}
impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
impl<'tcx, F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
fn infer_ty_name(&self, id: ty::TyVid) -> Option<String> {
self.0.name_resolver.as_ref().and_then(|func| func(id))
}
@@ -2058,7 +2058,7 @@ impl<'a, 'tcx> ty::TypeFolder<'tcx> for RegionFolder<'a, 'tcx> {
// HACK(eddyb) limited to `FmtPrinter` because of `binder_depth`,
// `region_index` and `used_region_names`.
impl<F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
impl<'tcx, F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
pub fn name_all_regions<T>(
mut self,
value: &ty::Binder<'tcx, T>,
@@ -2312,7 +2312,8 @@ where
macro_rules! forward_display_to_print {
($($ty:ty),+) => {
$(impl fmt::Display for $ty {
// Some of the $ty arguments may not actually use 'tcx
$(#[allow(unused_lifetimes)] impl<'tcx> fmt::Display for $ty {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
ty::tls::with(|tcx| {
tcx.lift(*self)
@@ -2360,7 +2361,7 @@ impl fmt::Display for ty::RegionKind {
#[derive(Copy, Clone, TypeFoldable, Lift)]
pub struct TraitRefPrintOnlyTraitPath<'tcx>(ty::TraitRef<'tcx>);
impl fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> {
impl<'tcx> fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
@@ -2372,13 +2373,13 @@ impl fmt::Debug for TraitRefPrintOnlyTraitPath<'tcx> {
#[derive(Copy, Clone, TypeFoldable, Lift)]
pub struct TraitRefPrintOnlyTraitName<'tcx>(ty::TraitRef<'tcx>);
impl fmt::Debug for TraitRefPrintOnlyTraitName<'tcx> {
impl<'tcx> fmt::Debug for TraitRefPrintOnlyTraitName<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}
impl ty::TraitRef<'tcx> {
impl<'tcx> ty::TraitRef<'tcx> {
pub fn print_only_trait_path(self) -> TraitRefPrintOnlyTraitPath<'tcx> {
TraitRefPrintOnlyTraitPath(self)
}
@@ -2388,7 +2389,7 @@ impl ty::TraitRef<'tcx> {
}
}
impl ty::Binder<'tcx, ty::TraitRef<'tcx>> {
impl<'tcx> ty::Binder<'tcx, ty::TraitRef<'tcx>> {
pub fn print_only_trait_path(self) -> ty::Binder<'tcx, TraitRefPrintOnlyTraitPath<'tcx>> {
self.map_bound(|tr| tr.print_only_trait_path())
}

View File

@@ -69,7 +69,7 @@ pub struct TyCtxtAt<'tcx> {
pub span: Span,
}
impl Deref for TyCtxtAt<'tcx> {
impl<'tcx> Deref for TyCtxtAt<'tcx> {
type Target = TyCtxt<'tcx>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
@@ -82,7 +82,7 @@ pub struct TyCtxtEnsure<'tcx> {
pub tcx: TyCtxt<'tcx>,
}
impl TyCtxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Returns a transparent wrapper for `TyCtxt`, which ensures queries
/// are executed instead of just returning their results.
#[inline(always)]
@@ -207,7 +207,7 @@ macro_rules! define_callbacks {
$($(#[$attr])* pub $name: QueryCacheStore<query_storage::$name<$tcx>>,)*
}
impl TyCtxtEnsure<$tcx> {
impl<$tcx> TyCtxtEnsure<$tcx> {
$($(#[$attr])*
#[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) {
@@ -225,7 +225,7 @@ macro_rules! define_callbacks {
})*
}
impl TyCtxt<$tcx> {
impl<$tcx> TyCtxt<$tcx> {
$($(#[$attr])*
#[inline(always)]
#[must_use]
@@ -235,7 +235,7 @@ macro_rules! define_callbacks {
})*
}
impl TyCtxtAt<$tcx> {
impl<$tcx> TyCtxtAt<$tcx> {
$($(#[$attr])*
#[inline(always)]
pub fn $name(self, key: query_helper_param_ty!($($K)*)) -> query_stored::$name<$tcx>
@@ -357,7 +357,7 @@ mod sealed {
use sealed::IntoQueryParam;
impl TyCtxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param();
self.opt_def_kind(def_id)
@@ -365,7 +365,7 @@ impl TyCtxt<'tcx> {
}
}
impl TyCtxtAt<'tcx> {
impl<'tcx> TyCtxtAt<'tcx> {
pub fn def_kind(self, def_id: impl IntoQueryParam<DefId>) -> DefKind {
let def_id = def_id.into_query_param();
self.opt_def_kind(def_id)

View File

@@ -132,7 +132,7 @@ pub fn relate_type_and_mut<'tcx, R: TypeRelation<'tcx>>(
}
}
pub fn relate_substs<R: TypeRelation<'tcx>>(
pub fn relate_substs<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R,
variances: Option<&[ty::Variance]>,
a_subst: SubstsRef<'tcx>,
@@ -353,7 +353,7 @@ impl<'tcx> Relate<'tcx> for Ty<'tcx> {
/// The main "type relation" routine. Note that this does not handle
/// inference artifacts, so you should filter those out before calling
/// it.
pub fn super_relate_tys<R: TypeRelation<'tcx>>(
pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R,
a: Ty<'tcx>,
b: Ty<'tcx>,
@@ -526,7 +526,7 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
/// The main "const relation" routine. Note that this does not handle
/// inference artifacts, so you should filter those out before calling
/// it.
pub fn super_relate_consts<R: TypeRelation<'tcx>>(
pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R,
a: &'tcx ty::Const<'tcx>,
b: &'tcx ty::Const<'tcx>,
@@ -599,7 +599,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
if is_match { Ok(a) } else { Err(TypeError::ConstMismatch(expected_found(relation, a, b))) }
}
fn check_const_value_eq<R: TypeRelation<'tcx>>(
fn check_const_value_eq<'tcx, R: TypeRelation<'tcx>>(
relation: &mut R,
a_val: ConstValue<'tcx>,
b_val: ConstValue<'tcx>,
@@ -832,7 +832,7 @@ impl<'tcx> Relate<'tcx> for ty::ProjectionPredicate<'tcx> {
///////////////////////////////////////////////////////////////////////////
// Error handling
pub fn expected_found<R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T>
pub fn expected_found<'tcx, R, T>(relation: &mut R, a: T, b: T) -> ExpectedFound<T>
where
R: TypeRelation<'tcx>,
{

View File

@@ -47,19 +47,19 @@ impl fmt::Debug for ty::UpvarId {
}
}
impl fmt::Debug for ty::UpvarBorrow<'tcx> {
impl<'tcx> fmt::Debug for ty::UpvarBorrow<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "UpvarBorrow({:?}, {:?})", self.kind, self.region)
}
}
impl fmt::Debug for ty::ExistentialTraitRef<'tcx> {
impl<'tcx> fmt::Debug for ty::ExistentialTraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
}
}
impl fmt::Debug for ty::adjustment::Adjustment<'tcx> {
impl<'tcx> fmt::Debug for ty::adjustment::Adjustment<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?} -> {}", self.kind, self.target)
}
@@ -111,7 +111,7 @@ impl fmt::Debug for ty::FreeRegion {
}
}
impl fmt::Debug for ty::FnSig<'tcx> {
impl<'tcx> fmt::Debug for ty::FnSig<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({:?}; c_variadic: {})->{:?}", self.inputs(), self.c_variadic, self.output())
}
@@ -129,13 +129,13 @@ impl fmt::Debug for ty::RegionVid {
}
}
impl fmt::Debug for ty::TraitRef<'tcx> {
impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
}
}
impl fmt::Debug for Ty<'tcx> {
impl<'tcx> fmt::Debug for Ty<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
with_no_trimmed_paths(|| fmt::Display::fmt(self, f))
}
@@ -153,7 +153,7 @@ impl fmt::Debug for ty::ParamConst {
}
}
impl fmt::Debug for ty::TraitPredicate<'tcx> {
impl<'tcx> fmt::Debug for ty::TraitPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let ty::BoundConstness::ConstIfConst = self.constness {
write!(f, "~const ")?;
@@ -162,19 +162,19 @@ impl fmt::Debug for ty::TraitPredicate<'tcx> {
}
}
impl fmt::Debug for ty::ProjectionPredicate<'tcx> {
impl<'tcx> fmt::Debug for ty::ProjectionPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ProjectionPredicate({:?}, {:?})", self.projection_ty, self.ty)
}
}
impl fmt::Debug for ty::Predicate<'tcx> {
impl<'tcx> fmt::Debug for ty::Predicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.kind())
}
}
impl fmt::Debug for ty::PredicateKind<'tcx> {
impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ty::PredicateKind::Trait(ref a) => a.fmt(f),

View File

@@ -198,7 +198,7 @@ pub enum TyKind<'tcx> {
Error(DelaySpanBugEmitted),
}
impl TyKind<'tcx> {
impl<'tcx> TyKind<'tcx> {
#[inline]
pub fn is_primitive(&self) -> bool {
matches!(self, Bool | Char | Int(_) | Uint(_) | Float(_))

View File

@@ -67,7 +67,7 @@ impl<'tcx> GenericArgKind<'tcx> {
}
}
impl fmt::Debug for GenericArg<'tcx> {
impl<'tcx> fmt::Debug for GenericArg<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.unpack() {
GenericArgKind::Lifetime(lt) => lt.fmt(f),

View File

@@ -981,7 +981,7 @@ impl<'tcx> ExplicitSelf<'tcx> {
/// Returns a list of types such that the given type needs drop if and only if
/// *any* of the returned types need drop. Returns `Err(AlwaysRequiresDrop)` if
/// this type always needs drop.
pub fn needs_drop_components(
pub fn needs_drop_components<'tcx>(
ty: Ty<'tcx>,
target_layout: &TargetDataLayout,
) -> Result<SmallVec<[Ty<'tcx>; 2]>, AlwaysRequiresDrop> {
@@ -1083,7 +1083,7 @@ pub struct AlwaysRequiresDrop;
/// Normalizes all opaque types in the given value, replacing them
/// with their underlying types.
pub fn normalize_opaque_types(
pub fn normalize_opaque_types<'tcx>(
tcx: TyCtxt<'tcx>,
val: &'tcx List<ty::Predicate<'tcx>>,
) -> &'tcx List<ty::Predicate<'tcx>> {

View File

@@ -69,7 +69,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
}
}
impl GenericArg<'tcx> {
impl<'tcx> GenericArg<'tcx> {
/// Iterator that walks `self` and any types reachable from
/// `self`, in depth-first order. Note that just walks the types
/// that appear in `self`, it does not descend into the fields of