about summary refs log tree commit diff
path: root/src/librustc/ich
AgeCommit message (Collapse)AuthorLines
2018-10-04Auto merge of #53851 - oli-obk:local_promotion, r=eddybbors-0/+1
Limit the promotion of const fns to the libstd and the `rustc_promotable` attribute There are so many questions around promoting const fn calls... it seems saner to try to limit automatic promotion to const fns which were explicitly opted in for promotion. I added the attribute to all public stable const fns that were already promotable (e.g. not Cell::new) in order to not cause any breakage r? @eddyb cc @nikomatsakis
2018-10-03Record whether a Call in MIR corresponds to a call in HIRMatthew Jasper-1/+3
2018-10-03Introduce `TyKind::UnnormalizedProjection`scalexm-2/+2
2018-10-03Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakisbors-1/+9
NLL fails to suggest "try removing `&mut` here" Fixes #51191. This PR adds ``try removing `&mut` here`` suggestions to functions where a mutable borrow is being taken of a `&mut self` or a `self: &mut Self`. This PR also enables the suggestion for adding a `mut` pattern to by-value implicit self arguments without `mut` patterns already. r? @nikomatsakis
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-0/+1
2018-10-02Rollup merge of #54458 - scottmcm:bug-54456, r=nikomatsakisPietro Albini-2/+8
Allow both explicit and elided lifetimes in the same impl header While still prohibiting explicit and in-band in the same header. Fixes #54456 As usual, I don't know the broader context of the code I'm changing, so please let me know whatever I can do better. Pre-existing test that mixing explicit and in-band remains an error: https://github.com/rust-lang/rust/blob/master/src/test/ui/in-band-lifetimes/E0688.rs
2018-10-02Nest the `impl Trait` existential item inside the return typeOliver Schneider-0/+1
2018-10-02Improve implicit self mutability suggestions.David Wood-1/+9
This commit adds an `ImplicitSelfKind` to the HIR and the MIR that keeps track of whether a implicit self argument is immutable by-value, mutable by-value, immutable reference or mutable reference so that the addition of the `mut` keyword can be suggested for the immutable by-value case.
2018-09-30move ScalarMaybeUndef into the miri engineRalf Jung-5/+0
2018-09-25Auto merge of #53693 - scottmcm:marker-trait-attribute, r=nikomatsakisbors-0/+1
Support an explicit annotation for marker traits From the tracking issue for rust-lang/rfcs#1268: > It seems obvious that we should make a `#[marker]` annotation. ~ https://github.com/rust-lang/rust/issues/29864#issuecomment-368959441 This PR allows you to put `#[marker]` on a trait, at which point: - [x] The trait must not have any items ~~All of the trait's items must have defaults~~ - [x] Any impl of the trait must be empty (not override any items) - [x] But impls of the trait are allowed to overlap r? @nikomatsakis
2018-09-24Add more fake borrows to matchesMatthew Jasper-1/+1
2018-09-24Add "Shallow" borrow kindMatthew Jasper-0/+1
This allows treating the "fake" match borrows differently from shared borrows.
2018-09-23Auto merge of #54325 - michaelwoerister:incr-thinlto-tests, r=alexcrichtonbors-10/+2
incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. This adds some tests specifically targeted at incremental ThinLTO, plus the infrastructure for tracking the kind of cache hit/miss we had for a given CGU. @alexcrichton, let me know if you can think of any more tests to add. ThinLTO works rather reliably for small functions, so we should be able to test it in a robust way. I think after this lands it might time for a "Help us test incremental ThinLTO" post on irlo. r? @alexcrichton
2018-09-22Allow both explicit and elided lifetimes in the same impl headerScott McMurray-2/+8
(While still prohibiting explicit and in-band in the same header.)
2018-09-19Add an is_marker flag to TraitDefScott McMurray-0/+1
2018-09-18incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to ↵Michael Woerister-10/+2
test incremental ThinLTO.
2018-09-18Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake readRemy Rakic-1/+4
2018-09-14Auto merge of #54032 - oli-obk:layout_scalar_ranges, r=eddybbors-6/+9
Add forever unstable attribute to allow specifying arbitrary scalar ranges r? @eddyb for the first commit and @nikomatsakis for the second one
2018-09-13introduce SelfCtorF001-0/+1
2018-09-11Simplify Scope/ScopeData to have less chance of introducing UB or size increasesOliver Schneider-6/+9
2018-09-10propagate user-ascribes types down onto resulting bindingsNiko Matsakis-0/+1
But only in very simple cases.
2018-09-10generalize `AscribeUserType` to handle sub or super typeNiko Matsakis-1/+2
2018-09-10add the `AscribeUserType` statement kindNiko Matsakis-2/+2
Make it have the semantics of subtype.
2018-09-09Auto merge of #53902 - dtolnay:group, r=petrochenkovbors-0/+12
proc_macro::Group::span_open and span_close Before this addition, every delimited group like `(`...`)` `[`...`]` `{`...`}` has only a single Span that covers the full source location from opening delimiter to closing delimiter. This makes it impossible for a procedural macro to trigger an error pointing to just the opening or closing delimiter. The Rust compiler does not seem to have the same limitation: ```rust mod m { type T = } ``` ```console error: expected type, found `}` --> src/main.rs:3:1 | 3 | } | ^ ``` On that same input, a procedural macro would be forced to trigger the error on the last token inside the block, on the entire block, or on the next token after the block, none of which is really what you want for an error like above. This commit adds `group.span_open()` and `group.span_close()` which access the Span associated with just the opening delimiter and just the closing delimiter of the group. Relevant to Syn as we implement real error messages for when parsing fails in a procedural macro: https://github.com/dtolnay/syn/issues/476. ```diff impl Group { fn span(&self) -> Span; + fn span_open(&self) -> Span; + fn span_close(&self) -> Span; } ``` Fixes #48187 r? @alexcrichton
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-0/+12
2018-09-08Auto merge of #53903 - GabrielMajeri:opt-miri-array-slice, r=oli-obkbors-1/+1
Optimize miri checking of integer array/slices This pull request implements the optimization described in #53845 (the `E-easy` part of that issue, not the refactoring). Instead of checking every element of an integral array, we can check the whole memory range at once. r? @RalfJung
2018-09-08Auto merge of #53705 - ms2300:tmp, r=oli-obkbors-1/+1
#53576 Renaming TyAnon -> TyOpaque Fixes #53576
2018-09-08Optimize miri checking of integer array/slicesGabriel Majeri-1/+1
Instead of checking every element, we can check the whole memory range at once.
2018-09-07make field always private, add `From` implsNiko Matsakis-8/+0
2018-09-06Auto merge of #52626 - brunocodutra:issue-52475, r=oli-obkbors-5/+1
Fix issue #52475: Make loop detector only consider reachable memory As [suggested](https://github.com/rust-lang/rust/pull/51702#discussion_r197585664) by @oli-obk `alloc_id`s should be ignored by traversing all `Allocation`s in interpreter memory at a given moment in time, beginning by `ByRef` locals in the stack. - [x] Generalize the implementation of `Hash` for `EvalSnapshot` to traverse `Allocation`s - [x] Generalize the implementation of `PartialEq` for `EvalSnapshot` to traverse `Allocation`s - [x] Commit regression tests Fixes #52626 Fixes https://github.com/rust-lang/rust/issues/52849
2018-09-06Auto merge of #53721 - arielb1:exhaustively-unpun, r=nikomatsakisbors-7/+7
fix `is_non_exhaustive` confusion between structs and enums Structs and enums can both be non-exhaustive, with a very different meaning. This PR splits `is_non_exhaustive` to 2 separate functions - 1 for structs, and another for enums, and fixes the places that got the usage confused. Fixes #53549. r? @eddyb
2018-09-05Changing TyAnon -> TyOpaque and relevant functionsms2300-1/+1
2018-09-03Implement Hash in terms of HashStable for EvalSnapshotBruno Dutra-1/+1
2018-09-03Remove unused alloc_id_recursion_trackerBruno Dutra-4/+0
2018-09-01Auto merge of #53815 - F001:if-let-guard, r=petrochenkovbors-0/+4
refactor match guard This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114 The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers. r? @petrochenkov
2018-09-01move the is_field_list_non_exhaustive flag to VariantDefAriel Ben-Yehuda-7/+7
This completely splits the IS_NON_EXHAUSTIVE flag. No functional changes intended.
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-2/+2
2018-08-30introduce Guard enumF001-0/+4
2018-08-29re-do argument passing one more time to finally be saneRalf Jung-1/+6
2018-08-29Auto merge of #53659 - nnethercote:rm-AccumulateVec, r=Mark-Simulacrumbors-6/+6
Remove `AccumulateVec` and its uses. It's basically just a less capable version of `SmallVec`. FWIW, the only use of `ArrayVec` is now within `HybridIdxSet`. r? @Mark-Simulacrum
2018-08-29Remove `AccumulateVec` and its uses.Nicholas Nethercote-6/+6
It's basically just a less capable version of `SmallVec`.
2018-08-28address nitsRalf Jung-1/+1
2018-08-27Miri Memory WorkRalf Jung-2/+3
* Unify the two maps in memory to store the allocation and its kind together. * Share the handling of statics between CTFE and miri: The miri engine always uses "lazy" `AllocType::Static` when encountering a static. Acessing that static invokes CTFE (no matter the machine). The machine only has any influence when writing to a static, which CTFE outright rejects (but miri makes a copy-on-write). * Add an `AllocId` to by-ref consts so miri can use them as operands without making copies. * Move responsibilities around for the `eval_fn_call` machine hook: The hook just has to find the MIR (or entirely take care of everything); pushing the new stack frame is taken care of by the miri engine. * Expose the intrinsics and lang items implemented by CTFE so miri does not have to reimplement them.
2018-08-26rustc: Continue to tweak "std internal symbols"Alex Crichton-0/+1
In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: https://github.com/rust-lang/rust/issues/51342#issuecomment-414368019 [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
2018-08-24Auto merge of #53225 - nikomatsakis:nll-type-annot, r=pnkfelixbors-2/+3
MIR: support user-given type annotations on fns, structs, and enums This branch adds tooling to track user-given type annotations on functions, structs, and enum variant expressions. The user-given types are passed onto NLL which then enforces them. cc #47184 — not a complete fix, as there are more cases to cover r? @eddyb cc @rust-lang/wg-compiler-nll
2018-08-24support user-given types in adtsNiko Matsakis-1/+2
2018-08-24add a `user_ty` annotation to `Constant`Niko Matsakis-1/+1
2018-08-24Rollup merge of #53545 - FelixMcFelix:fix-50865-beta, r=petrochenkovkennytm-0/+1
Fix #50865: ICE on impl-trait returning functions reaching private items Adds a test case as suggested in #50865, and implements @petrochenkov's suggestion. Fixes #50865. Impl-trait-returning functions are marked under a new (low) access level, which they propagate rather than `AccessLevels::Reachable`. `AccessLevels::is_reachable` returns false for such items (leaving stability analysis unaffected), these items may still be visible to the lints phase however.
2018-08-23Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakisbors-1/+1
Implement try block expressions I noticed that `try` wasn't a keyword yet in Rust 2018, so... ~~Fix​es https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135 cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412
2018-08-22Auto merge of #52011 - ↵bors-1/+6
oli-obk:dont_you_hate_it_too_when_everything_panics_constantly, r=eddyb Allow panicking with string literal messages inside constants r? @eddyb cc https://github.com/rust-lang/rust/issues/51999 we can't implement things like `panic!("foo: {}", x)` right now because we can't call trait methods (most notably `Display::fmt`) inside constants. Also most of these impls probably have loops and conditions, so it's messy anyway. But hey `panic!("foo")` works at least. cc @japaric got any test ideas for `#![no_std]`?