Small cleanup in parameterized
This commit is contained in:
parent
984eab57f7
commit
153419b78f
1 changed files with 16 additions and 22 deletions
|
@ -2,14 +2,9 @@ use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_hir::def_id::{DefId, DefIndex};
|
use rustc_hir::def_id::{DefId, DefIndex};
|
||||||
use rustc_index::vec::{Idx, IndexVec};
|
use rustc_index::vec::{Idx, IndexVec};
|
||||||
|
|
||||||
use crate::middle::exported_symbols::ExportedSymbol;
|
use crate::ty;
|
||||||
use crate::mir::Body;
|
|
||||||
use crate::ty::{
|
|
||||||
self, Clause, Const, FnSig, GeneratorDiagnosticData, GenericPredicates, Predicate, TraitRef, Ty,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub trait ParameterizedOverTcx: 'static {
|
pub trait ParameterizedOverTcx: 'static {
|
||||||
#[allow(unused_lifetimes)]
|
|
||||||
type Value<'tcx>;
|
type Value<'tcx>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,29 +95,28 @@ trivially_parameterized_over_tcx! {
|
||||||
rustc_type_ir::Variance,
|
rustc_type_ir::Variance,
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK(compiler-errors): This macro rule can only take an ident,
|
// HACK(compiler-errors): This macro rule can only take a fake path,
|
||||||
// not a path, due to parsing ambiguity reasons. That means we gotta
|
// not a real, due to parsing ambiguity reasons.
|
||||||
// import all of these types above.
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! parameterized_over_tcx {
|
macro_rules! parameterized_over_tcx {
|
||||||
($($ident:ident),+ $(,)?) => {
|
($($($fake_path:ident)::+),+ $(,)?) => {
|
||||||
$(
|
$(
|
||||||
impl $crate::ty::ParameterizedOverTcx for $ident<'static> {
|
impl $crate::ty::ParameterizedOverTcx for $($fake_path)::+<'static> {
|
||||||
type Value<'tcx> = $ident<'tcx>;
|
type Value<'tcx> = $($fake_path)::+<'tcx>;
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parameterized_over_tcx! {
|
parameterized_over_tcx! {
|
||||||
Ty,
|
crate::middle::exported_symbols::ExportedSymbol,
|
||||||
FnSig,
|
crate::mir::Body,
|
||||||
GenericPredicates,
|
ty::Ty,
|
||||||
TraitRef,
|
ty::FnSig,
|
||||||
Const,
|
ty::GenericPredicates,
|
||||||
Predicate,
|
ty::TraitRef,
|
||||||
Clause,
|
ty::Const,
|
||||||
GeneratorDiagnosticData,
|
ty::Predicate,
|
||||||
Body,
|
ty::Clause,
|
||||||
ExportedSymbol,
|
ty::GeneratorDiagnosticData,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue