diff options
| author | Oliver S̶c̶h̶n̶e̶i̶d̶e̶r Scherer <github35764891676564198441@oli-obk.de> | 2018-10-17 10:06:03 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2018-10-25 17:20:39 +0200 |
| commit | 13d94ee1154770caa8e027394fa2221db2dfe5c3 (patch) | |
| tree | d098e3eba08d6566594cb4499abb2b72f5857128 /src | |
| parent | 1c5ff292fcaac24ae2bab9d24fc70e34b112cbbe (diff) | |
| download | rust-13d94ee1154770caa8e027394fa2221db2dfe5c3.tar.gz rust-13d94ee1154770caa8e027394fa2221db2dfe5c3.zip | |
Explain how unused constants may still cause a hard error
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/const_eval.rs | 4 |
1 files changed, 4 insertions, 0 deletions
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( |
