-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Refactor tcx mk_const parameters. #103984
Conversation
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#103868 (Use `TraitEngine` (by itself) less) - rust-lang#103878 (Fix artifact version/channel detection for stable) - rust-lang#103946 (Cleanup bind_pattern args) - rust-lang#103956 (Make mir opt unused file check blessable) - rust-lang#103977 (LLVM 16: Switch to using MemoryEffects) - rust-lang#103980 (rustdoc: simplify search results CSS and DOM) - rust-lang#103984 (Refactor tcx mk_const parameters.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@@ -2569,9 +2569,14 @@ impl<'tcx> TyCtxt<'tcx> { | |||
self.mk_ty_infer(TyVar(v)) | |||
} | |||
|
|||
#[inline] | |||
pub fn mk_const(self, kind: ty::ConstKind<'tcx>, ty: Ty<'tcx>) -> Const<'tcx> { |
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.
Follow up idea:
Use kind: impl Into<ty::ConstKind<'tcx>>
and remove mk_const_var, mk_const_param and mk_const_infer by adding the approriate From impls. Could also add one for ty::UnevaluatedConst, PlaceholderConst and ValTree and adjust the call sites sites to rely on the new impl
Unroll the
ty::ConstS
parameter toTyCtxt::mk_const
into separatety::ConstKind
andTy
parameters.Signature change is in:
https://github.com/V0ldek/rust/blob/c97fd8183a98d6a89b8fc2e02eb068298e6fb7dc/compiler/rustc_middle/src/ty/context.rs#L2234
and
https://github.com/V0ldek/rust/blob/c97fd8183a98d6a89b8fc2e02eb068298e6fb7dc/compiler/rustc_middle/src/ty/context.rs#L2572-L2575
the rest is callsites.
Closes #103974
r? @oli-obk