about summary refs log tree commit diff
path: root/src/librustc/traits
AgeCommit message (Collapse)AuthorLines
2018-11-28Filter out self-referential projection predicatesAaron Hill-1/+26
If we end up with a projection predicate that equates a type with itself (e.g. <T as MyType>::Value == <T as MyType>::Value), we can run into issues if we try to add it to our ParamEnv.
2018-11-28Check all substitution parameters for inference variablesAaron Hill-3/+8
2018-11-28Ensure that Rusdoc discovers all necessary auto trait boundsAaron Hill-17/+51
Fixes #50159 This commit makes several improvements to AutoTraitFinder: * Call infcx.resolve_type_vars_if_possible before processing new predicates. This ensures that we eliminate inference variables wherever possible. * Process all nested obligations we get from a vtable, not just ones with depth=1. * The 'depth=1' check was a hack to work around issues processing certain predicates. The other changes in this commit allow us to properly process all predicates that we encounter, so the check is no longer necessary, * Ensure that we only display predicates *without* inference variables to the user, and only attempt to unify predicates that *have* an inference variable as their type. Additionally, the internal helper method is_of_param now operates directly on a type, rather than taking a Substs. This allows us to use the 'self_ty' method, rather than directly dealing with Substs.
2018-11-27Use sort_by_cached_key when key the function is not trivial/freeljedrz-1/+1
2018-11-26rustc-guide has movedMark Mansi-8/+8
2018-11-25Auto merge of #55906 - nnethercote:rm-OpenSnapshot-CommittedSnapshot, ↵bors-9/+5
r=nikomatsakis Clean up and streamline snapshot data structures These commits clean up the snapshot structures a bit, so they are more consistent with each other and with the `ena` crate. They also remove the `OpenSnapshot` and `CommittedSnapshot` entries in the undo log, just like I did for the `ena` crate in https://github.com/rust-lang-nursery/ena/pull/14. This PR in combination with that `ena` PR reduces instruction counts by up to 6% on benchmarks. r? @nikomatsakis. Note that this isn't quite ready for landing, because the `ena` dependency in the first commit needs to be updated once https://github.com/rust-lang-nursery/ena/pull/14 lands. But otherwise it should be good.
2018-11-25Make `commit` and `rollback_to` methods take ownership of the snapshots.Nicholas Nethercote-3/+3
Because they shouldn't be reused. This provides consistency with the `ena` crate.
2018-11-25Remove `insert_noop`.Nicholas Nethercote-6/+2
Because it's as useless as its name suggests. This commit also renames `UndoLog::Noop` as `UndoLog::Purged`, because (a) that's a more descriptive name and (b) it matches the name used in similar code in `librustc/infer/region_constraints/mod.rs`.
2018-11-24Move `BoundTy` debruijn index to the `TyKind` enum variantscalexm-4/+4
2018-11-24Instantiate all bound vars universallyscalexm-6/+6
2018-11-24Rename some occurences of `skol` to `placeholder`scalexm-3/+3
2018-11-24Introduce `TyKind::Placeholder` variantscalexm-2/+6
2018-11-22Rollup merge of #55980 - csmoe:issue-55891, r=estebankGuillaume Gomez-1/+15
Suggest on closure args count mismatching with pipe span Closes #55891 r? @estebank
2018-11-19Rollup merge of #56027 - Xanewok:docs-backtick, r=QuietMisdreavusPietro Albini-1/+1
docs: Add missing backtick in object_safety.rs docs Closes #56019. r? @bjorn3
2018-11-17docs: Add missing backtick in object_safety.rs docsIgor Matuszewski-1/+1
Closes #56019.
2018-11-17reserve whitespaces between prefix and pipecsmoe-1/+1
2018-11-16improve debug output related to bound calculationNiko Matsakis-1/+6
2018-11-15lint based on closure pipe spancsmoe-1/+15
2018-11-15Auto merge of #55974 - pietroalbini:rollup, r=pietroalbinibors-4/+5
Rollup of 17 pull requests Successful merges: - #55182 (Redox: Update to new changes) - #55211 (Add BufWriter::buffer method) - #55507 (Add link to std::mem::size_of to size_of intrinsic documentation) - #55530 (Speed up String::from_utf16) - #55556 (Use `Mmap` to open the rmeta file.) - #55622 (NetBSD: link libstd with librt in addition to libpthread) - #55750 (Make `NodeId` and `HirLocalId` `newtype_index`) - #55778 (Wrap some query results in `Lrc`.) - #55781 (More precise spans for temps and their drops) - #55785 (Add mem::forget_unsized() for forgetting unsized values) - #55852 (Rewrite `...` as `..=` as a `MachineApplicable` 2018 idiom lint) - #55865 (Unix RwLock: avoid racy access to write_locked) - #55901 (fix various typos in doc comments) - #55926 (Change sidebar selector to fix compatibility with docs.rs) - #55930 (A handful of hir tweaks) - #55932 (core/char: Speed up `to_digit()` for `radix <= 10`) - #55956 (add tests for some fixed ICEs) Failed merges: r? @ghost
2018-11-15Rollup merge of #55901 - euclio:speling, r=petrochenkovPietro Albini-1/+1
fix various typos in doc comments
2018-11-15Rollup merge of #55778 - nnethercote:LrcPreds, r=eddybPietro Albini-3/+4
Wrap some query results in `Lrc`. So that the frequent clones in `try_get` are cheaper.
2018-11-15Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakisbors-8/+19
Reattach all grandchildren when constructing specialization graph. Specialization graphs are constructed by incrementally adding impls in the order of declaration. If the impl being added has its specializations in the graph already, they should be reattached under the impl. However, the current implementation only reattaches the one found first. Therefore, in the following specialization graph, ``` Tr1 | I3 / \ I1 I2 ``` If `I1`, `I2`, and `I3` are declared in this order, the compiler mistakenly constructs the following graph: ``` Tr1 / \ I3 I2 | I1 ``` This patch fixes the reattach procedure to include all specializing grandchildren-to-be. Fixes #50452.
2018-11-14Wrap some query results in `Lrc`.Nicholas Nethercote-3/+4
So that the frequent clones in `try_get` are cheaper. Fixes #54274.
2018-11-13fix various typos in doc commentsAndy Russell-1/+1
2018-11-13Auto merge of #55356 - Aaron1011:fix/rustdoc-negative-auto, r=nikomatsakisbors-1/+16
Check for negative impls when finding auto traits Fixes #55321 When AutoTraitFinder begins examining a type, it checks for an explicit negative impl. However, it wasn't checking for negative impls found when calling 'select' on predicates found from nested obligations. This commit makes AutoTraitFinder check for negative impls whenever it makes a call to 'select'. If a negative impl is found, it immediately bails out. Normal users of SelectioContext don't need to worry about this, since they stop as soon as an Unimplemented error is encountered. However, we add predicates to our ParamEnv when we encounter this error, so we need to handle negative impls specially (so that we don't try adding them to our ParamEnv).
2018-11-13Instantiate all bound vars existentiallyscalexm-2/+3
2018-11-13Reorder code in `rustc::traits::structural_impls`scalexm-340/+340
2018-11-13Bypass ppaux for `Outlives` predicatesscalexm-4/+34
2018-11-13Pretty print quantified goals and clausesscalexm-5/+144
2018-11-12Avoid the Box in `TyCtxt::associated_items`.Niko Matsakis-1/+1
This reduces instruction counts on packed_simd by 2%.
2018-11-11Rollup merge of #55745 - nnethercote:outlives_components-SmallVec, ↵Pietro Albini-1/+3
r=matthewjasper Convert `outlives_components`' return value to a `SmallVec` outparam. This avoids some allocations, reducing instruction counts by 1% on a couple of benchmarks.
2018-11-11Rollup merge of #55687 - alexreg:fix-24010, r=scalexmPietro Albini-6/+3
Take supertraits into account when calculating associated types Fixes #24010 and #23856. Applies to trait aliases too. As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See #50589 for more info. I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+. N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this. CC @carllerche @theemathas @durka @mbrubeck
2018-11-10Auto merge of #55717 - oli-obk:rustdoc_overflow, r=pnkfelixbors-1/+1
Bubble up an overflow error so that rustdoc can ignore it fixes #54524 Idk how to write a test for this, other than trying to minimize the entire diesel crate. If desirable I will do that. Note that there are many other such overflow errors hiding out there. Should we try to proactively eliminate them or do we just whack-a-mole them? cc @GuillaumeGomez r? @nikomatsakis
2018-11-08Rollup merge of #55736 - estebank:elide-anon-lt, r=petrochenkovMark Rousskov-1/+4
Elide anon lifetimes in conflicting impl note Fix #54690.
2018-11-08Fix typo in commentvarkor-1/+1
Co-Authored-By: Aaron1011 <aa1ronham@gmail.com>
2018-11-08Use `SmallVec` outparams in several functions.Nicholas Nethercote-1/+3
This avoids some allocations, reducing instruction counts by 1% on a couple of benchmarks.
2018-11-07Added error for duplicate bindings of associated type.Alexander Regueiro-5/+2
2018-11-07Look at projections from supertraits when constructing trait objects.Alexander Regueiro-1/+1
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-2/+2
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-07Rollup merge of #55501 - nnethercote:DoCompleted, r=pnkfelixkennytm-3/+4
Make `process_obligations`' computation of `completed` optional. It's only used in tests. This reduces instruction counts on several benchmarks by 0.5--1%.
2018-11-07Rollup merge of #55453 - Aaron1011:fix/rustdoc-lifetime, r=pnkfelixkennytm-9/+33
Choose predicates without inference variables over those with them Fixes #54705 When constructing synthetic auto trait impls, we may come across multiple predicates involving the same type, trait, and substitutions. Since we can only display one of these, we pick the one with the 'most strict' lifetime paramters. This ensures that the impl we render the user is actually valid (that is, a struct matching that impl will actually implement the auto trait in question). This commit exapnds the definition of 'more strict' to take into account inference variables. We always choose a predicate without inference variables over a predicate with inference variables.
2018-11-06Elide anon lifetimes in conflicting impl noteEsteban Küber-1/+4
2018-11-06refactor: use shorthand fieldsteresy-2/+2
2018-11-06Bubble up an overflow error so that rustdoc can ignore itOliver Scherer-1/+1
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-1/+1
2018-11-03Auto merge of #55101 - alexreg:trait-aliases, r=nikomatsakisbors-60/+175
Implement trait aliases (RFC 1733) Extends groundwork done in https://github.com/rust-lang/rust/pull/45047, and fully implements https://github.com/rust-lang/rfcs/pull/1733. CC @durka @nikomatsakis
2018-11-03Rename `Binder::no_late_bound_regions` to `Binder::no_bound_vars`scalexm-11/+11
2018-11-03Shift both late bound regions and bound typesscalexm-13/+13
2018-11-03Move `BoundTy` to `ty::TyKind`scalexm-5/+6
2018-11-03Extended elaboration for trait aliases to include arbitrary bounds.Alexander Regueiro-6/+6