Skip to content

Commit

Permalink
Stub display impl for Origin
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvittal committed May 2, 2019
1 parent 7da9eee commit 2a0426c
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/librustc_mir/util/borrowck_errors.rs
Expand Up @@ -12,26 +12,10 @@ pub enum Origin {
}

impl fmt::Display for Origin {
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
// If the user passed `-Z borrowck=compare`, then include
// origin info as part of the error report,
// otherwise
let display_origin = ty::tls::with_opt(|opt_tcx| {
if let Some(tcx) = opt_tcx {
tcx.sess.opts.borrowck_mode == BorrowckMode::Compare
} else {
false
}
});
if display_origin {
match *self {
Origin::Mir => write!(w, " (Mir)"),
Origin::Ast => write!(w, " (Ast)"),
}
} else {
// Print no origin info
Ok(())
}
fn fmt(&self, _w: &mut fmt::Formatter<'_>) -> fmt::Result {
// FIXME(chrisvittal) remove Origin entirely
// Print no origin info
Ok(())
}
}

Expand Down

0 comments on commit 2a0426c

Please sign in to comment.