about summary refs log tree commit diff
path: root/compiler/rustc_borrowck/src/polonius
AgeCommit message (Collapse)AuthorLines
2024-12-30move `location` module to polonius legacy moduleRémy Rakic-4/+112
this is specific to the old datalog implementation and wasn't noticed in the previous module move
2024-12-29address review commentsRémy Rakic-6/+23
- add a FIXME when looking for the region variance of unexpected regions - drive-by: fix a doc comment link - drive-by: simplify the variance match using exported variants instead
2024-12-29liveness constraints: draw the rest of the owlRémy Rakic-71/+180
2024-12-29finish filling polonius contextRémy Rakic-6/+25
transpose liveness matrix and record live regions at the end of MIR typeck
2024-12-29add variance recordingRémy Rakic-0/+126
Following the Generalizer's structure, relating e.g. a type with itself will allow tracking the variance wrt the contained regions.
2024-12-29introduce polonius contextRémy Rakic-27/+66
This context struct will hold data to help creating localized constraints: - the live regions, with the shape matching a CFG walk, indexed per point - the variance of these live regions, represented as the direction we'll add the appropriate We also add this structure to the mir typeck to record liveness data, and make it responsible for localized constraint creation.
2024-12-22Delete `Rvalue::Len`Scott McMurray-7/+2
Everything's moved to `PtrMetadata` instead.
2024-12-18address review commentsRémy Rakic-18/+19
- move constraints to an Option - check `-Zpolonius=next` only once - rewrite fixme comments to make the actionable part clear
2024-12-18introduce beginnings of polonius MIR dumpRémy Rakic-0/+103
This is mostly for test purposes to show the localized constraints until the MIR debugger is set up.
2024-12-18set up skeleton for localized constraints conversionRémy Rakic-1/+142
2024-12-18add general documentation on the polonius moduleRémy Rakic-0/+35
this describes the rough algorithm using the localized constraint graph
2024-12-18introduce localized outlives constraintsRémy Rakic-0/+48
these are the basic blocks of the naive polonius constraint graph implementation.
2024-12-15improve consistency within fact genRémy Rakic-46/+44
- fix names - fix ordering of arguments
2024-12-15simplify `emit_outlives_facts`Rémy Rakic-6/+5
- integrate into `emit_facts` and remove from typeck
2024-12-15simplify `emit_access_facts` and fact generationRémy Rakic-50/+21
- integrate it within existing fact generation instead of being called in typeck - simplify access fact extraction - also remove single use fact emit functions in root fact generation
2024-12-15use let else more consistently in fact generationRémy Rakic-49/+43
also remove a useless trace
2024-12-15clean up `translate_outlives_facts`Rémy Rakic-0/+33
- remove dependency on `TypeChecker` - move to legacy fact generation module - group facts emitted during typeck together
2024-12-15clean up `emit_drop_facts`Rémy Rakic-2/+22
- remove dependency on `TypeChecker` - move to legacy fact generation module - remove polonius module from liveness
2024-12-15clean up `emit_access_facts`Rémy Rakic-0/+109
- remove dependency on `TypeChecker` - move to legacy fact generation module
2024-12-14move datalog fact generation into a legacy moduleRémy Rakic-184/+185
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+1
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-19Clean up `UniversalRegions`.Nicholas Nethercote-11/+4
There is an `Rc<UniversalRegions>` within `UniversalRegionRelations`, and yet the two types get passed around in tandem a lot. This commit makes `UniversalRegionRelations` own `UniversalRegions`, removing the `Rc` (which wasn't truly needed) and the tandem-passing. This requires adding a `universal_relations` method to `UniversalRegionRelations`, and renaming a couple of existing methods producing iterators to avoid a name clash.
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-0/+1
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-09-13Rename and reorder lots of lifetimes.Nicholas Nethercote-14/+14
- Replace non-standard names like 's, 'p, 'rg, 'ck, 'parent, 'this, and 'me with vanilla 'a. These are cases where the original name isn't really any more informative than 'a. - Replace names like 'cx, 'mir, and 'body with vanilla 'a when the lifetime applies to multiple fields and so the original lifetime name isn't really accurate. - Put 'tcx last in lifetime lists, and 'a before 'b.
2024-08-30Remove `#[macro_use] extern crate tracing` from `rustc_borrowck`.Nicholas Nethercote-0/+3
2024-08-18rename AddressOf -> RawBorrow inside the compilerRalf Jung-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+13
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-07Support tail calls in mir via `TerminatorKind::TailCall`Maybe Waffle-0/+6
2024-06-05Remove confusing `use_polonius` flag and do less cloningAmanda Stjerna-2/+2
The `use_polonius` flag is both redundant and confusing since every function it's propagated to also checks if `all_facts` is `Some`, the true test of whether to generate Polonius facts for Polonius or for external consumers. This PR makes that path clearer by simply doing away with the argument and handling the logic in precisely two places: where facts are populated (check for `Some`), and where `all_facts` are initialised. It also delays some statements until after that check to avoid the miniscule performance penalty of executing them when Polonius is disabled. This also addresses @lqd's concern in #125652 by reducing the size of what is cloned out of Polonius facts to just the facts being added, as opposed to the entire vector of potential inputs, and added descriptive comments. *Reviewer note*: the comments in [add_extra_drop_facts](https://github.com/rust-lang/rust/blob/85f90a461262f7ca37a6e629933d455fa9c3ee48/compiler/rustc_borrowck/src/type_check/liveness/trace.rs#L219) should be inspected by a reviewer, in particular the one on L#259 in this PR, which should be trivial for someone with the right background knowledge. I also included some minor lints I found on the way there that I couldn't help myself from addressing.
2024-05-21Auto merge of #125284 - compiler-errors:uplift-misc, r=lcnrbors-4/+6
Uplift `RegionVid`, `TermKind` to `rustc_type_ir`, and `EagerResolver` to `rustc_next_trait_solver` - Uplift `RegionVid`. This was complicated due to the fact that we implement `polonius_engine::Atom` for `RegionVid` -- but I just separated that into `PoloniusRegionVid`, and added `From`/`Into` impls so it can be defined in `rustc_borrowck` separately. Coherence 😵 - Change `InferCtxtLike` to expose `opportunistically_resolve_{ty,ct,lt,int,float}_var` so that we can uplift `EagerResolver` for use in the canonicalization methods. - Uplift `TermKind` much like `GenericArgKind` All of this is miscellaneous dependencies for making more `EvalCtxt` methods generic.
2024-05-20Uplift RegionVidMichael Goulet-4/+6
2024-05-17Remove `Rvalue::CheckedBinaryOp`Scott McMurray-2/+1
2024-04-29Remove `extern crate rustc_middle` from numerous crates.Nicholas Nethercote-0/+1
2024-04-20Add a non-shallow fake borrowNadrieril-6/+13
2024-02-24Implement asm goto in MIR and MIR loweringGary Guo-1/+2
2024-02-24Change InlineAsm to allow multiple targets insteadGary Guo-1/+1
2024-02-12remove a bunch of dead parameters in fnyukang-1/+0
2024-02-06Invert diagnostic lints.Nicholas Nethercote-4/+0
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-1/+1
To enable improved accuracy of diagnostics in upcoming commits.
2023-11-26move remaining legacy polonius fact generation out of NLL moduleRémy Rakic-18/+40
2023-11-26small polish of loan invalidations fact generationRémy Rakic-22/+12
2023-11-26rename polonius constraint generation to what it actually does: emit loan killsRémy Rakic-28/+20
2023-11-26simplify polonius constraint generationRémy Rakic-106/+82
2023-11-26remove NLL liveness from polonius constraint generationRémy Rakic-80/+7
2023-11-26extract polonius "constraint generation"Rémy Rakic-2/+272
to help review, this duplicates the existing NLL + polonius constraint generation component, before splitting them up to only do what they individually need.
2023-11-26extract polonius loan invalidations fact generationRémy Rakic-0/+582
and move the polonius module to the borrowck root