Skip to content

#![allow(elided_lifetimes_in_paths)] doesn't work in submodules #74463

Closed
@alexcrichton

Description

@alexcrichton

Given code such as:

#![crate_type = "rlib"]
#![cfg_attr(crate_level, allow(elided_lifetimes_in_paths))]
#![cfg_attr(crate_level_warnings, allow(warnings))]

mod foo {
    #![allow(elided_lifetimes_in_paths)]
    #![allow(warnings)]

    use std::fmt::*;

    struct A;

    impl Debug for A {
        fn fmt(&self, _f: &mut Formatter) -> Result {
            Ok(())
        }
    }
}

When compiled this generates a warning:

$ rustc +nightly foo.rs -W elided_lifetimes_in_paths 
warning: hidden lifetime parameters in types are deprecated
...

I'm not entirely sure why the directives inside mod foo aren't taking effect. The crate-level ones do take effect, as can be seen with:

$ rustc +nightly foo.rs -W elided_lifetimes_in_paths --cfg crate_level
$ rustc +nightly foo.rs -W elided_lifetimes_in_paths --cfg crate_level_warnings

(no warnings)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2018Area: The 2018 editionA-lifetimesArea: Lifetimes / regionsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions