summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2021-05-03Remove assert_matches feature attributes.Mara Bos-1/+0
2021-05-03Remove assert_matches usersMark Rousskov-6/+2
2021-03-20Auto merge of #82919 - bstrie:stabchar, r=dtolnaybors-1/+0
Stabilize `assoc_char_funcs` and `assoc_char_consts` Stabilizes the following associated items on `char`: * [`char::MAX`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.MAX) * [`char::REPLACEMENT_CHARACTER`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.REPLACEMENT_CHARACTER) * [`char::UNICODE_VERSION`](https://doc.rust-lang.org/std/primitive.char.html#associatedconstant.UNICODE_VERSION) * [`char::decode_utf16`](https://doc.rust-lang.org/std/primitive.char.html#method.decode_utf16) * [`char::from_u32`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32) * [`char::from_u32_unchecked`](https://doc.rust-lang.org/std/primitive.char.html#method.from_u32_unchecked) * [`char::from_digit`](https://doc.rust-lang.org/std/primitive.char.html#method.from_digit) Closes #71763.
2021-03-19Stabilize `assoc_char_funcs` and `assoc_char_consts`bstrie-1/+0
2021-03-19Rollup merge of #83297 - oli-obk:why_bug_today_if_you_can_delay_to_tomorrow, ↵Dylan DPC-5/+9
r=petrochenkov Do not ICE on ty::Error as an error must already have been reported fixes #83253
2021-03-19Auto merge of #82951 - sexxi-goose:wr-mir-replace-methods2, r=nikomatsakisbors-34/+53
Replace closures_captures and upvar_capture with closure_min_captures Removed all uses of closures_captures and upvar_capture and refactored code to work with closure_min_captures. This also involved removing functions that were no longer needed like the bridge. Closes https://github.com/rust-lang/project-rfc-2229/issues/18 r? `@nikomatsakis`
2021-03-19Do not ICE on ty::Error as an error must already have been reportedOli Scherer-5/+9
2021-03-19Hash hir_owner in typeck resultsAman Arora-1/+3
2021-03-18Replace closures_captures and upvar_capture with closure_min_capturesJennifer Wills-35/+52
make changes to liveness to use closure_min_captures use different span borrow check uses new structures rename to CapturedPlace stop using upvar_capture in regionck remove the bridge cleanup from rebase + remove the upvar_capture reference from mutability_errors.rs remove line from livenes test make our unused var checking more consistent update tests adding more warnings to the tests move is_ancestor_or_same_capture to rustc_middle/ty update names to reflect the closures add FIXME check that all captures are immutable borrows before returning add surrounding if statement like the original move var out of the loop and rename Co-authored-by: Logan Mosier <logmosier@gmail.com> Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com>
2021-03-18Remove unwrap_none/expect_none from compiler/.Mara Bos-3/+7
2021-03-18Auto merge of #82868 - petrochenkov:bto, r=estebankbors-0/+1
Report missing cases of `bare_trait_objects` Fixes https://github.com/rust-lang/rust/issues/65371
2021-03-18hir: Preserve used syntax in `TyKind::TraitObject`Vadim Petrochenkov-0/+1
2021-03-18Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiserDylan DPC-0/+8
Make source-based code coverage compatible with MIR inlining When codegenning code coverage use the instance that coverage data was originally generated for, to ensure basic level of compatibility with MIR inlining. Fixes #83061
2021-03-17Auto merge of #83188 - petrochenkov:field, r=lcnrbors-2/+2
ast/hir: Rename field-related structures I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent. - `StructField` -> `FieldDef` ("field definition") - `Field` -> `ExprField` ("expression field", not "field expression") - `FieldPat` -> `PatField` ("pattern field", not "field pattern") Various visiting and other methods working with the fields are renamed correspondingly too. The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
2021-03-17Auto merge of #83090 - jackh726:bound_var_replacer_option, r=varkorbors-55/+53
Make functions passed to BoundVarReplacer be optional This means we can reuse the bound vars when we don't care to change them
2021-03-17Rollup merge of #83124 - cjgillot:iiib, r=petrochenkovYuki Okushi-3/+2
Do not insert impl_trait_in_bindings opaque definitions twice. The reference to the item already appears inside the `OpaqueDef`. It does not need to be repeated as a statement.
2021-03-16Auto merge of #82936 - oli-obk:valtree, r=RalfJung,lcnr,matthewjasperbors-162/+443
Implement (but don't use) valtree and refactor in preparation of use This PR does not cause any functional change. It refactors various things that are needed to make valtrees possible. This refactoring got big enough that I decided I'd want it reviewed as a PR instead of trying to make one huge PR with all the changes. cc `@rust-lang/wg-const-eval` on the following commits: * 2027184 implement valtree * eeecea9 fallible Scalar -> ScalarInt * 042f663 ScalarInt convenience methods cc `@eddyb` on ef04a6d cc `@rust-lang/wg-mir-opt` for cf1700c (`mir::Constant` can now represent either a `ConstValue` or a `ty::Const`, and it is totally possible to have two different representations for the same value)
2021-03-16Auto merge of #82536 - sexxi-goose:handle-patterns-take-2, r=nikomatsakisbors-0/+28
2229: Handle patterns within closures correctly when `capture_disjoint_fields` is enabled This PR fixes several issues related to handling patterns within closures when `capture_disjoint_fields` is enabled. 1. Matching is always considered a use of the place, even with `_` patterns 2. Compiler ICE when capturing fields in closures through `let` assignments To do so, we - Introduced new Fake Reads - Delayed use of `Place` in favor of `PlaceBuilder` - Ensured that `PlaceBuilder` can be resolved before attempting to extract `Place` in any of the pattern matching code Closes rust-lang/project-rfc-2229/issues/27 Closes rust-lang/project-rfc-2229/issues/24 r? `@nikomatsakis`
2021-03-16Update compiler/rustc_middle/src/ty/consts/valtree.rsOli Scherer-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-16Update compiler/rustc_middle/src/ty/consts/valtree.rsOli Scherer-1/+2
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-03-16ast/hir: Rename field-related structuresVadim Petrochenkov-2/+2
StructField -> FieldDef ("field definition") Field -> ExprField ("expression field", not "field expression") FieldPat -> PatField ("pattern field", not "field pattern") Also rename visiting and other methods working on them.
2021-03-16Auto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, ↵bors-0/+2
r=michaelwoerister Mark `extern_mod_stmt_cnum` as `eval_always` This query reads from global untracked state, so it always needs to be evaluated.
2021-03-16Use delay_span_bug instead of panic in layout_scalar_valid_rangeTomasz Miąsko-6/+9
83054 introduced validation of scalar range attributes, but panicking code that uses the attribute remained reachable. Use `delay_span_bug` instead to avoid the ICE.
2021-03-15Make functions passed to BoundVarReplacer be optionalJack Huey-55/+53
2021-03-15Functions inlined into reachable functions are reachableTomasz Miąsko-0/+8
Consider functions to be reachable for code coverage purposes, either when they reach the code generation directly, or indirectly as inlined part of another function.
2021-03-15Add comments with examples and testsRoxane-1/+23
2021-03-15Mark `extern_mod_stmt_cnum` as `eval_always`Aaron Hill-0/+2
This query reads from global untracked state, so it always needs to be evaluated.
2021-03-15Rollup merge of #83132 - Aaron1011:fix/incr-cache-dummy, r=estebankDylan DPC-3/+3
Don't encode file information for span with a dummy location Fixes #83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
2021-03-15Rollup merge of #83108 - jyn514:remove-unused, r=estebankDylan DPC-5/+0
Remove unused `opt_local_def_id_to_hir_id` function Found while investigating #82933 - all LocalDefIds are expected to have HirIds, there's no point in pretending otherwise.
2021-03-15Pacify tidyOli Scherer-1/+1
2021-03-15Do not expose fallible `to_int` operation on `Scalar`.Oli Scherer-19/+17
Any use of it has been shown to be a bug in the past.
2021-03-15Document valtreeOli Scherer-0/+18
2021-03-15s/ConstantSource/ConstantKind/Oli Scherer-29/+21
2021-03-14Don't encode file information for span with a dummy locationAaron Hill-3/+3
Fixes #83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
2021-03-14Use the correct FakeReadCauseRoxane-2/+2
2021-03-14Assert there is no duplicate node.Camille GILLOT-3/+2
2021-03-14Introduce new fake readsRoxane-0/+6
2021-03-14Remove unused `opt_local_def_id_to_hir_id` functionJoshua Nelson-5/+0
Found while investigating #82933 - all LocalDefIds are expected to have HirIds, there's no point in pretending otherwise.
2021-03-13Auto merge of #83064 - cjgillot:fhash, r=jackh726bors-7/+0
Tweaks to stable hashing
2021-03-13Auto merge of #82891 - cjgillot:monoparent, r=petrochenkovbors-0/+12
Make def_key and HIR parenting consistent. r? `@petrochenkov`
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-0/+12
2021-03-12Visit `mir::Constant::user_ty` for completeness.Oli Scherer-2/+2
It's not necessary yet, but it may become necessary with things like lazy normalization.
2021-03-12Replace a custom lift method with a Lift implOli Scherer-4/+7
2021-03-12Prepare mir::Constant for ty::Const only supporting valtreesOli Scherer-11/+164
2021-03-12Directly intern allocations so that we can write a `Lift` impl for themOli Scherer-6/+29
2021-03-12Add `ty` helper function for mir constantsOli Scherer-0/+3
This is in preparation of the `literal` field becoming an enum that distinguishes between type level constants and runtime constants
2021-03-12Split pretty printer logic for scalar int and scalar ptrOli Scherer-46/+67
Value trees won't have scalar ptr at all, so we need a scalar int printing method anyway. This way we'll be able to share that method between all const representations.
2021-03-12Pull out ConstValue relating into its own functionOli Scherer-46/+51
2021-03-12Reduce the duplication in the relation logic for constantsOli Scherer-67/+45
2021-03-12Reduce destructuring and re-interning where possibleOli Scherer-15/+18