Jakob Degen
9fb8da8f8f
Remove unneeded field from SwitchTargets
2022-12-09 04:53:10 -08:00
Nicholas Nethercote
68a19209e0
Inline and remove place_contents_drop_state_cannot_differ
.
...
It has a single call site and is hot enough to be worth inlining. And
make sure `is_terminal_path` is inlined, too.
2022-12-08 13:59:29 +11:00
Rageking8
58110572fb
fix dupe word typos
2022-12-05 16:42:36 +08:00
Oli Scherer
4f593ce5d8
Create format_args
as late as possible
2022-12-01 08:49:51 +00:00
Jakob Degen
245c60749a
Rewrite dest prop.
...
This fixes a number of correctness issues from the previous version. Additionally, we use a new
strategy which has much better performance charactersitics and also finds more opportunities to
apply the optimization.
2022-11-26 18:04:54 -08:00
b-naber
9061ffba8c
use no type in ProjectionElem::Field for PlaceBuilder::UpVar
2022-11-23 21:25:27 +01:00
Oli Scherer
ec8d01fdcc
Allow iterators instead of requiring slices that will get turned into iterators
2022-11-21 20:33:55 +00:00
Matthias Krüger
e3036df003
couple of clippy::perf fixes
2022-11-18 10:30:47 +01:00
Jannis Christopher Köhl
108790b8dc
Remove log statement that was commented out
2022-11-12 20:32:09 +01:00
Jannis Christopher Köhl
2e034dc68c
Exclude locals completely, instead of individual places
2022-11-12 14:57:14 +01:00
Jannis Christopher Köhl
3c6d1a723d
Add test for repr(transparent) with scalar
2022-11-11 11:24:31 +01:00
Jannis Christopher Köhl
8ecb276735
Simplify creation of map
2022-11-10 19:12:10 +01:00
Jannis Christopher Köhl
9766ee0b20
Fix struct field tracking and add tests for it
2022-11-09 18:21:42 +01:00
Jannis Christopher Köhl
bfbca6c75c
Completely remove tracking of references for now
2022-11-09 18:03:30 +01:00
Jannis Christopher Köhl
3997893ccb
Fix rebase
2022-11-07 11:01:44 +01:00
Jannis Christopher Köhl
89f934917d
Small corrections of documentation
2022-11-07 10:35:26 +01:00
Jannis Christopher Köhl
630e17d3e4
Limit number of tracked places, and some other perf improvements
2022-11-07 10:35:26 +01:00
Jannis Christopher Köhl
1f82a9f89e
Move HasTop and HasBottom into lattice.rs
2022-11-07 10:35:25 +01:00
Jannis Christopher Köhl
de69d088a4
Explicitly match all terminators
2022-11-07 10:35:24 +01:00
Jannis Christopher Köhl
5b7b309c60
Improve documentation of assumptions
2022-11-07 10:35:24 +01:00
Jannis Christopher Köhl
274a49132b
Improve documentation, plus some small changes
2022-11-07 10:35:23 +01:00
Jannis Christopher Köhl
aaa35b3e48
Add comment for the current retag situation
2022-11-07 10:35:22 +01:00
Jannis Christopher Köhl
3c0f3b04b5
Only assume Stacked Borrows if -Zunsound-mir-opts is given
2022-11-07 10:35:21 +01:00
Jannis Christopher Köhl
111324e17c
Prevent registration inside references if target is !Freeze
2022-11-07 10:35:20 +01:00
Jannis Christopher Köhl
4478a87018
Fix formatting
2022-11-07 10:35:20 +01:00
Jannis Christopher Köhl
7ab1ba95de
Remove Unknown
state in favor of Value(Top)
2022-11-07 10:35:20 +01:00
Jannis Christopher Köhl
1765587846
Only track (trivially) freeze types
2022-11-07 10:35:20 +01:00
Jannis Christopher Köhl
b5063ab0e5
Make more assumptions explicit
2022-11-07 10:35:19 +01:00
Jannis Christopher Köhl
2f66e9417f
Flood with bottom for Deinit, StorageLive and StorageDead
2022-11-07 10:35:19 +01:00
Jannis Christopher Köhl
eab77320e6
Handle NonDivergingIntrinsic and CopyNonOverlapping
2022-11-07 10:35:19 +01:00
Jannis Christopher Köhl
f99950f6ae
Update test results after rebase
2022-11-07 10:35:18 +01:00
Jannis Christopher Köhl
c56e99cdba
Fix typo
2022-11-07 10:35:18 +01:00
Jannis Christopher Köhl
13b70599c1
Only allow registration of scalars for now
2022-11-07 10:35:16 +01:00
Jannis Christopher Köhl
817c27744d
Handle StorageLive
2022-11-07 10:35:16 +01:00
Jannis Christopher Köhl
e2ddf8a6e5
Add comment about downcast projection element
2022-11-07 10:35:15 +01:00
Jannis Christopher Köhl
1e5ca57014
Use StorageDead and Deinit to flood place
2022-11-07 10:35:15 +01:00
Jannis Christopher Köhl
904adcac0f
Flood place on drop
2022-11-07 10:35:15 +01:00
Jannis Christopher Köhl
2113e45488
Remove superfluous line
2022-11-07 10:35:14 +01:00
Jannis Christopher Köhl
2e4d0820d2
Add more documentation
2022-11-07 10:35:14 +01:00
Jannis Christopher Köhl
fe84bbf844
Add tracking of unreachability
2022-11-07 10:35:13 +01:00
Jannis Christopher Köhl
16dedba1c8
Ignore terminators explicitly
2022-11-07 10:35:13 +01:00
Jannis Christopher Köhl
8a789ce009
Reject registration of downcasts for now
2022-11-07 10:35:12 +01:00
Jannis Christopher Köhl
ad99d2e15d
Move handling of references and simplify flooding
2022-11-07 10:35:11 +01:00
Jannis Christopher Köhl
3f98dc7838
Clarify place expressions vs place objects
2022-11-07 10:35:11 +01:00
Jannis Christopher Köhl
e75ad93d95
Begin a semi-formal argument for correctness
2022-11-07 10:35:10 +01:00
Jannis Christopher Köhl
292869493c
Add additional flooding when assigning a value and corresponding test
2022-11-07 10:35:10 +01:00
Jannis Christopher Köhl
bb1639769e
Clarify registration and tracking of references
2022-11-07 10:35:10 +01:00
Jannis Christopher Köhl
56ff16d19f
Fix spelling
2022-11-07 10:35:09 +01:00
Jannis Christopher Köhl
d0afe6833d
Try field type normalization instead of forcing it
2022-11-07 10:35:08 +01:00
Jannis Christopher Köhl
4f9c30fb67
Add initial version of value analysis and dataflow constant propagation
2022-11-07 10:35:08 +01:00
Oli Scherer
44d1936d00
Some tracing and comment cleanups
2022-11-04 17:10:07 +00:00
Nilstrieb
c65ebae221
Migrate all diagnostics
2022-10-23 10:09:44 +02:00
Matthias Krüger
c731646d6a
Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk
...
Remove `mir::CastKind::Misc`
As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast.
r? ````@oli-obk````
2022-10-08 14:38:18 +02:00
ouz-a
d59c7ff000
Remove mir::CastKind::Misc
2022-10-06 15:32:41 +03:00
reez12g
9a4c5abe45
Remove from compiler/ crates
2022-09-29 16:49:04 +09:00
Pietro Albini
3975d55d98
remove cfg(bootstrap)
2022-09-26 10:14:45 +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
bors
4136b59b7d
Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
...
Allow patterns to constrain the hidden type of opaque types
fixes #96572
reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864 )
TODO:
* check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-20 12:09:52 +00:00
Oli Scherer
dab1074b91
Only generate OpaqueCast
for opaque types
2022-09-16 11:37:50 +00:00
Oli Scherer
40e2de8c41
Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""
...
This reverts commit 4a742a691e
.
2022-09-16 11:36:39 +00:00
est31
173eb6f407
Only enable the let_else feature on bootstrap
...
On later stages, the feature is already stable.
Result of running:
rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15 21:06:45 +02:00
Oli Scherer
b7413511dc
Generalize the Assume intrinsic statement to a general Intrinsic statement
2022-09-06 14:18:32 +00:00
Oli Scherer
3f07645120
Lower the assume intrinsic to a MIR statement
2022-09-06 14:18:32 +00:00
Matthias Krüger
d182081de1
Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
...
Replace `Body::basic_blocks()` with field access
Since the refactoring in #98930 , it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.
Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.
2022-08-29 06:34:43 +02:00
Michael Goulet
93b2acd88a
Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwco
...
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-26 15:56:24 -07:00
Tomasz Miąsko
b48870b451
Replace Body::basic_blocks()
with field access
2022-08-26 14:27:08 +02:00
Tomasz Miąsko
58eabb291d
Add method that applies DefUse effect
2022-08-25 10:38:00 +02:00
Tomasz Miąsko
31d892a942
Fix liveness analysis for yield terminators
...
A resume place is evaluated and assigned to only after a yield
terminator resumes. Ensure that locals used when evaluating the
resume place are live across the yield.
2022-08-25 07:12:16 +02:00
5225225
f20cc9ae4e
Rename rustc_mir_dataflow diagnostic to mir_dataflow
2022-08-23 13:48:15 +01:00
5225225
ee2b16100e
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-23 11:24:51 +01:00
SparrowLii
d39fefdd69
use type alias impl trait in outlives_bounds::InferCtxtExt
2022-08-22 18:10:28 +08:00
Tomasz Miąsko
099a32bbe4
Remove redundant TransferWrapper
struct
2022-08-01 17:08:19 +02:00
bors
7dfdd64433
Auto merge of #99667 - ouz-a:some_branch, r=oli-obk
...
Optimize `UnDerefer`
Addresses the performance [issues](https://github.com/rust-lang/rust/pull/98145#issuecomment-1183548597 ) faced here.
r? `@oli-obk`
2022-07-29 07:11:50 +00:00
ouz-a
bd24b4006c
type alias covers whole return
2022-07-28 13:52:49 +03:00
ouz-a
bd52f58e3b
create type alias
2022-07-28 12:56:57 +03:00
ouz-a
a5c895e1d8
remove clone
2022-07-25 17:08:54 +03:00
ouz-a
4e726e04cd
fix import error
2022-07-24 14:57:49 +03:00
ouz-a
09134982e5
optimize un_derefer
2022-07-24 14:40:43 +03:00
bors
be9cfb307e
Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa
...
Remove the unused StableSet and StableMap types from rustc_data_structures.
The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp.
I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](69d03ac7a7
)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20 22:19:30 +00:00
Michael Woerister
88f6c6d8a0
Remove unused StableMap and StableSet types from rustc_data_structures
2022-07-20 13:11:39 +02:00
Oli Scherer
4a742a691e
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
...
This reverts commit 6f8fb911ad
, reversing
changes made to 7210e46dc6
.
2022-07-20 07:55:58 +00:00
Matthias Krüger
6f8fb911ad
Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank
...
Allow destructuring opaque types in their defining scopes
fixes #96572
Before this PR, the following code snippet failed with an incomprehensible error, and similar code just ICEd in mir borrowck.
```rust
type T = impl Copy;
let foo: T = (1u32, 2u32);
let (a, b) = foo;
```
The problem was that the last line created MIR projections of the form `foo.0` and `foo.1`, but `foo`'s type is `T`, which doesn't have fields (only its hidden type does). But the pattern supplies enough type information (a tuple of two different inference types) to bind a hidden type.
2022-07-16 22:30:47 +02:00
Oli Scherer
84a444a1f4
Introduce opaque type to hidden type projection
2022-07-15 15:49:22 +00:00
pierwill
0d45977aa5
Remove FIXME from MIR always_storage_live_locals
2022-07-14 15:30:36 -05:00
Joshua Nelson
3c9765cff1
Rename debugging_opts
to unstable_opts
...
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
2022-07-13 17:47:06 -05:00
ouz-a
cb0017f2f8
add new rval, pull deref early
2022-07-12 14:26:41 +03:00
Matthias Krüger
416dc43124
Rollup merge of #99022 - pierwill:always-storage-live-locals, r=pierwill
...
MIR dataflow: Rename function to `always_storage_live_locals`
Related to #99021 .
r? ```@JakobDegen``` (as discussed on Zulip)
2022-07-09 12:52:50 +02:00
pierwill
8a1c1ec8b2
MIR dataflow: Rename function to always_storage_live_locals
...
Related to #99021 .
2022-07-07 13:49:40 -05:00
Matthias Krüger
b4f8537a56
Rollup merge of #98986 - pierwill:patch-5, r=oli-obk
...
Fix missing word in comment
2022-07-07 20:33:27 +02:00
Dylan DPC
6910d84bc4
Rollup merge of #98981 - pierwill:pierwill/dataflow-docs-edits, r=Dylan-DPC
...
Edit `rustc_mir_dataflow::framework` documentation
Some edits for clarity and consistency.
2022-07-07 18:06:55 +05:30
Tomasz Miąsko
dfa6a7cbde
Move switch_sources
from Body to BasicBlocks
2022-07-07 08:11:49 +02:00
Tomasz Miąsko
39d9c1cb1f
Move predecessors
from Body to BasicBlocks
2022-07-07 08:11:49 +02:00
Tomasz Miąsko
2446b17745
Move is_cfg_cyclic
from Body to BasicBlocks
2022-07-07 08:11:49 +02:00
pierwill
deaa92b34b
Fix missing word in comment
2022-07-06 13:26:26 -05:00
pierwill
8c9a130056
Edit rustc_mir_dataflow::framework
documentation
2022-07-06 11:20:40 -05:00
Guillaume Gomez
5d650bb92e
Rollup merge of #98944 - pierwill:flatset-docs, r=Dylan-DPC
...
Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs
Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.
2022-07-05 23:43:33 +02:00
pierwill
f8b16c5d87
Edit rustc_mir_dataflow::framework::lattice::FlatSet
docs
...
Cosmetic improvements. Adds a paragraph break, and
ellipses to signify arbitrary size of a flat set.
2022-07-05 11:34:39 -05:00
lcnr
cf9c0a5935
cleanup mir visitor for rustc::pass_by_value
2022-07-01 16:21:21 +02:00
Nicholas Nethercote
7c40661ddb
Update smallvec
to 1.8.1.
...
This pulls in https://github.com/servo/rust-smallvec/pull/282 , which
gives some small wins for rustc.
2022-06-27 08:48:55 +10:00