Ralf Jung
0702701297
allow mutable references in const values when they point to no memory
2024-02-16 10:09:12 +01:00
Oli Scherer
73b38c661d
Do not allocate a second "background" alloc id for the main allocation of a static.
...
Instead we re-use the static's alloc id within the interpreter for its initializer to refer to the `Allocation` that only exists within the interpreter.
2024-02-15 10:25:18 +00:00
Matthias Krüger
09bbcd6667
Rollup merge of #120883 - RalfJung:extern-static-err, r=oli-obk
...
interpret: rename ReadExternStatic → ExternStatic
This error shows up for reads and writes, so `ReadExternStatic` is misleading.
2024-02-11 01:37:56 +01:00
Matthias Krüger
e82e087582
Rollup merge of #120882 - RalfJung:set-discriminant, r=compiler-errors
...
interpret/write_discriminant: when encoding niched variant, ensure the stored value matches
Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/487
2024-02-11 01:37:55 +01:00
Ralf Jung
77f8c3caea
detect consts that reference extern statics
2024-02-10 16:13:48 +01:00
Ralf Jung
9c0623fe8f
validation: descend from consts into statics
2024-02-10 16:13:47 +01:00
Ralf Jung
4e77e368eb
unstably allow constants to refer to statics and read from immutable statics
2024-02-10 16:12:55 +01:00
Ralf Jung
d56f3b6a5d
interpret: rename ReadExternStatic → ExternStatic
2024-02-10 16:06:02 +01:00
Ralf Jung
18ed966ab5
interpret/write_discriminant: when encoding niched variant, ensure the stored value matches
2024-02-10 15:33:58 +01: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
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
Ralf Jung
e24835c6e0
more precise error for 'based on misaligned pointer' case
2023-10-15 18:13:33 +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
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
Eduardo Sánchez Muñoz
b5fde0dae0
miri: fail when calling a function that requires an unavailable target feature
...
miri will report an UB when calling a function that has a `#[target_feature(enable = ...)]` attribute is called and the required feature is not available.
"Available features" are the same that `is_x86_feature_detected!` (or equivalent) reports to be available during miri execution (which can be enabled or disabled with the `-C target-feature` flag).
2023-07-16 00:23:17 +02:00
Deadbeef
89c24af133
Better error for non const PartialEq
call generated by match
2023-06-18 05:24:38 +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
clubby789
f97fddab91
Ensure Fluent messages are in alphabetical order
2023-05-25 23:49:35 +00:00
clubby789
979c265a5d
Check for escape sequences in Fluent resources
2023-03-29 18:34:29 +01:00
est31
7e2ecb3cd8
Simplify message paths
...
This makes it easier to open the messages file while developing on features.
The commit was the result of automatted changes:
for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done
for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11 22:51:57 +01:00