-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Move is_min_const_fn
query to librustc_mir.
#67781
Conversation
src/librustc_mir/constness.rs
Outdated
pub trait TyCtxtConstExt { | ||
/// Whether the `def_id` counts as const fn in your current crate, considering all active | ||
/// feature gates | ||
pub fn is_const_fn(self, def_id: DefId) -> bool { | ||
fn is_const_fn(self, def_id: DefId) -> bool; | ||
|
||
/// Whether the `def_id` is an unstable const fn and what feature gate is necessary to enable it | ||
fn is_unstable_const_fn(self, def_id: DefId) -> Option<Symbol>; | ||
|
||
/// Returns `true` if this function must conform to `min_const_fn` | ||
fn is_min_const_fn(self, def_id: DefId) -> bool; | ||
} | ||
|
||
impl<'tcx> TyCtxtConstExt for TyCtxt<'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.
I think these can just be free functions.
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.
Yea that seems better than an extension trait.
☔ The latest upstream changes (presumably #67886) made this pull request unmergeable. Please resolve the merge conflicts. |
r? @oli-obk |
src/librustc_mir/constness.rs
Outdated
@@ -1,16 +1,28 @@ | |||
use crate::hir; |
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.
Please move this file to src/librustc_mir/const_eval/fn_queries.rs
and reexport the functions in the const_eval
module
The only two uses of the associated methods are in librustc_mir and librustdoc. Please tell me if there is a better choice.
Rebased with review comments. |
@bors r+ rollup Thanks! |
📌 Commit c1c09be has been approved by |
Move `is_min_const_fn` query to librustc_mir. The only two uses of the associated methods are in `librustc_mir` and `librustdoc`. Please tell me if there is a better choice. cc rust-lang#65031
Rollup of 10 pull requests Successful merges: - #67774 (Try statx for all linux-gnu target.) - #67781 (Move `is_min_const_fn` query to librustc_mir.) - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs) - #67849 (Add a check for swapped words when we can't find an identifier) - #67875 (Distinguish between private items and hidden items in rustdoc) - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`) - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates) - #67977 (Updates for VxWorks) - #67985 (Remove insignificant notes from CStr documentation) - #68003 (ci: fix wrong shared.sh import for publish_toolstate) Failed merges: - #67820 (Parse the syntax described in RFC 2632) - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup) r? @ghost
Rollup of 10 pull requests Successful merges: - #67774 (Try statx for all linux-gnu target.) - #67781 (Move `is_min_const_fn` query to librustc_mir.) - #67798 (Remove wrong advice about spin locks from `spin_loop_hint` docs) - #67849 (Add a check for swapped words when we can't find an identifier) - #67875 (Distinguish between private items and hidden items in rustdoc) - #67887 (`Option::{expect,unwrap}` and `Result::{expect, expect_err, unwrap, unwrap_err}` have `#[track_caller]`) - #67955 (rustdoc: Remove more `#[doc(cfg(..))]` duplicates) - #67977 (Updates for VxWorks) - #67985 (Remove insignificant notes from CStr documentation) - #68003 (ci: fix wrong shared.sh import for publish_toolstate) Failed merges: - #67820 (Parse the syntax described in RFC 2632) - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup) r? @ghost
Rustup to rust-lang/rust#67781 changelog: none
The only two uses of the associated methods are in
librustc_mir
andlibrustdoc
. Please tell me if there is a better choice.cc #65031