Skip to content
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

[Merged by Bors] - Fix compile_fail tests #2984

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions crates/bevy_ecs/src/system/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ mod tests {

/// ```compile_fail
MinerSebas marked this conversation as resolved.
Show resolved Hide resolved
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn system(mut query: Query<&mut A>, e: Res<Entity>) {
/// let mut iter = query.iter_mut();
Expand All @@ -802,11 +803,12 @@ mod tests {
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_iter_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn system(mut query: Query<&mut A>, e: Res<Entity>) {
/// let mut a1 = query.get_mut(*e).unwrap();
Expand All @@ -816,11 +818,12 @@ fn system_query_iter_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_get_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn query_set(mut queries: QuerySet<(QueryState<&mut A>, QueryState<&A>)>, e: Res<Entity>) {
/// let mut q2 = queries.q0();
Expand All @@ -836,11 +839,12 @@ fn system_query_get_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_set_iter_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn query_set(mut queries: QuerySet<(QueryState<&mut A>, QueryState<&A>)>, e: Res<Entity>) {
/// let q1 = queries.q1();
Expand All @@ -856,11 +860,12 @@ fn system_query_set_iter_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_set_iter_flip_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn query_set(mut queries: QuerySet<(QueryState<&mut A>, QueryState<&A>)>, e: Res<Entity>) {
/// let mut q2 = queries.q0();
Expand All @@ -874,11 +879,12 @@ fn system_query_set_iter_flip_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_set_get_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// #[derive(Component)]
/// struct A(usize);
/// fn query_set(mut queries: QuerySet<(QueryState<&mut A>, QueryState<&A>)>, e: Res<Entity>) {
/// let q1 = queries.q1();
Expand All @@ -891,13 +897,15 @@ fn system_query_set_get_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_query_set_get_flip_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// use bevy_ecs::system::SystemState;
/// #[derive(Component)]
/// struct A(usize);
/// #[derive(Component)]
/// struct B(usize);
/// struct State {
/// state_r: SystemState<Query<'static, 'static, &'static A>>,
Expand All @@ -918,13 +926,15 @@ fn system_query_set_get_flip_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_state_get_lifetime_safety_test() {}

/// ```compile_fail
/// use bevy_ecs::prelude::*;
/// use bevy_ecs::system::SystemState;
/// #[derive(Component)]
/// struct A(usize);
/// #[derive(Component)]
/// struct B(usize);
/// struct State {
/// state_r: SystemState<Query<'static, 'static, &'static A>>,
Expand All @@ -943,5 +953,5 @@ fn system_state_get_lifetime_safety_test() {}
/// }
/// ```
#[allow(unused)]
#[cfg(doc)]
#[cfg(doctest)]
fn system_state_iter_lifetime_safety_test() {}