Skip to content

Commit daff3e3

Browse files
committed
Merge hir::ImplPolarity into ast::ImplPolarity.
1 parent 738faad commit daff3e3

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

src/librustc/hir/lowering/item.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl LoweringContext<'_> {
434434

435435
hir::ItemKind::Impl(
436436
unsafety,
437-
self.lower_impl_polarity(polarity),
437+
polarity,
438438
self.lower_defaultness(defaultness, true /* [1] */),
439439
generics,
440440
trait_ref,
@@ -1011,13 +1011,6 @@ impl LoweringContext<'_> {
10111011
}
10121012
}
10131013

1014-
fn lower_impl_polarity(&mut self, i: ImplPolarity) -> hir::ImplPolarity {
1015-
match i {
1016-
ImplPolarity::Positive => hir::ImplPolarity::Positive,
1017-
ImplPolarity::Negative => hir::ImplPolarity::Negative,
1018-
}
1019-
}
1020-
10211014
fn record_body(&mut self, params: HirVec<hir::Param>, value: hir::Expr) -> hir::BodyId {
10221015
let body = hir::Body {
10231016
generator_kind: self.generator_kind,

src/librustc/hir/mod.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use syntax_pos::{Span, DUMMY_SP, MultiSpan};
2121
use syntax::source_map::Spanned;
2222
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect};
2323
use syntax::ast::{Attribute, Label, LitKind, StrStyle, FloatTy, IntTy, UintTy};
24-
pub use syntax::ast::{Mutability, Constness, Unsafety, Movability, CaptureBy, IsAuto};
24+
pub use syntax::ast::{Mutability, Constness, Unsafety, Movability, CaptureBy, IsAuto, ImplPolarity};
2525
use syntax::attr::{InlineAttr, OptimizeAttr};
2626
use syntax::symbol::{Symbol, kw};
2727
use syntax::tokenstream::TokenStream;
@@ -2155,24 +2155,6 @@ impl Defaultness {
21552155
}
21562156
}
21572157

2158-
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, HashStable)]
2159-
pub enum ImplPolarity {
2160-
/// `impl Trait for Type`
2161-
Positive,
2162-
/// `impl !Trait for Type`
2163-
Negative,
2164-
}
2165-
2166-
impl fmt::Debug for ImplPolarity {
2167-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2168-
f.write_str(match self {
2169-
ImplPolarity::Positive => "positive",
2170-
ImplPolarity::Negative => "negative",
2171-
})
2172-
}
2173-
}
2174-
2175-
21762158
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
21772159
pub enum FunctionRetTy {
21782160
/// Return type is not specified.

src/librustc/ich/impls_syntax.rs

+1
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ impl_stable_hash_for!(enum ::syntax::ast::AttrStyle { Outer, Inner });
171171
impl_stable_hash_for!(enum ::syntax::ast::Movability { Static, Movable });
172172
impl_stable_hash_for!(enum ::syntax::ast::CaptureBy { Value, Ref });
173173
impl_stable_hash_for!(enum ::syntax::ast::IsAuto { Yes, No });
174+
impl_stable_hash_for!(enum ::syntax::ast::ImplPolarity { Positive, Negative });
174175

175176
impl<'a> HashStable<StableHashingContext<'a>> for [ast::Attribute] {
176177
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {

0 commit comments

Comments
 (0)