-
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
Unify tcx.constness
query and param env constness checks
#102830
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
r? @fee1-dead since I think I saw from |
After #101900 we'll be able to remove the constness from ParamEnv entirely, so not sure it's worth it doing anything with it. But seems fine to me either way. |
LGTM @bors r+ |
📌 Commit 01d566c8cb73c69d237d7fb41b2119d1f69efa8d has been approved by It is now in the queue for this repository. |
☔ The latest upstream changes (presumably #102850) made this pull request unmergeable. Please resolve the merge conflicts. |
01d566c
to
677e428
Compare
r=me once ci green |
This comment has been minimized.
This comment has been minimized.
677e428
to
c1c159f
Compare
@bors r=fee1-dead |
…r=fee1-dead Unify `tcx.constness` query and param env constness checks The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query. I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ. Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check). Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
…r=fee1-dead Unify `tcx.constness` query and param env constness checks The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query. I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ. Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check). Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
…r=fee1-dead Unify `tcx.constness` query and param env constness checks The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query. I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ. Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check). Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
@bors r- failed in rollup |
c1c159f
to
bef8681
Compare
@bors r+ |
…r=fee1-dead Unify `tcx.constness` query and param env constness checks The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query. I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ. Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check). Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
Rollup of 7 pull requests Successful merges: - rust-lang#102623 (translation: eager translation) - rust-lang#102719 (Enforce alphabetical sorting with tidy) - rust-lang#102830 (Unify `tcx.constness` query and param env constness checks) - rust-lang#102883 (Fix stabilization of `feature(half_open_range_patterns)`) - rust-lang#102927 (Fix `let` keyword removal suggestion in structs) - rust-lang#102936 (rustdoc: remove unused CSS `nav.sum`) - rust-lang#102940 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 7 pull requests Successful merges: - rust-lang#102623 (translation: eager translation) - rust-lang#102769 (Clean up rustdoc startup) - rust-lang#102830 (Unify `tcx.constness` query and param env constness checks) - rust-lang#102847 (impl AsFd and AsRawFd for io::{Stdin, Stdout, Stderr}, not the sys versions) - rust-lang#102883 (Fix stabilization of `feature(half_open_range_patterns)`) - rust-lang#102936 (rustdoc: remove unused CSS `nav.sum`) - rust-lang#102940 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Revert "Unify tcx.constness and param env constness checks" Too much of a perf regression rust-lang#102975 (comment), and an attempt in rust-lang#103263 didn't fix it except for just a tiny bit. This change isn't really needed (see rust-lang#102830 (comment)), so this should be an easy revert.
Revert "Unify tcx.constness and param env constness checks" Too much of a perf regression rust-lang/rust#102975 (comment), and an attempt in #103263 didn't fix it except for just a tiny bit. This change isn't really needed (see rust-lang/rust#102830 (comment)), so this should be an easy revert.
Rollup of 7 pull requests Successful merges: - rust-lang#102623 (translation: eager translation) - rust-lang#102719 (Enforce alphabetical sorting with tidy) - rust-lang#102830 (Unify `tcx.constness` query and param env constness checks) - rust-lang#102883 (Fix stabilization of `feature(half_open_range_patterns)`) - rust-lang#102927 (Fix `let` keyword removal suggestion in structs) - rust-lang#102936 (rustdoc: remove unused CSS `nav.sum`) - rust-lang#102940 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The checks that we do in the
constness
query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into theconstness
query and call that from theparam_env
query.I'm not sure if this totally makes sense -- is there a case where
tcx.param_env()
would return a const param-env for an item whosetcx.constness()
isConstness::NotConst
? Because if not, it seems a bit dangerous that these two differ.Luckily, not many places actually use
tcx.constness()
, and the checks intcx.param_env()
seem stricter than the checks intcx.constness()
(at least for the types of items we type-check).Also, due to the way that
tcx.param_env()
is implemented, it never used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).