]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_resolve/resolve_imports.rs
Refactor away resolve_imports::Shadowable and rename shadowable -> is_prelude
[rust.git] / src / librustc_resolve / resolve_imports.rs
index 61e0add86020e9b4305505cc7f91f81270140a1d..eaa0753b8ce15844933761a72769da48f0302bd5 100644 (file)
@@ -57,13 +57,6 @@ pub fn single(target: Name, source: Name) -> Self {
     }
 }
 
-/// Whether an import can be shadowed by another import.
-#[derive(Debug,PartialEq,Clone,Copy)]
-pub enum Shadowable {
-    Always,
-    Never,
-}
-
 /// One import directive.
 #[derive(Debug,Clone)]
 pub struct ImportDirective {
@@ -72,7 +65,7 @@ pub struct ImportDirective {
     pub span: Span,
     pub id: NodeId,
     pub is_public: bool, // see note in ImportResolutionPerNamespace about how to use this
-    pub shadowable: Shadowable,
+    pub is_prelude: bool,
 }
 
 impl ImportDirective {
@@ -81,7 +74,7 @@ pub fn new(module_path: Vec<Name>,
                span: Span,
                id: NodeId,
                is_public: bool,
-               shadowable: Shadowable)
+               is_prelude: bool)
                -> ImportDirective {
         ImportDirective {
             module_path: module_path,
@@ -89,7 +82,7 @@ pub fn new(module_path: Vec<Name>,
             span: span,
             id: id,
             is_public: is_public,
-            shadowable: shadowable,
+            is_prelude: is_prelude,
         }
     }
 
@@ -105,7 +98,7 @@ fn import<'a>(&self,
         if let GlobImport = self.subclass {
             modifiers = modifiers | DefModifiers::GLOB_IMPORTED;
         }
-        if self.shadowable == Shadowable::Always {
+        if self.is_prelude {
             modifiers = modifiers | DefModifiers::PRELUDE;
         }