about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2022-04-09Auto merge of #95697 - klensy:no-strings, r=petrochenkovbors-2/+1
refactor: simplify few string related interactions Few small optimizations: check_doc_keyword: don't alloc string for emptiness check check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use FxHashSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-09Rollup merge of #95785 - RalfJung:interpret-size-mismatch, r=oli-obkDylan DPC-16/+46
interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internal We did this a while ago already for `to_i32()` and friends, but missed this one. That became quite annoying when I was debugging an ICE caused by `read_pointer` in a Miri shim where the code was passing an argument at the wrong type. Having `scalar_to_ptr` be fallible is consistent with all the other `Scalar::to_*` methods being fallible. I added `unwrap` only in code outside the interpreter, which is no worse off than before now in terms of panics. r? ````@oli-obk````
2022-04-08check_doc_keyword: don't alloc string for emptiness checkklensy-2/+1
check_doc_alias_value: get argument as Symbol to prevent needless string convertions check_doc_attrs: don't alloc vec, iterate over slice. Vec introduced in #83149, but no perf run posted on merge replace as_str() check with symbol check get_single_str_from_tts: don't prealloc string trivial string to str replace LifetimeScopeForPath::NonElided use Vec<Symbol> instead of Vec<String> AssertModuleSource use BTreeSet<Symbol> instead of BTreeSet<String> CrateInfo.crate_name replace FxHashMap<CrateNum, String> with FxHashMap<CrateNum, Symbol>
2022-04-07interpret: err instead of ICE on size mismatches in to_bits_or_ptr_internalRalf Jung-16/+46
2022-04-07Report opaque type mismatches directly during borrowck of the function ↵Oli Scherer-2/+1
instead of within the `type_of` query. This allows us to only store a single hidden type per opaque type instead of having to store one per set of substitutions.
2022-04-05trivial cfg(bootstrap) changesPietro Albini-1/+1
2022-04-02rebase and remove dead codeb-naber-115/+2
2022-04-02try to evaluate in from_opt_const_arg_anon_constb-naber-6/+73
2022-04-02rebase and use ty::Const in patterns againb-naber-1/+1
2022-04-02change thir to use mir::ConstantKind instead of ty::Constb-naber-10/+209
2022-03-31interpret: make isize::MAX the limit for dynamic value sizesRalf Jung-0/+5
2022-03-31Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errorsDylan DPC-3/+3
Spellchecking compiler comments This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Auto merge of #95436 - cjgillot:static-mut, r=oli-obkbors-3/+2
Remember mutability in `DefKind::Static`. This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-30Addressed comments by @compiler-errors and @bjorn3Yuri Astrakhan-1/+1
2022-03-30Spellchecking compiler commentsYuri Astrakhan-4/+4
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPCbors-2/+2
Rollup of 5 pull requests Successful merges: - #95294 (Document Linux kernel handoff in std::io::copy and std::fs::copy) - #95443 (Clarify how `src/tools/x` searches for python) - #95452 (fix since field version for termination stabilization) - #95460 (Spellchecking compiler code) - #95461 (Spellchecking some comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-30Rollup merge of #95461 - nyurik:spelling, r=lcnrDylan DPC-1/+1
Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments
2022-03-30Spellchecking compiler codeYuri Astrakhan-1/+1
Address some spelling mistakes in strings, private function names, and function params.
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-3/+2
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-28Have the spans of TAIT type conflict errors point to the actual site instead ↵Oli Scherer-2/+2
of the owning function
2022-03-27Rollup merge of #95120 - smoelius:backward-switch-int, r=ecstatic-morseDylan DPC-0/+95
Implement `apply_switch_int_edge_effects` for backward analyses See #94576 for some discussion. r? `@ecstatic-morse`
2022-03-26Address review commentsSamuel E. Moelius III-0/+95
* Add lazily computed `switch_sources` data structure * Don't assume a target has only one associated value
2022-03-25Rollup merge of #95179 - b-naber:eval-in-try-unify, r=lcnrDylan DPC-0/+11
Try to evaluate in try unify and postpone resolution of constants that contain inference variables We want code like that in [`ui/const-generics/generic_const_exprs/eval-try-unify.rs`](https://github.com/rust-lang/rust/compare/master...b-naber:eval-in-try-unify?expand=1#diff-8027038201cf07a6c96abf3cbf0b0f4fdd8a64ce6292435f01c8ed995b87fe9b) to compile. To do that we need to try to evaluate constants in `try_unify_abstract_consts`, this requires us to be more careful about what constants we try to resolve, specifically we cannot try to resolve constants that still contain inference variables. r? `@lcnr`
2022-03-23Clarify more MIR docsJakob Degen-0/+15
2022-03-23Clarify which kinds of MIR are allowed during which phases.Jakob Degen-17/+39
This enhances documentation with these details and extends the validator to check these requirements more thoroughly. As a part of this, we add a new `Deaggregated` phase, and rename other phases so that their names more naturally correspond to what they represent.
2022-03-22erase region in ParamEnvAnd and make ConstUnifyCtxt privateb-naber-1/+4
2022-03-22fix previous failures and address reviewb-naber-1/+1
2022-03-21stall on on constants that contain infer vars in const_eval_resolveb-naber-0/+8
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-1/+1
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16rustc_error: make ErrorReported impossible to constructmark-2/+2
There are a few places were we have to construct it, though, and a few places that are more invasive to change. To do this, we create a constructor with a long obvious name.
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15Rollup merge of #94958 - est31:pluralize, r=oli-obkMatthias Krüger-1/+1
Support other types of pluralization in pluralize macro
2022-03-15Support other types of pluralization in pluralize macroest31-1/+1
2022-03-15fix typosDylan DPC-2/+2
2022-03-12Auto merge of #94733 - nnethercote:fix-AdtDef-interning, r=fee1-deadbors-5/+5
Improve `AdtDef` interning. This commit makes `AdtDef` use `Interned`. Much of the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`. r? `@fee1-dead`
2022-03-11Rollup merge of #94827 - RalfJung:offset-from-ub, r=oli-obkDylan DPC-0/+6
CTFE/Miri: detect out-of-bounds pointers in offset_from Also I became uneasy with aggressively doing `try_to_int` here -- this will always succeed on Miri, leading to the wrong codepath being taken. We should rather try to convert them both to pointers, and use the integer path as a fallback, so that's what I implemented now. Hiding whitespaces helps with the diff. Fixes https://github.com/rust-lang/miri/issues/1950 r? ``@oli-obk``
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-5/+5
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-10adjust offset_from logic: check that both pointers are in-boundsRalf Jung-0/+6
2022-03-10The `Clone::clone` call is now a `ConstantKind::Val`, not a `ConstantKind::Ty`Scott McMurray-1/+1
2022-03-10mir-opt: Replace clone on primitives with copyScott McMurray-0/+30
We can't do it for everything, but it would be nice to at least stop making calls to clone methods in debug from things like derived-clones.
2022-03-10Auto merge of #94059 - b-naber:constantkind-val-transformation, r=lcnrbors-1/+29
Treat constant values as mir::ConstantKind::Val Another step that is necessary for the introduction of Valtrees: we don't want to treat `ty::Const` instances of kind `ty::ConstKind::Value` as `mir::ConstantKind::Ty` anymore. r? `@oli-obk`
2022-03-10Auto merge of #94737 - lcnr:pass-stuff-by-value, r=davidtwcobors-7/+13
add `#[rustc_pass_by_value]` to more types the only interesting changes here should be to `TransitiveRelation`, but I believe to be highly unlikely that we will ever use a non `Copy` type with this type.
2022-03-09treat all mir::Constant values as ConstantKind::Valb-naber-1/+29
2022-03-08Auto merge of #94702 - b-naber:static-refs-mir, r=lcnrbors-7/+17
Reinstate #93800 https://github.com/rust-lang/rust/pull/93800 caused a regression in an alt builder with parallel enabled. https://github.com/rust-lang/rust/pull/94205 reverted that PR because of the regression. For an unknown reason the regression has disappeared, so we reinstate the changes in https://github.com/rust-lang/rust/pull/93800 here. r? `@Mark-Simulacrum`
2022-03-08add `#[rustc_pass_by_value]` to more typeslcnr-7/+13
2022-03-08treat literals in ExprKind::StaticRef as mir::ConstantKind::Valb-naber-7/+17
2022-03-07Rollup merge of #94676 - ↵Matthias Krüger-1/+1
TaKO8Ki:remove-unnecessary-pattens-for-ignoring-remaining-parts, r=Dylan-DPC Remove unnecessary `..` patterns This patch removes unnecessary `..` patterns.
2022-03-07Introduce `ConstAllocation`.Nicholas Nethercote-24/+59
Currently some `Allocation`s are interned, some are not, and it's very hard to tell at a use point which is which. This commit introduces `ConstAllocation` for the known-interned ones, which makes the division much clearer. `ConstAllocation::inner()` is used to get the underlying `Allocation`. In some places it's natural to use an `Allocation`, in some it's natural to use a `ConstAllocation`, and in some places there's no clear choice. I've tried to make things look as nice as possible, while generally favouring `ConstAllocation`, which is the type that embodies more information. This does require quite a few calls to `inner()`. The commit also tweaks how `PartialOrd` works for `Interned`. The previous code was too clever by half, building on `T: Ord` to make the code shorter. That caused problems with deriving `PartialOrd` and `Ord` for `ConstAllocation`, so I changed it to build on `T: PartialOrd`, which is slightly more verbose but much more standard and avoided the problems.
2022-03-07remove unnecessary `..` patternsTakayuki Maeda-1/+1