From 13d94ee1154770caa8e027394fa2221db2dfe5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20S=CC=B6c=CC=B6h=CC=B6n=CC=B6e=CC=B6i=CC=B6d=CC=B6?= =?UTF-8?q?e=CC=B6r=20Scherer?= Date: Wed, 17 Oct 2018 10:06:03 +0200 Subject: [PATCH] Explain how unused constants may still cause a hard error --- src/librustc_mir/const_eval.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 830f2fb089a..731feae6231 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -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(