Skip to content

Commit

Permalink
fix rebase fallout: AnonConsts are Consts, and Methods are functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 9, 2019
1 parent 276219e commit cd21696
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/librustc/hir/map/mod.rs
Expand Up @@ -371,8 +371,11 @@ impl<'hir> Map<'hir> {
let def_id = self.local_def_id(variant.node.data.id());
Some(Def::Variant(def_id))
}
Node::AnonConst(item) => {
let def_id = self.local_def_id(item.id);
Some(Def::Const(def_id))
}
Node::Field(_) |
Node::AnonConst(_) |
Node::Expr(_) |
Node::Stmt(_) |
Node::PathSegment(_) |
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/util/pretty.rs
Expand Up @@ -575,11 +575,11 @@ fn write_mir_sig(
) -> io::Result<()> {
use rustc::hir::def::Def;

debug!("write_mir_sig: {:?}", src.def_id);
debug!("write_mir_sig: {:?} {:?}", src.def_id, tcx.hir().get_if_local(src.def_id));
let descr = tcx.describe_def(src.def_id).unwrap();
match (descr, src.promoted) {
(_, Some(i)) => write!(w, "{:?} in", i)?,
(Def::Fn(_), _) => write!(w, "fn")?,
(Def::Fn(_), _) | (Def::Method(_), _) => write!(w, "fn")?,
(Def::Const(_), _) => write!(w, "const")?,
(Def::Static(_, /*is_mutbl*/false), _) => write!(w, "static")?,
(Def::Static(_, /*is_mutbl*/true), _) => write!(w, "static mut")?,
Expand All @@ -592,7 +592,7 @@ fn write_mir_sig(
})?;

match (descr, src.promoted) {
(Def::Fn(_), None) => {
(Def::Fn(_), None) | (Def::Method(_), None) => {
write!(w, "(")?;

// fn argument types.
Expand Down

0 comments on commit cd21696

Please sign in to comment.