Merge hir::Constness into ast::Constness.

This commit is contained in:
Camille GILLOT 2019-11-09 17:54:28 +01:00
parent ed640c6a27
commit 1f21c080eb
2 changed files with 3 additions and 16 deletions

View File

@ -19,7 +19,7 @@
use syntax::attr;
use syntax::ast::*;
use syntax::visit::{self, Visitor};
use syntax::source_map::{respan, DesugaringKind, Spanned};
use syntax::source_map::{respan, DesugaringKind};
use syntax::symbol::{kw, sym};
use syntax_pos::Span;
@ -1286,7 +1286,7 @@ fn lower_fn_header(&mut self, h: FnHeader) -> hir::FnHeader {
hir::FnHeader {
unsafety: self.lower_unsafety(h.unsafety),
asyncness: self.lower_asyncness(h.asyncness.node),
constness: self.lower_constness(h.constness),
constness: h.constness.node,
abi: self.lower_abi(h.abi),
}
}
@ -1318,13 +1318,6 @@ pub(super) fn lower_unsafety(&mut self, u: Unsafety) -> hir::Unsafety {
}
}
fn lower_constness(&mut self, c: Spanned<Constness>) -> hir::Constness {
match c.node {
Constness::Const => hir::Constness::Const,
Constness::NotConst => hir::Constness::NotConst,
}
}
fn lower_asyncness(&mut self, a: IsAsync) -> hir::IsAsync {
match a {
IsAsync::Async { .. } => hir::IsAsync::Async,

View File

@ -22,7 +22,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;
pub use syntax::ast::{Mutability, Constness};
use syntax::attr::{InlineAttr, OptimizeAttr};
use syntax::symbol::{Symbol, kw};
use syntax::tokenstream::TokenStream;
@ -2170,12 +2170,6 @@ pub fn prefix_str(&self) -> &'static str {
}
}
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum Constness {
Const,
NotConst,
}
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub enum Defaultness {
Default { has_value: bool },