diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-25 20:03:17 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-25 20:03:17 +0300 |
| commit | 4d81e9dd2ff873df9bb67da5c05d54b18d78b983 (patch) | |
| tree | 024ad95c195c26e121708e6364381c6fde43870a | |
| parent | 23f890f10202a71168c6424da0cdf94135d3c40c (diff) | |
| download | rust-4d81e9dd2ff873df9bb67da5c05d54b18d78b983.tar.gz rust-4d81e9dd2ff873df9bb67da5c05d54b18d78b983.zip | |
rustc: make DefPathData (and friends) Copy (now that it uses Symbol).
| -rw-r--r-- | src/librustc/hir/map/definitions.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 5993a97c40d..40a51b92473 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -53,7 +53,7 @@ impl DefPathTable { #[inline(always)] pub fn def_key(&self, index: DefIndex) -> DefKey { - self.index_to_key[index.index()].clone() + self.index_to_key[index.index()] } #[inline(always)] @@ -111,7 +111,7 @@ pub struct Definitions { /// A unique identifier that we can use to lookup a definition /// precisely. It combines the index of the definition's parent (if /// any) with a `DisambiguatedDefPathData`. -#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)] pub struct DefKey { /// The parent path. pub parent: Option<DefIndex>, @@ -164,7 +164,7 @@ impl DefKey { /// between them. This introduces some artificial ordering dependency /// but means that if you have, e.g., two impls for the same type in /// the same module, they do get distinct `DefId`s. -#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)] pub struct DisambiguatedDefPathData { pub data: DefPathData, pub disambiguator: u32 @@ -277,7 +277,7 @@ impl DefPath { } } -#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub enum DefPathData { // Root: these should only be used for the root nodes, because // they are treated specially by the `def_path` function. @@ -472,7 +472,7 @@ impl Definitions { // Find the next free disambiguator for this key. let disambiguator = { - let next_disamb = self.next_disambiguator.entry((parent, data.clone())).or_insert(0); + let next_disamb = self.next_disambiguator.entry((parent, data)).or_insert(0); let disambiguator = *next_disamb; *next_disamb = next_disamb.checked_add(1).expect("disambiguator overflow"); disambiguator |
