about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2019-11-09 18:38:35 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2019-11-10 12:40:44 +0100
commitdaff3e346c4d8a79fdf20fcc92a7919c28f53840 (patch)
tree9079f339cbf8be8a1cb380f0dc4d2fb7ec8cca7d
parent738faadc31ea4fdd60cfb81c9c07d7ad499997ab (diff)
downloadrust-daff3e346c4d8a79fdf20fcc92a7919c28f53840.tar.gz
rust-daff3e346c4d8a79fdf20fcc92a7919c28f53840.zip
Merge hir::ImplPolarity into ast::ImplPolarity.
-rw-r--r--src/librustc/hir/lowering/item.rs9
-rw-r--r--src/librustc/hir/mod.rs20
-rw-r--r--src/librustc/ich/impls_syntax.rs1
3 files changed, 3 insertions, 27 deletions
diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs
index c40834d12de..beb10edd148 100644
--- a/src/librustc/hir/lowering/item.rs
+++ b/src/librustc/hir/lowering/item.rs
@@ -434,7 +434,7 @@ impl LoweringContext<'_> {
 
                 hir::ItemKind::Impl(
                     unsafety,
-                    self.lower_impl_polarity(polarity),
+                    polarity,
                     self.lower_defaultness(defaultness, true /* [1] */),
                     generics,
                     trait_ref,
@@ -1011,13 +1011,6 @@ impl LoweringContext<'_> {
         }
     }
 
-    fn lower_impl_polarity(&mut self, i: ImplPolarity) -> hir::ImplPolarity {
-        match i {
-            ImplPolarity::Positive => hir::ImplPolarity::Positive,
-            ImplPolarity::Negative => hir::ImplPolarity::Negative,
-        }
-    }
-
     fn record_body(&mut self, params: HirVec<hir::Param>, value: hir::Expr) -> hir::BodyId {
         let body = hir::Body {
             generator_kind: self.generator_kind,
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 6f60f7ffdcf..bbd3b40e1be 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -21,7 +21,7 @@ use syntax_pos::{Span, DUMMY_SP, MultiSpan};
 use syntax::source_map::Spanned;
 use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect};
 use syntax::ast::{Attribute, Label, LitKind, StrStyle, FloatTy, IntTy, UintTy};
-pub use syntax::ast::{Mutability, Constness, Unsafety, Movability, CaptureBy, IsAuto};
+pub use syntax::ast::{Mutability, Constness, Unsafety, Movability, CaptureBy, IsAuto, ImplPolarity};
 use syntax::attr::{InlineAttr, OptimizeAttr};
 use syntax::symbol::{Symbol, kw};
 use syntax::tokenstream::TokenStream;
@@ -2155,24 +2155,6 @@ impl Defaultness {
     }
 }
 
-#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, HashStable)]
-pub enum ImplPolarity {
-    /// `impl Trait for Type`
-    Positive,
-    /// `impl !Trait for Type`
-    Negative,
-}
-
-impl fmt::Debug for ImplPolarity {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        f.write_str(match self {
-            ImplPolarity::Positive => "positive",
-            ImplPolarity::Negative => "negative",
-        })
-    }
-}
-
-
 #[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
 pub enum FunctionRetTy {
     /// Return type is not specified.
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index 075b7409f4f..b3d82e5522c 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -171,6 +171,7 @@ impl_stable_hash_for!(enum ::syntax::ast::AttrStyle { Outer, Inner });
 impl_stable_hash_for!(enum ::syntax::ast::Movability { Static, Movable });
 impl_stable_hash_for!(enum ::syntax::ast::CaptureBy { Value, Ref });
 impl_stable_hash_for!(enum ::syntax::ast::IsAuto { Yes, No });
+impl_stable_hash_for!(enum ::syntax::ast::ImplPolarity { Positive, Negative });
 
 impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
     fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {