Ralf Jung
21c02517c3
Miri: add a flag to do recursive validity checking
2024-08-03 10:33:58 +02:00
Nicholas Nethercote
84ac80f192
Reformat use
declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Ralf Jung
b316033dd8
rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext -> CompileTimeInterpCx
...
to match the terms used in the shared interpreter infrastructure
2024-06-13 20:30:11 +02:00
Ralf Jung
e8379c9598
interpret: get rid of 'mir lifetime everywhere
2024-05-27 08:25:57 +02:00
Nicholas Nethercote
7a5d814a04
Remove #[macro_use] extern crate tracing
from rustc_const_eval
.
2024-05-23 18:02:38 +10:00
Scott McMurray
95c0e5c6a8
Remove Rvalue::CheckedBinaryOp
2024-05-17 20:33:02 -07:00
Nicholas Nethercote
4497d345a8
Remove extern crate rustc_middle
from rustc_const_eval
.
...
This requires exporting the interpreter macros so they can be used with
`use crate::interpret::*`.
2024-05-13 08:02:14 +10:00
Michael Goulet
d50c2b0a52
Make builtin_deref just return a Ty
2024-05-09 22:55:00 -04:00
Oli Scherer
84acfe86de
Actually create ranged int types in the type system.
2024-04-08 12:02:19 +00:00
Scott McMurray
3da115a93b
Add+Use mir::BinOp::Cmp
2024-03-23 23:23:41 -07:00
Michael Goulet
ff0c31e6b9
Programmatically convert some of the pat ctors
2024-03-22 11:13:29 -04:00
Guillaume Boisseau
200019c199
Rollup merge of #121731 - oli-obk:eager_opaque_checks, r=compiler-errors
...
Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore
r? `@compiler-errors`
one bubble down, two more to go
the test is unrelated, just something I noticed would be good to test in both the old solver and the new.
2024-03-02 20:13:23 +01:00
Oli Scherer
0bb2a6b780
Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore
2024-02-28 09:59:50 +00:00
Oli Scherer
8a6d3535f7
Split rustc_type_ir to avoid rustc_ast from depending on it
2024-02-27 18:11:23 +00:00
Ralf Jung
9eabdc2a4c
make it possible for outside crates to inspect a mir::ConstValue with the interpreter
2024-02-21 14:32:52 +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
Michael Goulet
c567eddec2
Add CoroutineClosure to TyKind, AggregateKind, UpvarArgs
2024-02-06 02:22:58 +00:00
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
ac48ad517b
partially inline eval_rvalue_into_place
for const prop lint
2024-01-23 16:34:42 +00: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
Michael Goulet
fcb42b42d6
Remove movability from TyKind::Coroutine
2023-12-28 16:35:01 +00:00
Deadbeef
d1f4bc5a19
Revert "Don't print host effect param in pretty path_generic_args"
...
This reverts commit f1bf874fb1
.
2023-12-10 10:17:28 +00:00
Michael Goulet
f1bf874fb1
Don't print host effect param in pretty path_generic_args
2023-12-09 17:42:33 +00:00
Oli Scherer
77174d3f29
Turn const_caller_location from a query to a hook
2023-10-31 16:15:18 +00:00
Ralf Jung
351d532a27
interpret: call caller_location logic the same way codegen does, and share some code
2023-10-28 15:40:03 +02:00
Nilstrieb
5acf26b97e
Make ty::print::Printer
take &mut self
instead of self
...
This simplifies the code by removing all the `self` assignments and
makes the flow of data clearer - always into the printer.
Especially in v0 mangling, which already used `&mut self` in some
places, it gets a lot more uniform.
2023-10-21 11:33:05 +02:00
Oli Scherer
60956837cf
s/Generator/Coroutine/
2023-10-20 21:10:38 +00:00
Nilstrieb
6fc6a6d783
Remove Print::Error
...
All printing goes through `fmt::Error` now.
2023-10-17 18:02:57 +02:00
Nilstrieb
6038888118
Remove Printer::Error
...
It's always a `fmt::Error` except in some cases where it was `!`, but
we're not really winning anything in that case.
2023-10-17 18:02:55 +02:00
Nilstrieb
0b5a4c1adf
Remove Print::Output
...
Now that `Printer` doesn't have subprinters anymore, the output of a
printing operation is always the same.
2023-10-17 18:01:07 +02:00
Nilstrieb
3895f0e9af
Remove "subprinter" types from Printer
...
These are `Self` in almost all printers except one, which can just store
the state as a field instead. This simplifies the printer and allows for
further simplifications, for example using `&mut self` instead of
passing around the printer.
2023-10-17 18:01:05 +02:00
bors
48e24629e9
Auto merge of #115583 - RalfJung:packed-unsized, r=lcnr
...
fix detecting references to packed unsized fields
Fixes https://github.com/rust-lang/rust/issues/115396
This is a breaking change, but permitted as a soundness fix.
2023-10-07 10:57:18 +00:00
ouz-a
5d753abb30
have better explanation for relate_types
2023-10-02 23:39:45 +03:00
ouz-a
6f0c5ee2d4
change is_subtype to relate_types
2023-10-02 23:39:45 +03:00
Camille GILLOT
44ac8dcc71
Remove GeneratorWitness and rename GeneratorWitnessMIR.
2023-09-23 13:47:30 +00:00
Ralf Jung
ad7045e160
still accept references to u8 slices and str in packed fields
2023-09-06 08:32:30 +02:00
Ralf Jung
8b3435c10f
fix detecting references to packed unsized fields
2023-09-05 22:29:51 +02:00
Ralf Jung
fa5f13775a
interpret: make MemPlace, Place, Operand types private to the interpreter
2023-09-04 17:53:38 +02:00
Ralf Jung
739144fc5b
MIR validation: reject in-place argument/return for packed fields
2023-08-24 11:38:19 +02:00
Oli Scherer
99a9a63ca6
Turns out opaque types can have hidden types registered during mir validation
2023-07-27 08:23:06 +00:00
Oli Scherer
44e21503a8
Double check that hidden types match the expected hidden type
2023-07-21 13:19:36 +00:00
Mahdi Dibaiee
e55583c4b8
refactor(rustc_middle): Substs -> GenericArg
2023-07-14 13:27:35 +01:00
Nilstrieb
3019c1cb2a
Put LayoutError
behind reference to shrink result
...
`LayoutError` is 24 bytes, which is bigger than the `Ok` types, so let's
shrink that.
2023-07-01 21:16:25 +02:00
Nilstrieb
70b6a74c3c
Add enum for can_access_statics
boolean
...
`/*can_access_statics:*/ false` is one of the ways to do this, but not
the one I like.
2023-06-24 20:40:40 +00:00
Scott McMurray
c780e55995
Dedup some type checks in the MIR validator
2023-06-19 01:47:03 -07:00
Oli Scherer
f3b7dd6388
Add AliasKind::Weak
for type aliases.
...
Only use it when the type alias contains an opaque type.
Also does wf-checking on such type aliases.
2023-06-16 19:39:48 +00:00
Oli Scherer
05eae08233
Remove const eval limit and implement an exponential backoff lint instead
2023-05-31 10:24:17 +00:00
Michael Goulet
a2d7ffc635
Move DefiningAnchor
2023-05-25 03:21:21 +00:00
León Orell Valerian Liehr
778abc7a00
properly pretty-print inherent projections
2023-05-22 22:39:45 +02:00
Nilstrieb
2109fe4e4e
Move some utils out of rustc_const_eval
...
This allows us to get rid of the `rustc_const_eval->rustc_borrowck`
dependency edge which was delaying the compilation of borrowck.
The added utils in `rustc_middle` are small and should not affect
compile times there.
2023-04-16 12:05:54 +02:00