]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/def.rs
Tidying up and reformatting
[rust.git] / src / librustc / middle / def.rs
index 1a054c0f464aac9afb5a91adb6f007490a8969da..c60bb229be142aba8a94353ea6dac1ce6efde82c 100644 (file)
@@ -65,7 +65,7 @@ pub enum Def {
 ///     <T as Trait>::AssocX::AssocY::MethodOrAssocType
 ///           ^~~~~~~~~~~~~~  ^~~~~~~~~~~~~~~~~~~~~~~~~
 ///           base_def        depth = 2
-#[derive(Copy, Debug)]
+#[derive(Copy, Clone, Debug)]
 pub struct PathResolution {
     pub base_def: Def,
     pub last_private: LastPrivate,
@@ -85,6 +85,17 @@ pub fn full_def(&self) -> Def {
     pub fn def_id(&self) -> ast::DefId {
         self.full_def().def_id()
     }
+
+    pub fn new(base_def: Def,
+               last_private: LastPrivate,
+               depth: usize)
+               -> PathResolution {
+        PathResolution {
+            base_def: base_def,
+            last_private: last_private,
+            depth: depth,
+        }
+    }
 }
 
 // Definition mapping