about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2022-11-23Do not need to account for overflow in predicate_can_applyMichael Goulet-1/+4
2022-11-22Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnrManish Goregaokar-41/+29
Allow opaque types in trait impl headers and rely on coherence to reject unsound cases r? ````@lcnr```` fixes #99840
2022-11-22Use `tcx.require_lang_item` instead of unwrappingMaybe Waffle-1/+1
2022-11-22Auto merge of #104696 - matthiaskrgr:rollup-gi1pdb0, r=matthiaskrgrbors-48/+37
Rollup of 11 pull requests Successful merges: - #103396 (Pin::new_unchecked: discuss pinning closure captures) - #104416 (Fix using `include_bytes` in pattern position) - #104557 (Add a test case for async dyn* traits) - #104559 (Split `MacArgs` in two.) - #104597 (Probe + better error messsage for `need_migrate_deref_output_trait_object`) - #104656 (Move tests) - #104657 (Do not check transmute if has non region infer) - #104663 (rustdoc: factor out common button CSS) - #104666 (Migrate alias search result to CSS variables) - #104674 (Make negative_impl and negative_impl_exists take the right types) - #104692 (Update test's cfg-if dependency to 1.0) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-22Rollup merge of #104674 - spastorino:negative-impl-tcx, r=lcnrMatthias Krüger-16/+10
Make negative_impl and negative_impl_exists take the right types r? `@lcnr`
2022-11-22Rollup merge of #104597 - ↵Matthias Krüger-32/+27
compiler-errors:need_migrate_deref_output_trait_object-msg, r=eholk Probe + better error messsage for `need_migrate_deref_output_trait_object` 1. Use `InferCtxt::probe` in `need_migrate_deref_output_trait_object` -- that normalization *could* technically do type inference as a side-effect, and this is a lint, so it should have no side-effects. 2. Return the trait-ref so we format the error message correctly. See the UI test change -- `(dyn A + 'static)` is not a trait.
2022-11-21Stop passing the self-type as a separate argument.Oli Scherer-68/+46
2022-11-21Remove a redundant assertOli Scherer-6/+0
2022-11-21For lcnrOli Scherer-0/+1
2022-11-21Add helper to create the trait ref for a lang itemOli Scherer-18/+14
2022-11-21Use iterators instead of slices at more sitesOli Scherer-5/+6
2022-11-21Allow iterators instead of requiring slices that will get turned into iteratorsOli Scherer-31/+25
2022-11-21Add a helper for replacing the self type in trait refsOli Scherer-25/+5
2022-11-21Assert that various types have the right amount of generic args and fix the ↵Oli Scherer-85/+74
sites that used the wrong amount
2022-11-21Split out the actual predicate solving code into a separate functionOli Scherer-9/+17
2022-11-21Check that type_implements_trait actually is passed the right amount of ↵Oli Scherer-3/+11
generic params
2022-11-21Add an always-ambiguous predicate to make sure that we don't accidentlally ↵Oli Scherer-0/+10
allow trait resolution to prove false things during coherence
2022-11-21Treat different opaque types of the same def id as equal during coherenceOli Scherer-40/+18
2022-11-21Allow opaque types in trait impl headers and rely on coherence to reject ↵Oli Scherer-3/+3
unsound cases
2022-11-21negative_impl_exists should take an InferCtxtSantiago Pastorino-8/+7
2022-11-21negative_impl should take a TyCtxtSantiago Pastorino-8/+3
2022-11-21Rollup merge of #104595 - compiler-errors:poly-existential-predicate, r=lcnrMatthias Krüger-2/+2
Add `PolyExistentialPredicate` type alias Wrapping `ExistentialPredicate`s in a binder is very common, and this alias already exists for the `PolyExistential{TraitRef,Projection}` types.
2022-11-20Auto merge of #98914 - fee1-dead-contrib:min-deref-patterns, r=compiler-errorsbors-1/+1
Minimal implementation of implicit deref patterns for Strings cc `@compiler-errors` `@BoxyUwU` https://github.com/rust-lang/lang-team/issues/88 #87121 ~~I forgot to add a feature gate, will do so in a minute~~ Done
2022-11-19revert-overflowouz-a-16/+0
2022-11-19Rollup merge of #104593 - compiler-errors:rpitit-object-safety-spans, ↵Matthias Krüger-6/+15
r=fee1-dead Improve spans for RPITIT object-safety errors No reason why we can't point at the `impl Trait` that causes the object-safety violation. Also [drive-by: Add is_async fn to hir::IsAsync](https://github.com/rust-lang/rust/pull/104593/commits/c4165f3a965e258531928180195637455299c6f3), which touches clippy too.
2022-11-19Rollup merge of #104469 - estebank:long-types, r=oli-obkMatthias Krüger-11/+59
Make "long type" printing type aware and trim types in E0275 Instead of simple string cutting, use a custom printer to hide parts of long printed types. On E0275, check for type length before printing.
2022-11-19Auto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obkbors-2/+2
Revert "Normalize opaques with escaping bound vars" This caused a perf regression in #103423, cc `@skyzh` this should fix #103423. reverts #100980 r? `@oli-obk`
2022-11-19Rollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnrDylan DPC-18/+19
Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less there are only like 3 or 4 call sites left after this but it wasnt obvious to me how to remove them
2022-11-19Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errorsDylan DPC-7/+19
nll: correctly deal with bivariance fixes #104409 when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions. r? types cc ``@RalfJung``
2022-11-19Probe + better error messsage for need_migrate_deref_output_trait_objectMichael Goulet-32/+27
2022-11-19drive-by: PolyExistentialPredicateMichael Goulet-2/+2
2022-11-19Improve spans for RPITIT object-safety errorsMichael Goulet-6/+15
2022-11-18Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearthbors-0/+28
Rollup of 8 pull requests Successful merges: - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`) - #103378 (Fix mod_inv termination for the last iteration) - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS) - #103701 (Simplify some pointer method implementations) - #104047 (Diagnostics `icu4x` based list formatting.) - #104338 (Enforce that `dyn*` coercions are actually pointer-sized) - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`) - #104556 (rustdoc: use `code-header` class to format enum variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-18Only enforce ABI-mandated align, not preferred align is compatibleMichael Goulet-1/+1
2022-11-18Check both align and size in PointerSizedMichael Goulet-1/+2
2022-11-18Enforce that dyn* casts are actually pointer-sizedMichael Goulet-0/+27
2022-11-18Revert "Normalize opaques with escaping bound vars"Michael Goulet-2/+2
This reverts commit 43119d643857efc366bfca527ac2dadfc3f2e906.
2022-11-18review commentEsteban Küber-8/+2
2022-11-18On E0275 do not print out the full type in the msgEsteban Küber-7/+41
When printing requirement overflow errors, do not print out the full type name when it is longer than 50 characters long.
2022-11-18On overflow errors, do not print out long typesEsteban Küber-4/+24
2022-11-18require an `ErrorGuaranteed` to taint infcx with errorsBoxy-1/+4
2022-11-18rename `is_tainted_by_errors` Boxy-11/+13
2022-11-18`InferCtxt::is_tainted_by_errors` returns `ErrorGuaranteed`Boxy-17/+13
2022-11-18Rollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholkMatthias Krüger-5/+9
Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting) This makes sure we don't accidentally allow coercions like `Box<T>` -> `Box<dyn* Trait>`, or in the case of this ICE, `&T` to `&dyn* Trait`. These coercions don't make sense, at least not via the `CoerceUnsized` trait. Fixes #102172 Fixes #102429
2022-11-18Rm diagnostic item, use lang itemDeadbeef-1/+1
2022-11-17Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errorsMatthias Krüger-130/+134
Convert predicates into Predicate in the Obligation constructor instead of having almost all callers do that. This reduces a bit of boilerplate, and also paves the way for my work towards https://github.com/rust-lang/compiler-team/issues/531 (as it makes it easier to accept both goals and clauses where right now it only accepts predicates).
2022-11-17Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-deadbors-3/+2
Record `LocalDefId` in HIR nodes instead of a side table This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR. This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed. This first part adds the information to HIR nodes themselves instead of a table. The second part is https://github.com/rust-lang/rust/pull/103902 The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter. The fourth part will be to completely remove the side table.
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-1/+1
2022-11-16Convert predicates into Predicate in the Obligation constructorOli Scherer-130/+134
2022-11-16cleanup and dedupe CTFE and Miri error reportingRalf Jung-24/+0