Use TypeFoldable derive macro in librustc_traits.

This commit is contained in:
Camille GILLOT 2019-11-13 21:37:15 +01:00
parent 17692b5849
commit d5f5e706ef
3 changed files with 4 additions and 7 deletions

View File

@ -3819,6 +3819,7 @@ dependencies = [
"log",
"rustc",
"rustc_data_structures",
"rustc_macros",
"rustc_target",
"smallvec 1.0.0",
"syntax",

View File

@ -12,6 +12,7 @@ path = "lib.rs"
log = { version = "0.4" }
rustc = { path = "../librustc" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_macros = { path = "../librustc_macros" }
rustc_target = { path = "../librustc_target" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }

View File

@ -39,6 +39,7 @@ use rustc::ty::query::Providers;
use rustc::ty::subst::{GenericArg, GenericArgKind};
use rustc::mir::interpret::ConstValue;
use syntax_pos::DUMMY_SP;
use rustc_macros::TypeFoldable;
use std::fmt::{self, Debug};
use std::marker::PhantomData;
@ -66,18 +67,12 @@ crate struct UniverseMap;
crate type RegionConstraint<'tcx> = ty::OutlivesPredicate<GenericArg<'tcx>, ty::Region<'tcx>>;
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, TypeFoldable)]
crate struct ConstrainedSubst<'tcx> {
subst: CanonicalVarValues<'tcx>,
constraints: Vec<RegionConstraint<'tcx>>,
}
BraceStructTypeFoldableImpl! {
impl<'tcx> TypeFoldable<'tcx> for ConstrainedSubst<'tcx> {
subst, constraints
}
}
impl context::Context for ChalkArenas<'tcx> {
type CanonicalExClause = Canonical<'tcx, ChalkExClause<'tcx>>;