Skip to content

Commit 4d81e9d

Browse files
committed
rustc: make DefPathData (and friends) Copy (now that it uses Symbol).
1 parent 23f890f commit 4d81e9d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc/hir/map/definitions.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl DefPathTable {
5353

5454
#[inline(always)]
5555
pub fn def_key(&self, index: DefIndex) -> DefKey {
56-
self.index_to_key[index.index()].clone()
56+
self.index_to_key[index.index()]
5757
}
5858

5959
#[inline(always)]
@@ -111,7 +111,7 @@ pub struct Definitions {
111111
/// A unique identifier that we can use to lookup a definition
112112
/// precisely. It combines the index of the definition's parent (if
113113
/// any) with a `DisambiguatedDefPathData`.
114-
#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
114+
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
115115
pub struct DefKey {
116116
/// The parent path.
117117
pub parent: Option<DefIndex>,
@@ -164,7 +164,7 @@ impl DefKey {
164164
/// between them. This introduces some artificial ordering dependency
165165
/// but means that if you have, e.g., two impls for the same type in
166166
/// the same module, they do get distinct `DefId`s.
167-
#[derive(Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
167+
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
168168
pub struct DisambiguatedDefPathData {
169169
pub data: DefPathData,
170170
pub disambiguator: u32
@@ -277,7 +277,7 @@ impl DefPath {
277277
}
278278
}
279279

280-
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
280+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
281281
pub enum DefPathData {
282282
// Root: these should only be used for the root nodes, because
283283
// they are treated specially by the `def_path` function.
@@ -472,7 +472,7 @@ impl Definitions {
472472

473473
// Find the next free disambiguator for this key.
474474
let disambiguator = {
475-
let next_disamb = self.next_disambiguator.entry((parent, data.clone())).or_insert(0);
475+
let next_disamb = self.next_disambiguator.entry((parent, data)).or_insert(0);
476476
let disambiguator = *next_disamb;
477477
*next_disamb = next_disamb.checked_add(1).expect("disambiguator overflow");
478478
disambiguator

0 commit comments

Comments
 (0)