Skip to content

Commit

Permalink
Merge pull request rust-lang#111 from bjorn3/rustup
Browse files Browse the repository at this point in the history
Rustup to rustc 1.40.0-nightly (87cbf0a 2019-11-01)
  • Loading branch information
ibabushkin authored Nov 5, 2019
2 parents bd2c747 + 6c7227d commit 08f28be
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ If you are already using Rust nightly and have successfully installed tools like

```sh
$ rustup update nightly
$ rustup component add rustc-dev --toolchain nightly
$ cargo +nightly install semverver
```

Expand All @@ -43,6 +44,7 @@ You can also install the newest version of the tool from git:

```sh
$ rustup update nightly
$ rustup component add rustc-dev --toolchain nightly
$ cargo +nightly install --git https://github.com/rust-dev-tools/rust-semverver
```

Expand Down
2 changes: 2 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set -ex
export RUST_BACKTRACE=full
#export RUST_TEST_NOCAPTURE=1

rustup component add rustc-dev

cargo build
cargo test --verbose -- --nocapture

Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly
33 changes: 32 additions & 1 deletion src/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ use rustc::{
ty::{AssocKind, GenericParamDef, GenericParamDefKind},
};
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
use std::hash::{Hash, Hasher};
use syntax::ast::Name;

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

impl Eq for InherentEntry {}

fn assert_impl_eq<T: Eq>() {}

#[allow(dead_code)]
fn assert_inherent_entry_members_impl_eq() {
assert_impl_eq::<DefId>();

// FIXME derive Eq again once AssocKind impls Eq again.
// assert_impl_eq::<AssocKind>();

assert_impl_eq::<Name>();
}

impl Hash for InherentEntry {
fn hash<H: Hasher>(&self, hasher: &mut H) {
self.parent_def_id.hash(hasher);

// FIXME derive Hash again once AssocKind derives Hash again.
match self.kind {
AssocKind::Const => 0u8.hash(hasher),
AssocKind::Method => 1u8.hash(hasher),
AssocKind::OpaqueTy => 2u8.hash(hasher),
AssocKind::Type => 3u8.hash(hasher),
}

self.name.hash(hasher);
}
}

/// A set of pairs of impl- and item `DefId`s for inherent associated items.
pub type InherentImplSet = BTreeSet<(DefId, DefId)>;

Expand Down

0 comments on commit 08f28be

Please sign in to comment.