Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 4225ead

Browse files
committed
Rustup to rustc 1.40.0-nightly (87cbf0a54 2019-11-01)
1 parent bd2c747 commit 4225ead

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

rust-toolchain

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nightly

src/mapping.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ use rustc::{
1212
ty::{AssocKind, GenericParamDef, GenericParamDefKind},
1313
};
1414
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
15+
use std::hash::{Hash, Hasher};
1516
use syntax::ast::Name;
1617

1718
/// A description of an item found in an inherent impl.
18-
#[derive(Debug, PartialEq, Eq, Hash)]
19+
#[derive(Debug, PartialEq)]
1920
pub struct InherentEntry {
2021
/// The parent item's `DefId`.
2122
pub parent_def_id: DefId,
@@ -25,6 +26,36 @@ pub struct InherentEntry {
2526
pub name: Name,
2627
}
2728

29+
impl Eq for InherentEntry {}
30+
31+
fn assert_impl_eq<T: Eq>() {}
32+
33+
#[allow(dead_code)]
34+
fn assert_inherent_entry_members_impl_eq() {
35+
assert_impl_eq::<DefId>();
36+
37+
// FIXME derive Eq again once AssocKind impls Eq again.
38+
// assert_impl_eq::<AssocKind>();
39+
40+
assert_impl_eq::<Name>();
41+
}
42+
43+
impl Hash for InherentEntry {
44+
fn hash<H: Hasher>(&self, hasher: &mut H) {
45+
self.parent_def_id.hash(hasher);
46+
47+
// FIXME derive Hash again once AssocKind derives Hash again.
48+
match self.kind {
49+
AssocKind::Const => 0u8.hash(hasher),
50+
AssocKind::Method => 1u8.hash(hasher),
51+
AssocKind::OpaqueTy => 2u8.hash(hasher),
52+
AssocKind::Type => 3u8.hash(hasher),
53+
}
54+
55+
self.name.hash(hasher);
56+
}
57+
}
58+
2859
/// A set of pairs of impl- and item `DefId`s for inherent associated items.
2960
pub type InherentImplSet = BTreeSet<(DefId, DefId)>;
3061

0 commit comments

Comments
 (0)