Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some unstable const features do not indicate the right feature flag in their diagnostics #71797

Closed
RalfJung opened this issue May 2, 2020 · 1 comment · Fixed by #71902
Closed
Assignees
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented May 2, 2020

Generally, when one does something on nightly that would work with a feature gate, but the feature gate is missing, the error should indicate the missing gate. For some const features, that is currently not the case, for example:

#![feature(const_raw_ptr_deref)]
// missing gate: #![feature(const_mut_refs)]

const WRITE: () = unsafe {
    *std::ptr::null_mut() = 0;
};

fn main() {
}
error[E0019]: constant contains unimplemented expression type
 --> src/main.rs:5:5
  |
5 |     *std::ptr::null_mut() = 0;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

This got triggered by #71630, but is orthogonal to the discussion around the unleash flag in #71631.

(I did not try to exhaustively explore this issue for all const gates.)

Cc @rust-lang/wg-const-eval

This issue has been assigned to @mibac138 via this comment.

@RalfJung RalfJung added A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-diagnostics Area: Messages for errors, warnings, and lints requires-nightly This issue requires a nightly compiler in some way. labels May 2, 2020
@estebank estebank added D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2020
@mibac138
Copy link
Contributor

mibac138 commented May 4, 2020

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) A-diagnostics Area: Messages for errors, warnings, and lints D-papercut Diagnostics: An error or lint that needs small tweaks. D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants