1
Fork 0

Implement #[rustc_default_body_unstable]

This attribute allows to mark default body of a trait function as
unstable. This means that implementing the trait without implementing
the function will require enabling unstable feature.

This is useful in conjunction with `#[rustc_must_implement_one_of]`,
we may want to relax requirements for a trait, for example allowing
implementing either of `PartialEq::{eq, ne}`, but do so in a safe way
-- making implementation of only `PartialEq::ne` unstable.
This commit is contained in:
Maybe Waffle 2022-04-27 18:14:19 +04:00
parent 96b9bb4620
commit 177af47104
14 changed files with 206 additions and 17 deletions

View file

@ -1094,6 +1094,11 @@ rustc_queries! {
separate_provide_extern
}
query lookup_default_body_stability(def_id: DefId) -> Option<attr::DefaultBodyStability> {
desc { |tcx| "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
separate_provide_extern
}
query should_inherit_track_caller(def_id: DefId) -> bool {
desc { |tcx| "computing should_inherit_track_caller of `{}`", tcx.def_path_str(def_id) }
}