about summary refs log tree commit diff
path: root/compiler/rustc_mir/src
AgeCommit message (Collapse)AuthorLines
2021-02-16./x.py fmtTomasz Miąsko-26/+34
2021-02-16Pass MPlaceTy by reference not valueTomasz Miąsko-65/+72
2021-02-16Pass ImmTy by reference not valueTomasz Miąsko-10/+10
2021-02-16Pass PlaceTy by reference not valueTomasz Miąsko-87/+91
2021-02-16Pass OpTy by reference not valueTomasz Miąsko-193/+193
2021-02-16Add size assertions for interpreter data structuresTomasz Miąsko-0/+24
2021-02-16Auto merge of #81611 - cjgillot:meowner, r=estebankbors-25/+19
Only store a LocalDefId in some HIR nodes Some HIR nodes are guaranteed to be HIR owners: Item, TraitItem, ImplItem, ForeignItem and MacroDef. As a consequence, we do not need to store the `HirId`'s `local_id`, and we can directly store a `LocalDefId`. This allows to avoid a bit of the dance with `tcx.hir().local_def_id` and `tcx.hir().local_def_id_to_hir_id` mappings.
2021-02-16fix MIR fn-ptr pretty-printingRalf Jung-1/+1
2021-02-16validation: fix invalid-fn-ptr error messageRalf Jung-1/+4
2021-02-16make `visit_projection` take a `PlaceRef`Henry Boisdequin-13/+3
2021-02-16update formatingHenry Boisdequin-6/+16
2021-02-15Only store a LocalDefId in hir::ImplItem.Camille GILLOT-2/+1
2021-02-15Only store a LocalDefId in hir::Item.Camille GILLOT-20/+15
Items are guaranteed to be HIR owner.
2021-02-15Use an ItemId inside mir::GlobalAsm.Camille GILLOT-4/+4
2021-02-15Use ItemId as a strongly typed index.Camille GILLOT-1/+1
2021-02-15Rollup merge of #82067 - BoxyUwU:hahaicantthinkofabadpun, r=oli-obkJonas Schievink-2/+11
const_generics: Fix incorrect ty::ParamEnv::empty() usage Fixes #80561 Not sure if I should keep the `debug!(..)`s or not but its the second time I've needed them so they sure seem useful lol cc ``@lcnr`` r? ``@oli-obk``
2021-02-15Rollup merge of #82061 - RalfJung:ctfe-read-pointer-as-bytes, r=oli-obkJonas Schievink-13/+29
CTFE validation: catch ReadPointerAsBytes and better error r? ``@oli-obk`` Fixes https://github.com/rust-lang/rust/issues/79690 Cc https://github.com/rust-lang/miri/issues/1706
2021-02-15Rollup merge of #82009 - BoxyUwU:idontknooow, r=varkorJonas Schievink-1/+1
const_generics: Dont evaluate array length const when handling errors Fixes #79518 Fixes #78246 cc ````@lcnr```` This was ICE'ing because we dont pass in the correct ``ParamEnv`` which meant that there was no ``Self: Foo`` predicate to make ``Self::Assoc`` well formed which caused an ICE when trying to normalize ``Self::Assoc`` in the mir interpreter r? ````@varkor````
2021-02-15Rollup merge of #81503 - henryboisdequin:fix-const-fn-arr-err-msg, r=estebankJonas Schievink-2/+46
Suggest to create a new `const` item if the `fn` in the array is a `const fn` Fixes #73734. If the `fn` in the array repeat expression is a `const fn`, suggest creating a new `const` item. On nightly, suggest creating an inline `const` block. This PR also removes the `suggest_const_in_array_repeat_expressions` as it is no longer necessary. Example: ```rust fn main() { // Should not compile but hint to create a new const item (stable) or an inline const block (nightly) let strings: [String; 5] = [String::new(); 5]; println!("{:?}", strings); } ``` Gives this error: ``` error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:3:32 | 2 | let strings: [String; 5] = [String::new(); 5]; | ^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `String` | = note: the `Copy` trait is required because the repeated element will be copied ``` With this change, this is the error message: ``` error[E0277]: the trait bound `String: Copy` is not satisfied --> $DIR/const-fn-in-vec.rs:3:32 | LL | let strings: [String; 5] = [String::new(); 5]; | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | = help: moving the function call to a new `const` item will resolve the error ```
2021-02-15Revise HIR lowering commentEdward Shen-2/+2
2021-02-14Use delay_span_bug for mismatched subst/hir argEdward Shen-7/+4
2021-02-14Rollup merge of #82056 - b-naber:mut_for_loop_bug, r=oli-obkDylan DPC-5/+17
fix ice (#82032) Fixes https://github.com/rust-lang/rust/issues/82032
2021-02-14Rollup merge of #82029 - tmiasko:debug, r=matthewjasperDylan DPC-4/+7
Use debug log level for developer oriented logs The information logged here is of limited general interest, while at the same times makes it impractical to simply enable logging and share the resulting logs due to the amount of the output produced. Reduce log level from info to debug for developer oriented information. For example, when building cargo, this reduces the amount of logs generated by `RUSTC_LOG=info cargo build` from 265 MB to 79 MB. Continuation of changes from 81350.
2021-02-14use option<PlaceRef<'tcx>> to clean up mir code a littleHenry Boisdequin-9/+10
2021-02-13yeet ya fixme into the voidEllen-2/+11
2021-02-13Fix MIR pretty printer for non-local DefIdsÖmer Sinan Ağacan-13/+13
2021-02-13Heat up the ICE-y error reportingEllen-1/+1
rest in peace match bool <3
2021-02-13CTFE validation: catch ReadPointerAsBytes and better errorRalf Jung-13/+29
2021-02-13fix 82032b-naber-5/+17
2021-02-13Use debug log level for developer oriented logsTomasz Miąsko-4/+7
The information logged here is of limited general interest, while at the same times makes it impractical to simply enable logging and share the resulting logs due to the amount of the output produced. Reduce log level from info to debug for developer oriented information. For example, when building cargo, this reduces the amount of logs generated by `RUSTC_LOG=info cargo build` from 265 MB to 79 MB. Continuation of changes from 81350.
2021-02-12Rollup merge of #81479 - osa1:issue24151, r=lcnrDylan DPC-15/+24
Allow casting mut array ref to mut ptr Allow casting mut array ref to mut ptr We now allow two new casts: - mut array reference to mut ptr. Example: let mut x: [usize; 2] = [0, 0]; let p = &mut x as *mut usize; We allow casting const array references to const pointers so not allowing mut references to mut pointers was inconsistent. - mut array reference to const ptr. Example: let mut x: [usize; 2] = [0, 0]; let p = &mut x as *const usize; This was similarly inconsistent as we allow casting mut references to const pointers. Existing test 'vector-cast-weirdness' updated to test both cases. Fixes #24151
2021-02-12Rollup merge of #81959 - therealprof:fix-typo, r=oli-obkYuki Okushi-1/+1
Fix assosiated typo Introduced in d3c4dbd85d63c8bdfa362d7cac8b3e8cbca51272, noticed only after the fact, sorry. 😅 Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2021-02-12[librustdoc] Reform lang string token splittingCasey Rodarmor-2/+2
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to preserve backwards compatibility with pandoc-style langstrings, strip a surrounding `{}`, and remove leading `.`s from each token. Prior to this change, doctest lang strings were split on all non-alphanumeric characters except `-` or `_`, which limited future extensions to doctest lang string tokens, for example using `=` for key-value tokens. This is a breaking change, although it is not expected to be disruptive, because lang strings using separators other than `,` and ` ` are not very common
2021-02-11Auto merge of #81350 - tmiasko:instrument-debug, r=lcnrbors-2/+2
Reduce log level used by tracing instrumentation from info to debug Restore log level to debug to avoid make info log level overly verbose (the uses of instrument attribute modified there, were for the most part a replacement for `debug!`; one use was novel).
2021-02-10Allow casting mut array ref to mut ptrÖmer Sinan Ağacan-15/+24
We now allow two new casts: - mut array reference to mut ptr. Example: let mut x: [usize; 2] = [0, 0]; let p = &mut x as *mut usize; We allow casting const array references to const pointers so not allowing mut references to mut pointers was inconsistent. - mut array reference to const ptr. Example: let mut x: [usize; 2] = [0, 0]; let p = &mut x as *const usize; This was similarly inconsistent as we allow casting mut references to const pointers. Existing test 'vector-cast-weirdness' updated to test both cases. Fixes #24151
2021-02-10Fix assosiated typoDaniel Egger-1/+1
Introduced in d3c4dbd85d63c8bdfa362d7cac8b3e8cbca51272, noticed only after the fact, sorry. 😅 Signed-off-by: Daniel Egger <daniel@eggers-club.de>
2021-02-10Only initialize what is usedDániel Buga-3/+2
2021-02-09Stabilize str_split_onceJacob Pratt-1/+0
2021-02-10Rollup merge of #81466 - sasurau4:fix/enhance-sugget-mut-method-for-loop, ↵Yuki Okushi-9/+85
r=oli-obk Add suggest mut method for loop Part of #49839 This PR focus on [the comment case](https://github.com/rust-lang/rust/issues/49839#issuecomment-761930746)
2021-02-09Auto merge of #81132 - bugadani:map-prealloc, r=matthewjasperbors-92/+95
Borrowck: refactor visited map to a bitset This PR refactors `Borrows` and the `precompute_borrows_out_of_scope` function so that this initial phase has a much reduced memory pressure. This is achieved by reducing what is stored on the heap, and also reusing heap memory as much as possible.
2021-02-08Remove RCs from BorrowsDániel Buga-15/+10
2021-02-08Rollup merge of #81779 - geogriff:const-ptr-to-int-error, r=lcnrMara Bos-1/+8
improve error message for disallowed ptr-to-int casts in const eval Improves an error message as [suggested](https://github.com/rust-lang/rust/issues/80875#issuecomment-762754580) in #80875. Does the wording make enough sense? I tried to follow precedent for error message style while maintaining brevity. It seems like the rest of the `ConstEvalErrKind::NeedsRfc` error messages could be improved as well. I could give that a go if this approach works. Closes #80875
2021-02-08Point out implicit deref coercions in borrow1000teslas-4/+33
Clean up code
2021-02-07Optimize BorrowsDániel Buga-82/+90
Reuse as much memory as possible, reduce number of allocations. Use BitSet instead of a HashMap, since only a single bit of information was used as the map's value.
2021-02-05Add suggest mu method for loopDaiki Ihara-9/+85
2021-02-05improve error message for disallowed ptr-to-int casts in const evalJeffrey Griffin-1/+8
2021-02-05Never MIR inline functions with a different instruction setTomasz Miąsko-0/+5
2021-02-03Fix panic when emitting diagnostic for closure mutable binding errorAaron Hill-2/+2
Fixes #81700 The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is still a mutable borrow for the purposes of this diagnostic code.
2021-02-03added a suggestion to create a `const` item if the `fn` in the array repeat ↵Henry Boisdequin-2/+46
expression is a `const fn`
2021-02-01Rollup merge of #81463 - matsujika:nll-ensure-c-case, r=varkorJonas Schievink-60/+60
Rename NLL* to Nll* accordingly to C-CASE Given [C-CASE](https://rust-lang.github.io/api-guidelines/naming.html#casing-conforms-to-rfc-430-c-case), `NLLRegionVariableOrigin` and `NLL` are encouraged to be `NllRegionVariableOrigin` and `Nll` respectively.