提交 e00ebd72 编写于 作者: C Camille GILLOT

Derive HashStable in librustc.

上级 618b01f9
......@@ -2081,7 +2081,8 @@ pub struct ReprFlags: u8 {
});
/// Represents the repr options provided by the user,
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Default)]
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable,
Default, HashStable)]
pub struct ReprOptions {
pub int: Option<attr::IntType>,
pub align: Option<Align>,
......@@ -2089,13 +2090,6 @@ pub struct ReprOptions {
pub flags: ReprFlags,
}
impl_stable_hash_for!(struct ReprOptions {
align,
pack,
int,
flags
});
impl ReprOptions {
pub fn new(tcx: TyCtxt<'_>, did: DefId) -> ReprOptions {
let mut flags = ReprFlags::empty();
......@@ -3439,17 +3433,13 @@ pub struct CrateInherentImpls {
pub inherent_impls: DefIdMap<Vec<DefId>>,
}
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)]
pub struct SymbolName {
// FIXME: we don't rely on interning or equality here - better have
// this be a `&'tcx str`.
pub name: Symbol
}
impl_stable_hash_for!(struct self::SymbolName {
name
});
impl SymbolName {
pub fn new(name: &str) -> SymbolName {
SymbolName {
......
......@@ -1379,21 +1379,20 @@ pub enum InferTy {
pub struct BoundVar { .. }
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug,
RustcEncodable, RustcDecodable, HashStable)]
pub struct BoundTy {
pub var: BoundVar,
pub kind: BoundTyKind,
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug,
RustcEncodable, RustcDecodable, HashStable)]
pub enum BoundTyKind {
Anon,
Param(Symbol),
}
impl_stable_hash_for!(struct BoundTy { var, kind });
impl_stable_hash_for!(enum self::BoundTyKind { Anon, Param(a) });
impl From<BoundVar> for BoundTy {
fn from(var: BoundVar) -> Self {
BoundTy {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册