bors
68411c9554
Auto merge of #119627 - oli-obk:const_prop_lint_n̵o̵n̵sense, r=cjgillot
...
Remove all ConstPropNonsense
We track all locals and projections on them ourselves within the const propagator and only use the InterpCx to actually do some low level operations or read from constants (via `OpTy` we get for said constants).
This helps moving the const prop lint out from the normal pipeline and running it just based on borrowck information. This in turn allows us to make progress on https://github.com/rust-lang/rust/pull/108730#issuecomment-1875557745
there are various follow up cleanups that can be done after this PR (e.g. not matching on Rvalue twice and doing binop checks twice), but lets try landing this one first.
r? `@RalfJung`
2024-01-25 03:16:07 +00:00
Oli Scherer
1f398abcb6
const prop nonsense eliminated
2024-01-23 16:34:43 +00:00
Ralf Jung
0288a0bfa0
raw pointers are not references
2024-01-22 09:28:00 +01:00
Ralf Jung
2f1a8e2d7a
const-eval interner: from-scratch rewrite using mutability information from provenance rather than types
2024-01-22 09:28:00 +01:00
Nicholas Nethercote
505c1371d0
Rename some Diagnostic
setters.
...
`Diagnostic` has 40 methods that return `&mut Self` and could be
considered setters. Four of them have a `set_` prefix. This doesn't seem
necessary for a type that implements the builder pattern. This commit
removes the `set_` prefixes on those four methods.
2024-01-03 19:40:20 +11:00
Nicholas Nethercote
99472c7049
Remove Session
methods that duplicate DiagCtxt
methods.
...
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Nicholas Nethercote
e7724a2e31
Add level
arg to into_diagnostic
.
...
And make all hand-written `IntoDiagnostic` impls generic, by using
`DiagnosticBuilder::new(dcx, level, ...)` instead of e.g.
`dcx.struct_err(...)`.
This means the `create_*` functions are the source of the error level.
This change will let us remove `struct_diagnostic`.
Note: `#[rustc_lint_diagnostics]` is added to `DiagnosticBuilder::new`,
it's necessary to pass diagnostics tests now that it's used in
`into_diagnostic` functions.
2023-12-19 09:19:25 +11:00
Nicholas Nethercote
f6aa418c9f
Rename many DiagCtxt
and EarlyDiagCtxt
locals.
2023-12-18 16:06:22 +11:00
Nicholas Nethercote
f422dca3ae
Rename many DiagCtxt
arguments.
2023-12-18 16:06:22 +11:00
Nicholas Nethercote
09af8a667c
Rename Session::span_diagnostic
as Session::dcx
.
2023-12-18 16:06:21 +11:00
Nicholas Nethercote
cde19c016e
Rename Handler
as DiagCtxt
.
2023-12-18 16:06:19 +11:00
Ralf Jung
4d93590d59
compile-time evaluation: emit a lint when a write through an immutable pointer occurs
2023-12-07 17:46:36 +01:00
Nicholas Nethercote
a179a53565
Use Session::diagnostic
in more places.
2023-12-02 09:01:35 +11:00
Ralf Jung
e24835c6e0
more precise error for 'based on misaligned pointer' case
2023-10-15 18:13:33 +02:00
Ralf Jung
f3f9b795bd
place evaluation: require the original pointer to be aligned if an access happens
2023-10-15 18:13:31 +02:00
Ralf Jung
b1ebf002c3
don't UB on dangling ptr deref, instead check inbounds on projections
2023-10-15 18:12:46 +02:00
Ralf Jung
9ac8b363e3
don't point at const usage site for resolution-time errors
...
also share the code that emits the actual error
2023-09-14 22:34:05 +02:00
Ralf Jung
f993ddc079
give extra context to ABI mismatch errors
2023-09-09 15:36:44 +02:00
Ralf Jung
a09df43d9f
move marking-locals-live out of push_stack_frame, so it happens with argument passing
...
this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30 13:46:54 +02:00
Ralf Jung
a7132bf387
interpret: remove incomplete protection against invalid where clauses
2023-08-08 10:35:22 +02:00
Ralf Jung
7767cbb3b0
const validation: point at where we found a pointer but expected an integer
2023-08-02 18:51:50 +02:00
Ralf Jung
8496292dda
properly track why we checked whether a pointer is in-bounds
...
also simplify the in-bounds checking in Miri's borrow trackers
2023-08-01 17:57:13 +02:00
Ralf Jung
a2bcafa500
interpret: refactor projection code to work on a common trait, and use that for visitors
2023-07-25 14:30:58 +02:00
Ralf Jung
a593de4fab
interpret: support projecting into Place::Local without force_allocation
2023-07-24 15:35:47 +02:00
David Tolnay
5bbf0a8306
Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"
...
This reverts commit 557359f925
, reversing
changes made to 1e6c09a803
.
2023-07-21 22:35:57 -07:00
Moulins
76c49aead6
support non-null pointer niches in CTFE
2023-07-21 03:31:45 +02:00
Deadbeef
89c24af133
Better error for non const PartialEq
call generated by match
2023-06-18 05:24:38 +00:00
Deadbeef
f6c2bc5c24
fix diagnostic message
2023-06-01 14:45:19 +00:00
Deadbeef
f964b46451
improve debug message by eagerly translating
2023-06-01 14:45:19 +00:00
Deadbeef
4f83717cf7
Use translatable diagnostics in rustc_const_eval
2023-06-01 14:45:18 +00:00
Oli Scherer
05eae08233
Remove const eval limit and implement an exponential backoff lint instead
2023-05-31 10:24:17 +00:00
David Wood
d1fcf61117
errors: generate typed identifiers in each crate
...
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.
Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:53 +00:00
Nilstrieb
c65ebae221
Migrate all diagnostics
2022-10-23 10:09:44 +02:00
Jhonny Bill Mena
a3396b2070
UPDATE - rename DiagnosticHandler macro to Diagnostic
2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
19b348fed4
UPDATE - rename DiagnosticHandler trait to IntoDiagnostic
2022-09-21 11:39:52 -04:00
nidnogg
649749c7b0
Addressing last comment on PR review
2022-08-22 12:14:49 -03:00
nidnogg
13abae2deb
Switched errors to diags according to latest PRs
2022-08-22 00:02:36 -03:00
nidnogg
0a58b26e8a
Hotfix ftl err name, added check for err.code in create_feature_err
2022-08-21 23:22:55 -03:00
nidnogg
4c82845b3a
Fixed failing tests (missing labels), added automatic error code in create_feature_err() builder
2022-08-21 23:22:55 -03:00
nidnogg
d1f14ee1b0
Added several more migrations under ops.rs, failing some tests though
2022-08-21 23:22:54 -03:00
nidnogg
33e8aaf830
Migration on ops.rs for unstable const functions
2022-08-21 23:22:53 -03:00
nidnogg
70ea98633e
Migrated Unallowed function pointer calls in interpreter/ops
2022-08-21 23:22:51 -03:00
nidnogg
6af8e46a9a
Finished const_eval module migration, moving onto sibling folders
2022-08-21 23:22:50 -03:00
Xiretza
7f3a6fd7f6
Replace #[lint/warning/error] with #[diag]
2022-08-21 09:17:43 +02:00
Michael Goulet
f97f2a47ff
Migrate MutDeref, TransientMutBorrow diagnostics
2022-07-08 03:48:10 +00:00
Michael Goulet
584e5d4c4f
Migrate PanicNonStr, RawPtrComparison, RawPtrToInt diagnostics
2022-07-08 03:47:59 +00:00
Michael Goulet
c48f482813
Migrate StaticAccess diagnostic
2022-07-08 03:47:46 +00:00
Michael Goulet
1c4afbd1de
Migrate NonConstOp diagnostic
2022-07-08 03:47:28 +00:00
Michael Goulet
934079fd9e
Migrate unstable-in-stable diagnostic
2022-07-08 03:39:08 +00:00