Merge hir::ImplPolarity into ast::ImplPolarity.

This commit is contained in:
Camille GILLOT 2019-11-09 18:38:35 +01:00
parent 738faadc31
commit daff3e346c
3 changed files with 3 additions and 27 deletions

View File

@ -434,7 +434,7 @@ fn lower_item_kind(
hir::ItemKind::Impl(
unsafety,
self.lower_impl_polarity(polarity),
polarity,
self.lower_defaultness(defaultness, true /* [1] */),
generics,
trait_ref,
@ -1011,13 +1011,6 @@ fn lower_defaultness(&self, d: Defaultness, has_value: bool) -> hir::Defaultness
}
}
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,

View File

@ -21,7 +21,7 @@
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 @@ pub fn is_default(&self) -> bool {
}
}
#[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.

View File

@ -171,6 +171,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
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) {