about summary refs log tree commit diff
path: root/src/librustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2020-06-20Consider fewer predicates for projection candidatesMatthew Jasper-36/+35
We now require that projection candidates are applicable with the idenitity substs of the trait, rather than allowing predicates that are only applicable for certain substs.
2020-06-20Try to suggest dereferences when trait selection failed.Donough Liu-1/+67
2020-06-20Decouple `Autoderef` with `FnCtxt` and move `Autoderef` to ↵Donough Liu-0/+230
`librustc_trait_selection`.
2020-06-20int -> i32Bastian Kauschke-7/+7
2020-06-20skol -> placeholderBastian Kauschke-17/+16
2020-06-19Rollup merge of #73452 - matthewjasper:auto-rec, r=nikomatsakisManish Goregaokar-1/+11
Unify region variables when projecting associated types This is required to avoid cycles when evaluating auto trait predicates. Notably, this is required to be able add Chalk types to `CtxtInterners` for `cfg(parallel_compiler)`. r? @nikomatsakis
2020-06-19Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasperManish Goregaokar-1/+1
shim.rs: avoid creating `Call` terminators calling `Self` Also contains some cleanup and doc comment additions so I could make sense of the code. Fixes https://github.com/rust-lang/rust/issues/73109 Closes https://github.com/rust-lang/rust/pull/73175 r? @matthewjasper
2020-06-19Add compare-mode=chalk and add a little bit more implementations and fixmesJack Huey-1/+5
2020-06-19Rollup merge of #73261 - estebank:generics-sized, r=nikomatsakisManish Goregaokar-26/+130
Suggest `?Sized` when applicable for ADTs Address #71790, fix #27964.
2020-06-18Rollup merge of #71338 - estebank:recursive-impl-trait, r=nikomatsakisManish Goregaokar-2/+2
Expand "recursive opaque type" diagnostic Fix #70968, partially address #66523.
2020-06-18Rollup merge of #70551 - mark-i-m:ty-err-2, r=varkorManish Goregaokar-22/+24
Make all uses of ty::Error delay a span bug r? @eddyb A second attempt at https://github.com/rust-lang/rust/pull/70245 resolves https://github.com/rust-lang/rust/issues/70866
2020-06-18review comments: add commentEsteban Küber-0/+6
2020-06-17Unify region variables when projecting associated typesmatthewjasper-1/+11
This is required to avoid cycles when evaluating auto trait predicates.
2020-06-16Provide `help` when `T: ?Sized` can't be suggestedEsteban Küber-9/+45
2020-06-16Auto merge of #72962 - lcnr:ObligationCause-lrc, r=ecstatic-morsebors-5/+6
store `ObligationCause` on the heap Stores `ObligationCause` on the heap using an `Rc`. This PR trades off some transient memory allocations to reduce the size of–and thus the number of instructions required to memcpy–a few widely used data structures in trait solving.
2020-06-15Account for derived obligations to suggest `?Sized` boundEsteban Küber-8/+8
Fix #27964.
2020-06-15Suggest `?Sized` when applicable for ADTsEsteban Küber-26/+88
Fix #71790.
2020-06-15make all uses of ty::Error or ConstKind::Error delay a span bugmark-22/+24
2020-06-15Expand "recursive opaque type" diagnosticEsteban Küber-2/+2
Fix #70968, partially address #66523.
2020-06-15Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJungbors-17/+33
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
2020-06-15Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnayRalf Jung-1/+0
Stabilize Option::zip This PR stabilizes the following API: ```rust impl<T> Option<T> { pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>; } ``` This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E&regexp=true&filter[lang][0]=Rust>. The `zip_with` method is left unstably as this API is kinda niche and it hasn't received much usage in Rust repositories on GitHub. cc #70086
2020-06-15Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasperRalf Jung-14/+31
On recursive ADT, provide indirection structured suggestion
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-2/+2
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-15Auto merge of #73367 - RalfJung:rollup-4ewvk9b, r=RalfJungbors-1/+6
Rollup of 10 pull requests Successful merges: - #71824 (Check for live drops in constants after drop elaboration) - #72389 (Explain move errors that occur due to method calls involving `self`) - #72556 (Fix trait alias inherent impl resolution) - #72584 (Stabilize vec::Drain::as_slice) - #72598 (Display information about captured variable in `FnMut` error) - #73336 (Group `Pattern::strip_*` method together) - #73341 (_match.rs: fix module doc comment) - #73342 (Fix iterator copied() documentation example code) - #73351 (Update E0446.md) - #73353 (structural_match: non-structural-match ty closures) Failed merges: r? @ghost
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-60/+47
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-14Improve `Instance` docsJonas Schievink-1/+1
2020-06-14structural_match: non-structural-match ty closuresDavid Wood-1/+6
This commit adds a `Closure` variant to `NonStructuralMatchTy` in `structural_match`, fixing an ICE which can occur when `impl_trait_in_bindings` is used with constants. Signed-off-by: David Wood <david@davidtw.co>
2020-06-13Add error note when trying fn as Fn traitCaleb Zulawski-0/+21
2020-06-13Don't implement Fn* traits for #[target_feature] functionsCaleb Zulawski-1/+15
2020-06-13Stabilize Option::zipLzu Tao-1/+0
2020-06-12Make `type_marked_structural` privateDylan MacKenzie-2/+1
2020-06-12Helper method for whether type has structural equalityDylan MacKenzie-12/+21
This helper method works for all types, falling back to a query for `TyKind::Adt`s to determine whether the implement the `{Partial,}StructuralEq` traits.
2020-06-11Document some opaque types codeMatthew Jasper-3/+11
2020-06-11Forbid lifetime elision in let position impl TraitMatthew Jasper-2/+2
This is consistent with types.
2020-06-11Remove associated opaque typesMatthew Jasper-22/+6
They're unused now.
2020-06-11Stop special casing top level TAITMatthew Jasper-37/+32
2020-06-10review comments: only suggest one substitutionEsteban Küber-35/+14
2020-06-10On recursive ADT, provide indirection structured suggestionEsteban Küber-14/+52
2020-06-10Rollup merge of #73005 - Aaron1011:fix/error-overflow, r=estebankDylan DPC-0/+18
Don't create impl candidates when obligation contains errors Fixes #72839 In PR #72621, trait selection was modified to no longer bail out early when an error type was encountered. This allowed us treat `ty::Error` as `Sized`, causing us to avoid emitting a spurious "not sized" error after a type error had already occured. However, this means that we may now try to match an impl candidate against the error type. Since the error type will unify with almost anything, this can cause us to infinitely recurse (eventually triggering an overflow) when trying to verify certain `where` clauses. This commit causes us to skip generating any impl candidates when an error type is involved.
2020-06-10Rollup merge of #72897 - lcnr:structurally-match-normalize, r=pnkfelixDylan DPC-1/+4
normalize adt fields during structural match checking fixes #72896 currently only fixes the issue itself and compiles stage 1 libs. I believe we have to use something else to normalize the adt fields here, as I expect some partially resolved adts to cause problems :thinking: stage 1 libs and the test itself pass, not sure about the rest... Will spend some more time looking into it tomorrow. r? @pnkfelix cc @eddyb
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-2/+2
2020-06-09Auto merge of #72114 - anyska:vtable-rename, r=nikomatsakisbors-103/+115
Rename traits::Vtable to ImplSource. Originally suggested by @eddyb. r? @nikomatsakis
2020-06-07store `ObligationCause` on the heapBastian Kauschke-5/+6
2020-06-06Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakisRalf Jung-19/+39
Make `PolyTraitRef::self_ty` return `Binder<Ty>` This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
2020-06-06Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrumbors-3/+2
Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-05Fix typoAaron Hill-1/+1
Co-authored-by: Randy Taylor <tehgecKozzz@gmail.com>
2020-06-05Rename traits::ImplSourceImpl to ImplSourceUserDefined.Ana-Maria Mihalache-15/+17
2020-06-05Rename traits::Vtable to ImplSource.Ana-Maria Mihalache-103/+113
2020-06-04Treat selection error as ambiguous when error type is presentAaron Hill-0/+8
2020-06-04Don't create impl candidates when obligation contains errorsAaron Hill-0/+10
Fixes #72839 In PR #72621, trait selection was modified to no longer bail out early when an error type was encountered. This allowed us treat `ty::Error` as `Sized`, causing us to avoid emitting a spurious "not sized" error after a type error had already occured. However, this means that we may now try to match an impl candidate against the error type. Since the error type will unify with almost anything, this can cause us to infinitely recurse (eventually triggering an overflow) when trying to verify certain `where` clauses. This commit causes us to skip generating any impl candidates when an error type is involved.