about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits
AgeCommit message (Collapse)AuthorLines
2024-05-25Rollup merge of #125510 - lcnr:change-proof-trees-to-be-shallow, ↵Matthias Krüger-33/+2
r=compiler-errors remove proof tree formatting, make em shallow Debugging via tracing `RUSTC_LOG=rustc_trait_selection::solve=debug` is now imo slightly more readable then the actual proof tree formatter. Removing everything that's not needed for the `analyse` visitor allows us to remove a bunch of code. I personally believe that we should continue to use tracing over proof trees for debugging: - it eagerly prints, allowing us to debug ICEs - the proof tree builder ends up going out of sync with the actual runtime behavior, which is confusing - using shallow proof trees is a lot more performant as we frequently do not recurse into all nested goals when using an analyse visitor - this allows us to clean up the implementation and remove some code r? ```@compiler-errors```
2024-05-24remove proof tree formatter, make em shallowlcnr-33/+2
2024-05-24Remove `DefId` from `EarlyParamRegion` (tedium/diagnostics)Boxy-0/+1
2024-05-24Use regular type equating instead of a custom queryOli Scherer-21/+1
2024-05-23Support constraining opaque types while trait upcasting with bindersOli Scherer-1/+1
2024-05-23Allow defining opaque types during trait object upcasting.Oli Scherer-1/+1
No stable code is affected, as this requires the `trait_upcasting` feature gate.
2024-05-23When checking whether an impl applies, constrain hidden types of opaque types.Oli Scherer-1/+1
We already handle this case this way on the coherence side, and it matches the new solver's behaviour. While there is some breakage around type-alias-impl-trait (see new "type annotations needed" in tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs), no stable code breaks, and no new stable code is accepted.
2024-05-23Remove `LintDiagnostic::msg`León Orell Valerian Liehr-47/+37
* instead simply set the primary message inside the lint decorator functions * it used to be this way before [#]101986 which introduced `msg` to prevent good path delayed bugs (which no longer exist) from firing under certain circumstances when lints were suppressed / silenced * this is no longer necessary for various reasons I presume * it shaves off complexity and makes further changes easier to implement
2024-05-22Rollup merge of #125259 - compiler-errors:fn-mut-as-a-treat, r=oli-obkLeón Orell Valerian Liehr-12/+3
An async closure may implement `FnMut`/`Fn` if it has no self-borrows There's no reason that async closures may not implement `FnMut` or `Fn` if they don't actually borrow anything with the closure's env lifetime. Specifically, #123660 made it so that we don't always need to borrow captures from the closure's env. See the doc comment on `should_reborrow_from_env_of_parent_coroutine_closure`: https://github.com/rust-lang/rust/blob/c00957a3e269219413041a4e3565f33b1f9d0779/compiler/rustc_hir_typeck/src/upvar.rs#L1777-L1823 If there are no such borrows, then we are free to implement `FnMut` and `Fn` as permitted by our closure's inferred `ClosureKind`. As far as I can tell, this change makes `async || {}` work in precisely the set of places they used to work before #120361. Fixes #125247. r? oli-obk
2024-05-22Auto merge of #125335 - compiler-errors:binder, r=lcnrbors-3/+3
Uplift `Binder`, `OutlivesPredicate` into `rustc_type_ir` Almost done with all the types 🙏 r? lcnr
2024-05-21Uplift OutlivesPredicate, remove a bunch of unnecessary associated types ↵Michael Goulet-2/+1
from Interner
2024-05-21Uplift binderMichael Goulet-1/+2
2024-05-21Okay actually check only alias TYPESMichael Goulet-9/+3
2024-05-21Move `#[do_not_recommend]` to the `#[diagnostic]` namespaceGeorg Semmler-1/+4
This commit moves the `#[do_not_recommend]` attribute to the `#[diagnostic]` namespace. It still requires `#![feature(do_not_recommend)]` to work.
2024-05-19Auto merge of #125006 - spastorino:generics-is-empty, r=compiler-errorsbors-3/+3
Add and use generics.is_empty() and generics.is_own_empty, rather than using generics' attributes r? `@compiler-errors` Related to #123929
2024-05-19Add and use generics.is_empty() and generics.is_own_empty, rather than using ↵Santiago Pastorino-3/+3
generics' attributes
2024-05-19Actually use the `#[do_not_recommend]` attribute if presentGeorg Semmler-0/+26
This change tweaks the error message generation to actually use the `#[do_not_recommend]` attribute if present by just skipping the marked trait impl in favour of the parent impl. It also adds a compile test for this behaviour. Without this change the test would output the following error: ``` error[E0277]: the trait bound `&str: Expression` is not satisfied --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:53:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `Expression` is not implemented for `&str`, which is required by `&str: AsExpression<Integer>` | = help: the following other types implement trait `Expression`: Bound<T> SelectInt note: required for `&str` to implement `AsExpression<Integer>` --> /home/weiznich/Documents/rust/rust/tests/ui/diagnostic_namespace/do_not_recommend.rs:26:13 | LL | impl<T, ST> AsExpression<ST> for T | ^^^^^^^^^^^^^^^^ ^ LL | where LL | T: Expression<SqlType = ST>, | ------------------------ unsatisfied trait bound introduced here ``` Note how that mentions `&str: Expression` before and now mentions `&str: AsExpression<Integer>` instead which is much more helpful for users. Open points for further changes before stabilization: * We likely want to move the attribute to the `#[diagnostic]` namespace to relax the guarantees given? * How does it interact with the new trait solver?
2024-05-18Auto merge of #125257 - jieyouxu:rollup-11evnm9, r=jieyouxubors-1/+11
Rollup of 3 pull requests Successful merges: - #125214 (Only make GAT ambiguous in `match_projection_projections` considering shallow resolvability) - #125236 (Add tests for `-Zunpretty=expanded` ported from stringify's tests) - #125251 (Clarify how String::leak and into_boxed_str differ ) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-18Rollup merge of #125214 - compiler-errors:gat-guide, r=lcnr许杰友 Jieyou Xu (Joe)-1/+11
Only make GAT ambiguous in `match_projection_projections` considering shallow resolvability In #123537, I tweaked the hack from #93892 to use `resolve_vars_if_possible` instead of `shallow_resolve`. This considers more inference guidance ambiguous. This resulted in crater regressions in #125196. I've effectively reverted the change to the old behavior. That being said, I don't *like* this behavior, but I'd rather keep it for now since #123537 was not meant to make any behavioral changes. See the attached example. This also affects the new solver, for the record, which doesn't have any rules about not guiding inference from param-env candidates which may constrain GAT args as a side-effect. r? `@lcnr` or `@jackh726`
2024-05-18Auto merge of #125077 - spastorino:add-new-fnsafety-enum2, r=jackh726bors-7/+7
Rename Unsafe to Safety Alternative to #124455, which is to just have one Safety enum to use everywhere, this opens the posibility of adding `ast::Safety::Safe` that's useful for unsafe extern blocks. This leaves us today with: ```rust enum ast::Safety { Unsafe(Span), Default, // Safe (going to be added for unsafe extern blocks) } enum hir::Safety { Unsafe, Safe, } ``` We would convert from `ast::Safety::Default` into the right Safety level according the context.
2024-05-18An async closure may implement FnMut/Fn if it has no self-borrowsMichael Goulet-12/+3
2024-05-17Rename Unsafe to SafetySantiago Pastorino-7/+7
2024-05-17to_opt_poly_X_pred -> as_X_clauseMichael Goulet-13/+13
2024-05-17Only make GAT ambiguous in match_projection_projections considering shallow ↵Michael Goulet-1/+11
resolvability
2024-05-16Remove trivial Binder::dummy callsMichael Goulet-3/+3
2024-05-16Uplift Goal to rustc_type_irMichael Goulet-5/+5
2024-05-16Make P parameter explicitMichael Goulet-9/+7
2024-05-16Rename ToPredicate for UpcastMichael Goulet-42/+42
2024-05-13Auto merge of #125076 - compiler-errors:alias-term, r=lcnrbors-142/+148
Split out `ty::AliasTerm` from `ty::AliasTy` Splitting out `AliasTerm` (for use in project and normalizes goals) and `AliasTy` (for use in `ty::Alias`) r? lcnr
2024-05-13Apply nitsMichael Goulet-28/+4
2024-05-13split out AliasTy -> AliasTermMichael Goulet-140/+170
2024-05-13Remove `extern crate rustc_middle` from `rustc_trait_selection`.Nicholas Nethercote-0/+19
2024-05-11Apply nits, uplift ExistentialPredicate tooMichael Goulet-1/+2
2024-05-11Uplift `TraitPredicate`Michael Goulet-2/+5
2024-05-11Consolidate obligation cause codes for where clausesMichael Goulet-49/+35
2024-05-10Auto merge of #124982 - compiler-errors:uplift-trait-ref, r=lcnrbors-38/+63
Uplift `TraitRef` into `rustc_type_ir` Emotional rollercoaster r? lcnr
2024-05-10Lift `TraitRef` into `rustc_type_ir`Michael Goulet-37/+60
2024-05-10Lift `Lift`Michael Goulet-1/+3
2024-05-10Name tweaksMichael Goulet-32/+34
2024-05-10More rename falloutMichael Goulet-29/+29
2024-05-10Rename some ObligationCauseCode variantsMichael Goulet-92/+76
2024-05-10Remove glob imports for ObligationCauseCodeMichael Goulet-44/+48
2024-05-10rename some variants in FulfillmentErrorCodeMichael Goulet-31/+22
2024-05-10Auto merge of #124961 - matthiaskrgr:rollup-1jj65p6, r=matthiaskrgrbors-34/+13
Rollup of 7 pull requests Successful merges: - #124551 (Add benchmarks for `impl Debug for str`) - #124915 (`rustc_target` cleanups) - #124918 (Eliminate some `FIXME(lcnr)` comments) - #124927 (opt-dist: use xz2 instead of xz crate) - #124936 (analyse visitor: build proof tree in probe) - #124943 (always use `GenericArgsRef`) - #124955 (Use fewer origins when creating type variables.) r? `@ghost` `@rustbot` modify labels: rollup
2024-05-10Rollup merge of #124955 - nnethercote:next_ty_var, r=lcnrMatthias Krüger-22/+7
Use fewer origins when creating type variables. To reduce lots of repetitive boilerplate code. Details in the individual commit messages. r? ``@lcnr``
2024-05-10Rollup merge of #124943 - lcnr:generic-args-ref, r=compiler-errorsMatthias Krüger-2/+2
always use `GenericArgsRef` r? ```@compiler-errors```
2024-05-10Rollup merge of #124918 - nnethercote:FIXME-lcnr, r=lcnrMatthias Krüger-10/+4
Eliminate some `FIXME(lcnr)` comments In some cases this involved changing code. In some cases the comment was able to removed or replaced. r? ``@lcnr``
2024-05-09Rename Generics::params to Generics::own_paramsMichael Goulet-8/+8
2024-05-10De-tuple two `vtable_trait_first_method_offset` args.Nicholas Nethercote-8/+4
Thus eliminating a `FIXME` comment.
2024-05-10Remove out-of-date comment.Nicholas Nethercote-2/+0
The use of `Binder` was removed in the recent #123900, but the comment wasn't removed at the same time.