From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_middle/src/ty/parameterized.rs | 47 +++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'compiler/rustc_middle/src/ty/parameterized.rs') diff --git a/compiler/rustc_middle/src/ty/parameterized.rs b/compiler/rustc_middle/src/ty/parameterized.rs index 9e69544d2..24f3d1acf 100644 --- a/compiler/rustc_middle/src/ty/parameterized.rs +++ b/compiler/rustc_middle/src/ty/parameterized.rs @@ -1,15 +1,10 @@ use rustc_data_structures::fx::FxHashMap; -use rustc_hir::def_id::{DefId, DefIndex}; +use rustc_hir::def_id::DefIndex; use rustc_index::vec::{Idx, IndexVec}; -use crate::middle::exported_symbols::ExportedSymbol; -use crate::mir::Body; -use crate::ty::{ - self, Clause, Const, FnSig, GeneratorDiagnosticData, GenericPredicates, Predicate, TraitRef, Ty, -}; +use crate::ty; pub trait ParameterizedOverTcx: 'static { - #[allow(unused_lifetimes)] type Value<'tcx>; } @@ -37,6 +32,10 @@ impl ParameterizedOverTcx for ty::Binder<'static, T> { type Value<'tcx> = ty::Binder<'tcx, T::Value<'tcx>>; } +impl ParameterizedOverTcx for ty::EarlyBinder { + type Value<'tcx> = ty::EarlyBinder>; +} + #[macro_export] macro_rules! trivially_parameterized_over_tcx { ($($ty:ty),+ $(,)?) => { @@ -66,9 +65,10 @@ trivially_parameterized_over_tcx! { ty::ImplPolarity, ty::ReprOptions, ty::TraitDef, + ty::UnusedGenericParams, ty::Visibility, ty::adjustment::CoerceUnsizedInfo, - ty::fast_reject::SimplifiedTypeGen, + ty::fast_reject::SimplifiedType, rustc_ast::Attribute, rustc_ast::DelimArgs, rustc_attr::ConstStability, @@ -101,29 +101,28 @@ trivially_parameterized_over_tcx! { rustc_type_ir::Variance, } -// HACK(compiler-errors): This macro rule can only take an ident, -// not a path, due to parsing ambiguity reasons. That means we gotta -// import all of these types above. +// HACK(compiler-errors): This macro rule can only take a fake path, +// not a real, due to parsing ambiguity reasons. #[macro_export] macro_rules! parameterized_over_tcx { - ($($ident:ident),+ $(,)?) => { + ($($($fake_path:ident)::+),+ $(,)?) => { $( - impl $crate::ty::ParameterizedOverTcx for $ident<'static> { - type Value<'tcx> = $ident<'tcx>; + impl $crate::ty::ParameterizedOverTcx for $($fake_path)::+<'static> { + type Value<'tcx> = $($fake_path)::+<'tcx>; } )* } } parameterized_over_tcx! { - Ty, - FnSig, - GenericPredicates, - TraitRef, - Const, - Predicate, - Clause, - GeneratorDiagnosticData, - Body, - ExportedSymbol, + crate::middle::exported_symbols::ExportedSymbol, + crate::mir::Body, + ty::Ty, + ty::FnSig, + ty::GenericPredicates, + ty::TraitRef, + ty::Const, + ty::Predicate, + ty::Clause, + ty::GeneratorDiagnosticData, } -- cgit v1.2.3