Skip to content

Commit 13d94ee

Browse files
committed
Explain how unused constants may still cause a hard error
1 parent 1c5ff29 commit 13d94ee

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/const_eval.rs

+4
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
662662
match tcx.describe_def(def_id) {
663663
// constants never produce a hard error at the definition site. Anything else is
664664
// a backwards compatibility hazard (and will break old versions of winapi for sure)
665+
//
666+
// note that validation may still cause a hard error on this very same constant,
667+
// because any code that existed before validation could not have failed validation
668+
// thus preventing such a hard error from being a backwards compatibility hazard
665669
Some(Def::Const(_)) | Some(Def::AssociatedConst(_)) => {
666670
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
667671
err.report_as_lint(

0 commit comments

Comments
 (0)