Skip to content

Elided lifetime changes in rust_2018_idioms lint is very noisy and results in dramatically degraded APIs for Bevy #131725

Open
@alice-i-cecile

Description

@alice-i-cecile

Problem

With the upcoming release of Rust 2024 edition, we're concerned that rust_2018_idioms will be deny by default.

[Editorial comment (TC): This is not an edition item for Rust 2024, and the edition is not accepting any new items, so we can say definitely that this will not be tied to the release of Rust 2024. See here.]

We investigated what these changes will entail for Bevy in bevyengine/bevy#15916, and the impact is quite severe. Our primary user-facing system and query APIs are littered with meaningless lifetimes.

This is a much worse experience with no upside for us, and Bevy and its entire ecosystem will have to manually allow this lint on every project.

Proposed solution

We would appreciate if the elided lifetimes lint could be split out from the rest of the rust_2018_idioms linting, which we generally liked the effect of.

Ideally this would be off by default as well, to avoid needing to teach new users to turn it off as a critical part of project setup.

Activity

added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 15, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
and removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 15, 2024
alice-i-cecile

alice-i-cecile commented on Oct 15, 2024

@alice-i-cecile
Author

Here's an example of some in-production code after this lint was applied:

pub fn update_text2d_layout(
    // Text items which should be reprocessed again, generally when the font hasn't loaded yet.
    mut queue: Local<'_, HashSet<Entity>>,
    mut textures: ResMut<'_, Assets<Image>>,
    fonts: Res<'_, Assets<Font>>,
    windows: Query<'_, '_, &Window, With<PrimaryWindow>>,
    mut scale_factor_changed: EventReader<'_, '_, WindowScaleFactorChanged>,
    mut texture_atlases: ResMut<'_, Assets<TextureAtlasLayout>>,
    mut font_atlas_sets: ResMut<'_, FontAtlasSets>,
    mut text_pipeline: ResMut<'_, TextPipeline>,
    mut text_query: Query<'_, '_, (
        Entity,
        Ref<'_, TextLayout>,
        Ref<'_, TextBounds>,
        &mut TextLayoutInfo,
        &mut ComputedTextBlock,
    )>,
    mut text_reader: Text2dReader<'_, '_>,
    mut font_system: ResMut<'_, CosmicFontSystem>,
    mut swash_cache: ResMut<'_, SwashCache>,
) {
jieyouxu

jieyouxu commented on Oct 15, 2024

@jieyouxu
Member

Since this seems to have potential non-minimal ecosystem impact, nominating for T-lang discussion.
@rustbot label +I-lang-nominated

added
C-discussionCategory: Discussion or questions that doesn't represent real issues.
and removed
I-lang-nominatedNominated for discussion during a lang team meeting.
on Oct 15, 2024
alice-i-cecile

alice-i-cecile commented on Oct 15, 2024

@alice-i-cecile
Author

Turning this on by default is tracked in #54910 and #91639.

removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Oct 15, 2024

27 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2018Area: The 2018 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-discussionCategory: Discussion or questions that doesn't represent real issues.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.L-elided_lifetimes_in_pathsLint: elided_lifetimes_in_pathsT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @epage@djc@shepmaster@koute@RalfJung

        Issue actions

          Elided lifetime changes in `rust_2018_idioms` lint is very noisy and results in dramatically degraded APIs for Bevy · Issue #131725 · rust-lang/rust