Remove impl IntoQueryParam<P> for &'a P.#152879
Remove impl IntoQueryParam<P> for &'a P.#152879nnethercote wants to merge 1 commit intorust-lang:mainfrom
impl IntoQueryParam<P> for &'a P.#152879Conversation
|
Some changes occurred to the CTFE machinery Some changes occurred to constck cc @fee1-dead The Miri subtree was changed cc @rust-lang/miri HIR ty lowering was modified cc @fmease Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
89a8e28 to
5e3d666
Compare
|
Thanks for the review! I have fixed the two nits.
Let me explain why I did this. I'm on a ruthless drive to reduce complexity in the query system because I think it's a big problem. I would actually like to remove |
5e3d666 to
fb4258c
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
…-ref-P, r=oli-obk Remove `impl IntoQueryParam<P> for &'a P`. `IntoQueryParam` is a trait that lets query callers be a bit sloppy with the passed-in key. - Types similar to `DefId` will be auto-converted to `DefId`. Likewise for `LocalDefId`. - Reference types will be auto-derefed. The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing `&DefId` to queries that accept `DefId`, which is an anti-pattern because `DefId` is marked with `#[rustc_pass_by_value]`. This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using `*` to deref manually at call sites, preferring to deref via `&` in patterns or via `*` in match expressions. Mostly because that way a single deref often covers multiple call sites.) r? @cjgillot
|
@bors r- |
`IntoQueryParam` is a trait that lets query callers be a bit sloppy with the passed-in key. - Types similar to `DefId` will be auto-converted to `DefId`. Likewise for `LocalDefId`. - Reference types will be auto-derefed. The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing `&DefId` to queries that accept `DefId`, which is an anti-pattern because `DefId` is marked with `#[rustc_pass_by_value]`. This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using `*` to deref manually at call sites, preferring to deref via `&` in patterns or via `*` in match expressions. Mostly because that way a single deref often covers multiple call sites.)
fb4258c to
a3d5908
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
I rebased. @bors r=oli-obk rollup |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
(Apologies: I wrote a couple of comments here that were intended for #152958.) |
…-ref-P, r=oli-obk Remove `impl IntoQueryParam<P> for &'a P`. `IntoQueryParam` is a trait that lets query callers be a bit sloppy with the passed-in key. - Types similar to `DefId` will be auto-converted to `DefId`. Likewise for `LocalDefId`. - Reference types will be auto-derefed. The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing `&DefId` to queries that accept `DefId`, which is an anti-pattern because `DefId` is marked with `#[rustc_pass_by_value]`. This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using `*` to deref manually at call sites, preferring to deref via `&` in patterns or via `*` in match expressions. Mostly because that way a single deref often covers multiple call sites.) r? @cjgillot
Rollup of 15 pull requests Successful merges: - #150468 (rustc_target: callconv: powerpc64: Use the ABI set in target options instead of guessing) - #151628 (Fix ICE in const eval of packed SIMD types with non-power-of-two element counts) - #151871 (don't use env with infer vars) - #152591 (Simplify internals of `{Rc,Arc}::default`) - #152865 (Fixed ByteStr not padding within its Display trait when no specific alignment is mentioned) - #152908 (Enable rust.remap-debuginfo in the dist profile) - #147859 (reduce the amount of panics in `{TokenStream, Literal}::from_str` calls) - #152705 (Test(lib/win/proc): Skip `raw_attributes` doctest under Win7) - #152767 (fix typo in `carryless_mul` macro invocation) - #152837 (fix(codegen): Use `body_codegen_attrs` For Caller In `adjust_target_feature_sig`) - #152871 (Fix warnings in rs{begin,end}.rs files) - #152879 (Remove `impl IntoQueryParam<P> for &'a P`.) - #152933 (Start migration for `LintDiagnostic` items by adding API and migrating `LinkerOutput` lint) - #152937 (remove unneeded reboxing) - #152953 (Fix typo in armv7a-vex-v5.md)
IntoQueryParamis a trait that lets query callers be a bit sloppy with the passed-in key.DefIdwill be auto-converted toDefId. Likewise forLocalDefId.The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing
&DefIdto queries that acceptDefId, which is an anti-pattern becauseDefIdis marked with#[rustc_pass_by_value].This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using
*to deref manually at call sites, preferring to deref via&in patterns or via*in match expressions. Mostly because that way a single deref often covers multiple call sites.)r? @cjgillot