1
Fork 0

Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk

make const_err a future incompat lint

This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.

This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).

~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~

Cc `@rust-lang/wg-const-eval`
This commit is contained in:
Mara Bos 2021-02-03 18:51:12 +01:00 committed by GitHub
commit 00dabfbd28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
107 changed files with 961 additions and 270 deletions

View file

@ -255,6 +255,10 @@ declare_lint! {
pub CONST_ERR,
Deny,
"constant evaluation encountered erroneous expression",
@future_incompatible = FutureIncompatibleInfo {
reference: "issue #71800 <https://github.com/rust-lang/rust/issues/71800>",
edition: None,
};
report_in_external_macro
}