Skip to content

Commit

Permalink
Explain how unused constants may still cause a hard error
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 25, 2018
1 parent 1c5ff29 commit 13d94ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_mir/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
match tcx.describe_def(def_id) {
// constants never produce a hard error at the definition site. Anything else is
// a backwards compatibility hazard (and will break old versions of winapi for sure)
//
// note that validation may still cause a hard error on this very same constant,
// because any code that existed before validation could not have failed validation
// thus preventing such a hard error from being a backwards compatibility hazard
Some(Def::Const(_)) | Some(Def::AssociatedConst(_)) => {
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
err.report_as_lint(
Expand Down

0 comments on commit 13d94ee

Please sign in to comment.