about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
2023-11-26Auto merge of #118267 - compiler-errors:ambiguity-causes, r=spastorinobors-67/+54
`AmbiguityCause` should not eagerly format strings Minor tweak found when working on some coherence diagnostics stuff (towards `-Ztrait-solver=next-coherence` stabilization)
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-10/+10
cleanup
2023-11-26Clean dead codesr0cky-17/+0
2023-11-25Rollup merge of #118290 - compiler-errors:placeholder-implied, r=aliemjayMichael Goulet-2/+4
Don't ICE when encountering placeholders in implied bounds computation I *could* fix this the right way, though I don't really want to think about the implications of the change. This should have minimal side-effects. r? `@aliemjay` Fixes #118286
2023-11-25Rollup merge of #118288 - compiler-errors:is_some_and, r=lqd,dtolnayMichael Goulet-6/+14
Use `is_{some,ok}_and` more in the compiler slightly more fluent-reading code
2023-11-25Rollup merge of #118201 - compiler-errors:obligation-causes, r=cjgillotMichael Goulet-20/+3
Miscellaneous `ObligationCauseCode` cleanups Remove some dead code/unused `ObligationCauseCode`s.
2023-11-25Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, ↵Michael Goulet-4/+1
r=compiler-errors Reduce fluent boilerplate Best reviewed one commit at a time. r? `@davidtwco`
2023-11-25Remove 3 more unused ObligationCauseCodesMichael Goulet-6/+0
2023-11-25Remove some lifetime-only ObligationCauseCode notesMichael Goulet-11/+3
2023-11-25Remove unused ObligationCauseCode::ProjectionWfMichael Goulet-3/+0
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-3/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25Get rid of infer vars in inherent assoc types selection by using probeSantiago Pastorino-1/+12
2023-11-25Rollup merge of #118199 - compiler-errors:qpath, r=lcnrGuillaume Gomez-2/+1
Remove `HirId` from `QPath::LangItem` Remove `HirId` from `QPath::LangItem`, since there was only *one* use-case (`ObligationCauseCode::AwaitableExpr`), which we can instead recover by walking the HIR tree.
2023-11-25Rollup merge of #117871 - klensy:unused-pub, r=cjgillotGuillaume Gomez-1/+1
remove unused pub fns This removes some unused `pub fn`; also fixes few obsoleted fn names or added fixmes with reminders to update them.
2023-11-25is_{some,ok}_andMichael Goulet-6/+14
2023-11-25Remove HirId from QPath::LangItemMichael Goulet-2/+1
2023-11-25Don't ICE when encountering placeholders in implied bounds computationMichael Goulet-2/+4
2023-11-25Rollup merge of #118259 - spastorino:move-eager-resolver-to-infer, ↵León Orell Valerian Liehr-80/+5
r=compiler-errors Move EagerResolution to rustc_infer::infer::resolve `EagerResolver` fits better in `rustc_infer::infer::resolver`. Started to disentagle #118118 that has a lot of unrelated things. r? `@compiler-errors` `@lcnr`
2023-11-25Auto merge of #118261 - spastorino:fix-placeholder-replacer, r=compiler-errorsbors-4/+18
Make PlaceholderReplacer shallow_resolver and recur when infer vars This makes resolve type and const infer vars resolve. Given: ```rust #![feature(inherent_associated_types)] #![allow(incomplete_features)] struct Foo<T>(T); impl<'a> Foo<fn(&'a ())> { type Assoc = &'a (); } fn bar(_: for<'a> fn(Foo<fn(Foo<fn(&'static ())>::Assoc)>::Assoc)) {} fn main() {} ``` We should normalize `for<'a> fn(Foo<fn(Foo<fn(&'static ())>::Assoc)>::Assoc)` to `for<'0> fn(&'1 ())` with `'1 == '0` and `'0 == 'static` constraints. We have to resolve `'1` to `'static` in the infcx associated to `PlaceholderReplacer`. This is part of https://github.com/rust-lang/rust/pull/118118 but unrelated to that PR. r? `@compiler-errors` `@lcnr`
2023-11-24AmbiguityCause should not eagerly format stringsMichael Goulet-67/+54
2023-11-24Make PlaceholderReplacer shallow_resolver when folding const and ty and ↵Santiago Pastorino-4/+18
recur if contain infer vars
2023-11-24Move EagerResolution to rustc_infer::infer::resolveSantiago Pastorino-80/+5
2023-11-24Rollup merge of #118243 - lcnr:commit-if-ok, r=compiler-errorsMichael Goulet-9/+9
EvalCtxt::commit_if_ok don't inherit nested goals we use it to check whether an alias is rigid, so we want to avoid considering an alias rigid simply because the inference constraints from normalizing it caused another nested goal fail r? `@compiler-errors`
2023-11-24Rollup merge of #118210 - lcnr:intercrate-ambiguity-causes-uwu, ↵Michael Goulet-2/+4
r=compiler-errors intercrate ambiguity causes: ignore candidates which don't apply r? `@compiler-errors`
2023-11-24EvalCtxt::commit_if_ok don't inherit nested goalslcnr-9/+9
2023-11-24Auto merge of #118189 - compiler-errors:cache-flags-for-const, r=nnethercotebors-7/+5
Cache flags for `ty::Const` Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost. r? `@ghost`
2023-11-23fix intercrate ambiguity causeslcnr-2/+4
2023-11-23reviewklensy-2/+1
2023-11-23few moreklensy-0/+1
2023-11-22Cache flags for ty::ConstMichael Goulet-7/+5
2023-11-22Auto merge of #118120 - compiler-errors:closure-kind, r=lcnrbors-51/+49
Remove `PredicateKind::ClosureKind` We don't need the `ClosureKind` predicate kind -- instead, `Fn`-family trait goals are left as ambiguous, and we only need to make progress on `FnOnce` projection goals for inference purposes. This is similar to how we do confirmation of `Fn`-family trait and projection goals in the new trait solver, which also doesn't use the `ClosureKind` predicate. Some hacky logic is added in the second commit so that we can keep the error messages the same.
2023-11-22Auto merge of #118133 - Urgau:stabilize_trait_upcasting, r=WaffleLapkinbors-51/+0
Stabilize RFC3324 dyn upcasting coercion This PR stabilize the `trait_upcasting` feature, aka https://github.com/rust-lang/rfcs/pull/3324. The FCP was completed here: https://github.com/rust-lang/rust/issues/65991#issuecomment-1817552398. ~~And also remove the `deref_into_dyn_supertrait` lint which is now handled by dyn upcasting coercion.~~ Heavily inspired by https://github.com/rust-lang/rust/pull/101718 Fixes https://github.com/rust-lang/rust/issues/65991
2023-11-22Stabilize RFC3324 dyn upcasting coercionUrgau-51/+0
Aka trait_upcasting feature. And also adjust the `deref_into_dyn_supertrait` lint.
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-1/+0
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-86/+77
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-21Restore closure-kind error messagesMichael Goulet-1/+43
2023-11-21Remove ClosureKind predicate kindMichael Goulet-50/+6
2023-11-21Rollup merge of #118115 - spastorino:fix-old-fn-names, r=compiler-errorsNilstrieb-1/+1
Fix occurrences of old fn names in comment and tracing
2023-11-20Fix occurrences of old fn names in comment and tracingSantiago Pastorino-1/+1
2023-11-20Rollup merge of #118089 - lcnr:intercrate-ambig-msg, r=compiler-errorsMatthias Krüger-37/+84
intercrate_ambiguity_causes: handle self ty infer + reservation impls r? `@compiler-errors`
2023-11-20Don't require intercrate mode for negative coherenceMichael Goulet-1/+7
2023-11-20Don't drop region constraints that come from plugging infer regions with ↵Michael Goulet-7/+7
placeholders
2023-11-20handle reservation impls, track impl sourcelcnr-26/+68
2023-11-20self ty infer ambiguity: add proof tree candlcnr-11/+16
2023-11-19Rollup merge of #118000 - compiler-errors:placeholder-ty-outlives, r=aliemjayMichael Goulet-2/+11
Make regionck care about placeholders in outlives components Currently, we don't consider a placeholder type `!T` to be a type component when it comes to processing type-outlives obligations. This means that they are essentially treated like unit values with no sub-components, and always outlive any region. This is problematic for `non_lifetime_binders`, and even more problematic for `with_negative_coherence`, since negative coherence uses placeholders as universals. This PR adds `Component::Placeholder` which acts much like `Component::Param`. This currently causes a regression in some non-lifetime-binders tests because `for<T> T: 'static` doesn't imply itself when processing outlives obligations, so code like this will fail: ``` fn foo() where for<T> T: 'static { foo() //~ fails } ``` Since the where clause doesn't imply itself. This requires making the `MatchAgainstHigherRankedOutlives` relation smarter when it comes to binders. r? types
2023-11-19Rollup merge of #117994 - compiler-errors:throw-away-regions-in-coherence, ↵Michael Goulet-9/+8
r=lcnr Ignore but do not assume region obligations from unifying headers in negative coherence Partly addresses a FIXME that was added in #112875. Just as we can throw away the nested trait/projection obligations from unifying two impl headers, we can also just throw away the region obligations too. I removed part of the FIXME that was incorrect, namely: > Given that the only region constraints we get are involving inference regions in the root, it shouldn't matter, but still sus. This is not true when unifying `fn(A)` and `for<'b> fn(&'b B)` which ends up with placeholder region outlives from non-root universes. I'm pretty sure this is okay, though it would be nice if we were to use them as assumptions. See the `explicit` revision of the test I committed, which still fails. Fixes #117986 r? lcnr, feel free to reassign tho.
2023-11-19Ignore but do not assume region obligations from unifying headers in ↵Michael Goulet-9/+8
negative coherence
2023-11-19Make regionck care about placeholders in outlives componentsMichael Goulet-2/+11