about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2020-02-11Invert control in struct_lint_level.jumbatm-145/+192
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-02-11Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPCbors-10/+11
Make issue references consistent Fixes https://github.com/rust-lang/rust/issues/62976 cc https://github.com/rust-lang/rust/pull/63008 r? @varkor because you reviewed the original pr
2020-02-11Don't run coherence twice for future-compat lintsJonas Schievink-30/+43
2020-02-10Add `#[repr(no_niche)]`.Felix S. Klock II-8/+25
This repr-hint makes a struct/enum hide any niche within from its surrounding type-construction context. It is meant (at least initially) as an implementation detail for resolving issue 68303. We will not stabilize the repr-hint unless someone finds motivation for doing so. (So, declaration of `no_niche` feature lives in section of file where other internal implementation details are grouped, and deliberately leaves out the tracking issue number.) incorporated review feedback, and fixed post-rebase.
2020-02-10Rollup merge of #68932 - ↵Dylan DPC-2/+4
michaelwoerister:self-profile-generic-activity-args, r=wesleywiser self-profile: Support arguments for generic_activities. This PR adds support for recording arguments of "generic activities". The most notable use case is LLVM module names, which should be very interesting for `crox` profiles. In the future it might be interesting to add more fine-grained events for pre-query passes like macro expansion. I tried to judiciously de-duplicate existing self-profile events with `extra_verbose_generic_activity`, now that the latter also generates self-profile events. r? @wesleywiser
2020-02-10self-profile: Support arguments for generic_activities.Michael Woerister-2/+4
2020-02-10preallocate 2 Vecs in traits; tweak WfPredicates::normalizeljedrz-4/+5
2020-02-10Auto merge of #69012 - Dylan-DPC:rollup-13qn0fq, r=Dylan-DPCbors-325/+348
Rollup of 6 pull requests Successful merges: - #68694 (Reduce the number of `RefCell`s in `InferCtxt`.) - #68966 (Improve performance of coherence checks) - #68976 (Make `num::NonZeroX::new` an unstable `const fn`) - #68992 (Correctly parse `mut a @ b`) - #69005 (Small graphviz improvements for the new dataflow framework) - #69006 (parser: Keep current and previous tokens precisely) Failed merges: r? @ghost
2020-02-10Rollup merge of #68966 - jonas-schievink:coherence-perf, r=varkorDylan DPC-84/+30
Improve performance of coherence checks The biggest perf improvement in here is expected to come from the removal of the remaining #43355 warning code since that effectively runs the expensive parts of coherence *twice*, which can even be visualized by obtaining a flamegraph: ![image](https://user-images.githubusercontent.com/5047365/74091959-e1f41200-4a8b-11ea-969d-2849d3f86c63.png)
2020-02-10Rollup merge of #68694 - nnethercote:reduce-RefCells-in-InferCtxt, r=varkorDylan DPC-241/+318
Reduce the number of `RefCell`s in `InferCtxt`. `InferCtxt` contains six structures within `RefCell`s. Every time we create and dispose of (commit or rollback) a snapshot we have to `borrow_mut` each one of them. This commit moves the six structures under a single `RefCell`, which gives significant speed-ups by reducing the number of `borrow_mut` calls. To avoid runtime errors I had to reduce the lifetimes of dynamic borrows in a couple of places. r? @varkor
2020-02-09Remove vestigial #43355-compat codeJonas Schievink-83/+28
This was previously a future-compat warning that has since been turned into hard error, but without actually removing all the code. Avoids a call to `traits::overlapping_impls`, which is expensive.
2020-02-09Add desc to `specialization_graph_of` queryJonas Schievink-1/+2
2020-02-09Auto merge of #67665 - Patryk27:master, r=zackmdavisbors-84/+236
Improve reporting errors and suggestions for trait bounds Fix #66802 - When printing errors for unsized function parameter, properly point at the parameter instead of function's body. - Improve `consider further restricting this bound` (and related) messages by separating human-oriented hints from the machine-oriented ones.
2020-02-10Reduce the number of `RefCell`s in `InferCtxt`.Nicholas Nethercote-241/+318
`InferCtxt` contains six structures within `RefCell`s. Every time we create and dispose of (commit or rollback) a snapshot we have to `borrow_mut` each one of them. This commit moves the six structures under a single `RefCell`, which gives significant speed-ups by reducing the number of `borrow_mut` calls. To avoid runtime errors I had to reduce the lifetimes of dynamic borrows in a couple of places.
2020-02-09Make issue references consistentMatthias Prechtl-10/+11
2020-02-09Rollup merge of #68911 - jonas-schievink:inherent-overlap, r=petrochenkovJonas Schievink-32/+25
Speed up the inherent impl overlap check This gives a ~7% improvement in compile times for the stm32f0(x2) crate. Also addresses @eddyb's comment in https://github.com/rust-lang/rust/pull/68837#discussion_r375701767.
2020-02-09cache adt_drop_tysMatthew Jasper-2/+4
2020-02-09Apply suggestions from code reviewmatthewjasper-3/+3
Co-Authored-By: varkor <github@varkor.com>
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-84/+236
2020-02-09Rollup merge of #68857 - Marwes:allocations, r=matthewjasperDylan DPC-61/+100
perf: Reduce Vec allocations in normalization by passing &mut Vec Complicates the code a bit but allocation/freeing were a few percent of the overall runtime in trait heavy code.
2020-02-09Rollup merge of #68718 - Aaron1011:move-def-hir-span, r=petrochenkovDylan DPC-6/+6
Move `rustc_hir::def_id` to `rustc_span::def_id` This will allow `HygieneData` to refer to `DefId` and `DefIndex`, which will enable proper serialization of Span hygiene information. This also reduces the number of things imported from `rustc_hir`, which might make it easier to remove dependencies on it.
2020-02-08Move librustc_hir/def_id.rs to librustc_span/def_id.rsAaron Hill-6/+6
For noww, librustc_hir re-exports the `def_id` module from librustc_span, so the rest of rustc can continue to reference rustc_hir::def_id
2020-02-08Reduce Vec allocations in normalization by passing &mut VecMarkus Westerlind-61/+100
2020-02-08Auto merge of #68452 - msizanoen1:riscv-abi, r=nagisa,eddybbors-0/+1
Implement proper C ABI lowering for RISC-V This is necessary for full RISC-V psABI compliance when passing argument across C FFI boundary. cc @lenary
2020-02-08Make `provided_trait_methods` use `impl Iterator`Jonas Schievink-2/+1
2020-02-08Make `associated_items` query return a sliceJonas Schievink-31/+25
2020-02-07Auto merge of #65232 - nikomatsakis:lazy-norm-anon-const-push-2, r=matthewjasperbors-184/+473
replace the leak check with universes, take 2 This PR is an attempt to revive the "universe-based region check", which is an important step towards lazy normalization. Unlike before, we also modify the definition of `'empty` so that it is indexed by a universe. This sidesteps some of the surprising effects we saw before -- at the core, we no longer think that `exists<'a> { forall<'b> { 'b: 'a } }` is solveable. The new region lattice looks like this: ``` static ----------+-----...------+ (greatest) | | | early-bound and | | free regions | | | | | scope regions | | | | | empty(root) placeholder(U1) | | / | | / placeholder(Un) empty(U1) -- / | / ... / | / empty(Un) -------- (smallest) ``` This PR has three effects: * It changes a fair number of error messages, I think for the better. * It fixes a number of bugs. The old algorithm was too conservative and caused us to reject legal subtypings. * It also causes two regressions (things that used to compile, but now do not). * `coherence-subtyping.rs` gets an additional error. This is expected. * `issue-57639.rs` regresses as before, for the reasons covered in #57639. Both of the regressions stem from the same underlying property: without the leak check, the instantaneous "subtype" check is not able to tell whether higher-ranked subtyping will succeed or not. In both cases, we might be able to fix the problem by doing a 'leak-check like change' at some later point (e.g., as part of coherence). This is a draft PR because: * I didn't finish ripping out the leak-check completely. * We might want to consider a crater run before landing this. * We might want some kind of design meeting to cover the overall strategy. * I just remembered I never finished 100% integrating this into the canonicalization code. * I should also review what happens in NLL region checking -- it probably still has a notion of bottom (empty set). r? @matthewjasper
2020-02-07Rollup merge of #68919 - Zoxc:ast-lifetime, r=nikomatsakisDylan DPC-7/+0
Remove HashStable impl for ast::Lifetime
2020-02-07Rollup merge of #68889 - Zoxc:hir-krate, r=eddybDylan DPC-98/+94
Move the `hir().krate()` method to a query and remove the `Krate` dep node r? @eddyb cc @michaelwoerister
2020-02-07Rollup merge of #68164 - tmiasko:no-sanitize, r=nikomatsakisDylan DPC-0/+8
Selectively disable sanitizer instrumentation Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.
2020-02-07Remove HashStable impl for ast::LifetimeJohn Kåre Alsaker-7/+0
2020-02-06Rollup merge of #68524 - jonas-schievink:generator-resume-arguments, r=ZoxcDylan DPC-18/+56
Generator Resume Arguments cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974 Blockers: * [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069) * [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162) * [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901) * [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137) Follow-up work: * Change async/await desugaring to make use of this feature * Rewrite [`box_region.rs`](https://github.com/rust-lang/rust/blob/3d8778d767f0dde6fe2bc9459f21ead8e124d8cb/src/librustc_data_structures/box_region.rs) to use resume arguments (this shows up in profiles too)
2020-02-06lint impls that will become incoherent when leak-check is removedNiko Matsakis-11/+63
2020-02-06add the ability to skip leak check within a snapshotNiko Matsakis-12/+37
The intention is that coherence code will skip the leak check and determine whether two impls *would have* overlapped, and then issue a warning.
2020-02-06apply various formatting nitsNiko Matsakis-15/+15
2020-02-06use derive(Debug) for TypeTraceNiko Matsakis-7/+1
2020-02-06index ReEmpty by universeNiko Matsakis-45/+243
We now make `'empty` indexed by a universe index, resulting in a region lattice like this: ``` static ----------+-----...------+ (greatest) | | | early-bound and | | free regions | | | | | scope regions | | | | | empty(root) placeholder(U1) | | / | | / placeholder(Un) empty(U1) -- / | / ... / | / empty(Un) -------- (smallest) ``` Therefore, `exists<A> { forall<B> { B: A } }` is now unprovable, because A must be at least Empty(U1) and B is placeholder(U2), and hence the two regions are unrelated.
2020-02-06integrate the `sub_free_regions` code so we have only one copy of itNiko Matsakis-92/+99
2020-02-06add a `IsEmpty` for use in verified boundsNiko Matsakis-8/+25
We currently have a kind of arbitrary check for `Verify` conditions which says that if the "test region" is `'empty`, then the check passes. This was added to fix #42467 -- it happens to be correct for the purposes that we use verify bounds for, but it doesn't feel generally correct. Replace with a more principled test.
2020-02-06do not limit NiceRegionError to SubSupConflict or ConcreteFailureNiko Matsakis-13/+9
2020-02-06Make `krate` privateJohn Kåre Alsaker-1/+1
2020-02-06Rollup merge of #68837 - jonas-schievink:assoc-item-lookup-2, r=estebankDylan DPC-21/+15
Make associated item collection a query Before this change, every time associated items were iterated over (which rustc does *a lot* – this can probably be further optimized), there would be N+1 queries to fetch all assoc. items. Now there's just one after they've been computed once.
2020-02-06Comment tweaksJohn Kåre Alsaker-1/+2
2020-02-06Remove the `Forest` typeJohn Kåre Alsaker-62/+35
2020-02-06Move the `krate` method to Hir and remove the Krate dep nodeJohn Kåre Alsaker-31/+19
2020-02-06Add a `hir_krate` queryJohn Kåre Alsaker-1/+8
2020-02-06Add a Hir wrapper typeJohn Kåre Alsaker-6/+33
2020-02-06Auto merge of #68861 - Dylan-DPC:rollup-0m09hsg, r=Dylan-DPCbors-29/+3
Rollup of 8 pull requests Successful merges: - #68762 (Strip unnecessary subexpression) - #68790 (Improve `merge_from_succ`) - #68809 (Make more arithmetic functions unstably const) - #68832 (Clean up E0264, E0267 and E0268 explanations) - #68840 (On suggesting `#![recursion_limit = "X"]`, note current crate name) - #68846 (doc fix on doc attribute) - #68851 (Fix issue number of `capacity` method) - #68858 (Merge item id stable hashing functions) Failed merges: r? @ghost
2020-02-06Add CodegenFnAttrFlags::NO_SANITIZE_ANYTomasz Miąsko-0/+2
2020-02-05Selectively disable sanitizer instrumentationTomasz Miąsko-0/+6
Add `no_sanitize` attribute that allows to opt out from sanitizer instrumentation in an annotated function.