Skip to content

Commit

Permalink
Use ast::Mutability
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Nov 13, 2019
1 parent 5e048da commit 7552bd6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustc_passes/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use rustc::hir;
use rustc::session::Session;
use rustc::ty::TyCtxt;
use rustc::ty::query::Providers;
use syntax::ast::Mutability;
use syntax::span_err;
use syntax_pos::Span;

Expand All @@ -35,8 +36,8 @@ impl ConstKind {
let owner = hir_map.body_owner(body.id());
let const_kind = match hir_map.body_owner_kind(owner) {
hir::BodyOwnerKind::Const => Self::Const,
hir::BodyOwnerKind::Static(hir::Mutability::MutMutable) => Self::StaticMut,
hir::BodyOwnerKind::Static(hir::Mutability::MutImmutable) => Self::Static,
hir::BodyOwnerKind::Static(Mutability::Mutable) => Self::StaticMut,
hir::BodyOwnerKind::Static(Mutability::Immutable) => Self::Static,

hir::BodyOwnerKind::Fn if is_const_fn(owner) => Self::ConstFn,
hir::BodyOwnerKind::Fn | hir::BodyOwnerKind::Closure => return None,
Expand Down

0 comments on commit 7552bd6

Please sign in to comment.