-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #99054 - Dylan-DPC:rollup-0zuhhds, r=Dylan-DPC
Rollup of 4 pull requests Successful merges: - #98533 (Add a `-Zdump-drop-tracking-cfg` debugging flag) - #98654 (An optimization for `pest-2.1.3`) - #98657 (Migrate some diagnostics from `rustc_const_eval` to `SessionDiagnostic`) - #98794 (Highlight conflicting param-env candidates) Failed merges: - #98957 ( don't allow ZST in ScalarInt ) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
28 changed files
with
372 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
use rustc_hir::ConstContext; | ||
use rustc_macros::SessionDiagnostic; | ||
use rustc_span::Span; | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::unstable_in_stable)] | ||
pub(crate) struct UnstableInStable { | ||
pub gate: String, | ||
#[primary_span] | ||
pub span: Span, | ||
#[suggestion( | ||
const_eval::unstable_sugg, | ||
code = "#[rustc_const_unstable(feature = \"...\", issue = \"...\")]\n", | ||
applicability = "has-placeholders" | ||
)] | ||
#[suggestion( | ||
const_eval::bypass_sugg, | ||
code = "#[rustc_allow_const_fn_unstable({gate})]\n", | ||
applicability = "has-placeholders" | ||
)] | ||
pub attr_span: Span, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::thread_local_access, code = "E0625")] | ||
pub(crate) struct NonConstOpErr { | ||
#[primary_span] | ||
pub span: Span, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::static_access, code = "E0013")] | ||
#[help] | ||
pub(crate) struct StaticAccessErr { | ||
#[primary_span] | ||
pub span: Span, | ||
pub kind: ConstContext, | ||
#[note(const_eval::teach_note)] | ||
#[help(const_eval::teach_help)] | ||
pub teach: Option<()>, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::raw_ptr_to_int)] | ||
#[note] | ||
#[note(const_eval::note2)] | ||
pub(crate) struct RawPtrToIntErr { | ||
#[primary_span] | ||
pub span: Span, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::raw_ptr_comparison)] | ||
#[note] | ||
pub(crate) struct RawPtrComparisonErr { | ||
#[primary_span] | ||
pub span: Span, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::panic_non_str)] | ||
pub(crate) struct PanicNonStrErr { | ||
#[primary_span] | ||
pub span: Span, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::mut_deref, code = "E0658")] | ||
pub(crate) struct MutDerefErr { | ||
#[primary_span] | ||
pub span: Span, | ||
pub kind: ConstContext, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::transient_mut_borrow, code = "E0658")] | ||
pub(crate) struct TransientMutBorrowErr { | ||
#[primary_span] | ||
pub span: Span, | ||
pub kind: ConstContext, | ||
} | ||
|
||
#[derive(SessionDiagnostic)] | ||
#[error(const_eval::transient_mut_borrow_raw, code = "E0658")] | ||
pub(crate) struct TransientMutBorrowErrRaw { | ||
#[primary_span] | ||
pub span: Span, | ||
pub kind: ConstContext, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
compiler/rustc_error_messages/locales/en-US/builtin_macros.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
builtin_macros-requires-cfg-pattern = | ||
builtin-macros-requires-cfg-pattern = | ||
macro requires a cfg-pattern as an argument | ||
.label = cfg-pattern required | ||
builtin_macros-expected-one-cfg-pattern = expected 1 cfg-pattern | ||
builtin-macros-expected-one-cfg-pattern = expected 1 cfg-pattern |
31 changes: 31 additions & 0 deletions
31
compiler/rustc_error_messages/locales/en-US/const_eval.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const-eval-unstable-in-stable = | ||
const-stable function cannot use `#[feature({$gate})]` | ||
.unstable-sugg = if it is not part of the public API, make this function unstably const | ||
.bypass-sugg = otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks | ||
const-eval-thread-local-access = | ||
thread-local statics cannot be accessed at compile-time | ||
const-eval-static-access = | ||
{$kind}s cannot refer to statics | ||
.help = consider extracting the value of the `static` to a `const`, and referring to that | ||
.teach-note = `static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable. | ||
.teach-help = To fix this, the value can be extracted to a `const` and then used. | ||
const-eval-raw-ptr-to-int = | ||
pointers cannot be cast to integers during const eval | ||
.note = at compile-time, pointers do not have an integer value | ||
.note2 = avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior | ||
const-eval-raw-ptr-comparison = | ||
pointers cannot be reliably compared during const eval | ||
.note = see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information | ||
const-eval-panic-non-str = argument to `panic!()` in a const context must have type `&str` | ||
const-eval-mut-deref = | ||
mutation through a reference is not allowed in {$kind}s | ||
const-eval-transient-mut-borrow = mutable references are not allowed in {$kind}s | ||
const-eval-transient-mut-borrow-raw = raw mutable references are not allowed in {$kind}s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.