Skip to content

Commit

Permalink
fix --emit=mir: StructCtors are functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Feb 9, 2019
1 parent fed4c5d commit 27ce224
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/librustc/hir/map/mod.rs
Expand Up @@ -375,6 +375,10 @@ impl<'hir> Map<'hir> {
let def_id = self.local_def_id(item.id);
Some(Def::Const(def_id))
}
Node::StructCtor(variant) => {
let def_id = self.local_def_id(variant.id());
Some(Def::Fn(def_id))
}
Node::Field(_) |
Node::Expr(_) |
Node::Stmt(_) |
Expand All @@ -383,7 +387,6 @@ impl<'hir> Map<'hir> {
Node::TraitRef(_) |
Node::Pat(_) |
Node::Binding(_) |
Node::StructCtor(_) |
Node::Lifetime(_) |
Node::Visibility(_) |
Node::Block(_) |
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/util/pretty.rs
Expand Up @@ -594,7 +594,7 @@ fn write_mir_sig(
) -> io::Result<()> {
use rustc::hir::def::Def;

trace!("write_mir_sig: {:?} {:?}", src, tcx.hir().get_if_local(src.def_id()));
trace!("write_mir_sig: {:?}", src.instance);
let descr = tcx.describe_def(src.def_id()).unwrap();
match (descr, src.promoted) {
(_, Some(i)) => write!(w, "{:?} in", i)?,
Expand Down

0 comments on commit 27ce224

Please sign in to comment.