-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uplift trait ref is knowable into rustc_next_trait_solver
#127437
Uplift trait ref is knowable into rustc_next_trait_solver
#127437
Conversation
Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
@@ -1201,6 +1201,7 @@ fn trait_def(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::TraitDef { | |||
|
|||
let is_marker = tcx.has_attr(def_id, sym::marker); | |||
let rustc_coinductive = tcx.has_attr(def_id, sym::rustc_coinductive); | |||
let is_fundamental = tcx.has_attr(def_id, sym::fundamental); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change the builtin attr to be only_local
if it isn't already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. This isn't possible without changing the way AdtKind
serialization works. When we deserialize an ADT, we actually call has_attr
on it, since we recreate its AdtFlags
from scratch. Changing this is pretty involved and includes serializing AdtFlags
directly.
@@ -522,6 +522,10 @@ impl<'tcx> Interner for TyCtxt<'tcx> { | |||
self.is_object_safe(trait_def_id) | |||
} | |||
|
|||
fn trait_is_fundamental(self, def_id: DefId) -> bool { | |||
self.trait_def(def_id).is_fundamental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we instead uplift trait_def
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems really annoying, and also ties rustc's internal repr of things to the type system. I don't think I want to do this.
use std::ops::Deref; | ||
|
||
use rustc_type_ir::fold::TypeFoldable; | ||
use rustc_type_ir::solve::{Certainty, Goal, NoSolution, SolverMode}; | ||
use rustc_type_ir::{self as ty, InferCtxtLike, Interner}; | ||
|
||
pub trait SolverDelegate: | ||
Deref<Target: InferCtxtLike<Interner = <Self as SolverDelegate>::Interner>> + Sized | ||
Deref<Target: InferCtxtLike<Interner = <Self as SolverDelegate>::Interner> + Sized> + Sized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what made the inner Sized
bound necessary? Alternatively, should InferCtxtLike
simply have a Sized
super trait bound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we pass &**delegate
to trait_ref_is_knowable
, which has a Infcx: InferCtxtLike
bound, which isn't relaxed ?Sized
. Changing that everywhere seems particularly annoying and I don't see the existence of an unsized InferCtxt
happening soon.
I'll move the bound to that trait though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me after nits
9dca9ad
to
ab27c2f
Compare
I moved the sized bound, but leaving the rest of the stuff as-is for now @bors r=lcnr |
…s-knowable, r=lcnr Uplift trait ref is knowable into `rustc_next_trait_solver` Self-explanatory. Eliminates one more delegate method. r? lcnr cc `@fmease`
Rollup of 12 pull requests Successful merges: - rust-lang#113128 (Support tail calls in mir via `TerminatorKind::TailCall`) - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127276 (rustdoc: Remove OpaqueTy) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 10 pull requests Successful merges: - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127437 - compiler-errors:uplift-trait-ref-is-knowable, r=lcnr Uplift trait ref is knowable into `rustc_next_trait_solver` Self-explanatory. Eliminates one more delegate method. r? lcnr cc ``@fmease``
Rollup of 10 pull requests Successful merges: - rust-lang#126841 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#126881 (Make `NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE` a deny-by-default lint in edition 2024) - rust-lang#126921 (Give VaList its own home) - rust-lang#127367 (Run alloc sync tests) - rust-lang#127431 (Use field ident spans directly instead of the full field span in diagnostics on local fields) - rust-lang#127437 (Uplift trait ref is knowable into `rustc_next_trait_solver`) - rust-lang#127439 (Uplift elaboration into `rustc_type_ir`) - rust-lang#127451 (Improve `run-make/output-type-permutations` code and improve `filename_not_in_denylist` API) - rust-lang#127452 (Fix intrinsic const parameter counting with `effects`) - rust-lang#127459 (rustdoc-json: add type/trait alias tests) r? `@ghost` `@rustbot` modify labels: rollup
Self-explanatory. Eliminates one more delegate method.
r? lcnr cc @fmease