Explain how unused constants may still cause a hard error

This commit is contained in:
Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer 2018-10-17 10:06:03 +02:00 committed by Oliver Scherer
parent 1c5ff292fc
commit 13d94ee115

View File

@ -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(