Skip to content

Commit 85c8fb9

Browse files
committed
Revise docs for system set marker traits (#7882)
# Objective #7863 introduced a potential footgun. When trying to incorrectly add a user-defined type using `in_base_set`, the compiler will suggest that the user implement `BaseSystemSet` for their type. This is a reasonable-sounding suggestion, however this is not the correct way to make a base set, and will lead to a confusing panic message when a marker trait is implemented for the wrong type. ## Solution Rewrite the documentation for these traits, making it more clear that `BaseSystemSet` is a marker for types that are already base sets, and not a way to define a base set.
1 parent 73c1ab1 commit 85c8fb9

File tree

1 file changed

+9
-5
lines changed
  • crates/bevy_ecs/src/schedule

1 file changed

+9
-5
lines changed

crates/bevy_ecs/src/schedule/set.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ pub trait SystemSet: DynHash + Debug + Send + Sync + 'static {
3737
fn dyn_clone(&self) -> Box<dyn SystemSet>;
3838
}
3939

40-
/// A system set that is never contained in another set.
41-
/// Systems and other system sets may only belong to one base set.
40+
/// A marker trait for `SystemSet` types where [`is_base`] returns `true`.
41+
/// This should only be implemented for types that satisfy this requirement.
42+
/// It is automatically implemented for base set types by `#[derive(SystemSet)]`.
4243
///
43-
/// This should only be implemented for types that return `true` from [`SystemSet::is_base`].
44+
/// [`is_base`]: SystemSet::is_base
4445
pub trait BaseSystemSet: SystemSet {}
4546

46-
/// System sets that are *not* base sets. This should not be implemented for
47-
/// any types that implement [`BaseSystemSet`].
47+
/// A marker trait for `SystemSet` types where [`is_base`] returns `false`.
48+
/// This should only be implemented for types that satisfy this requirement.
49+
/// It is automatically implemented for non-base set types by `#[derive(SystemSet)]`.
50+
///
51+
/// [`is_base`]: SystemSet::is_base
4852
pub trait FreeSystemSet: SystemSet {}
4953

5054
impl PartialEq for dyn SystemSet {

0 commit comments

Comments
 (0)