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

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

Closed
alexcrichton opened this issue Jul 17, 2020 · 3 comments
Closed

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

alexcrichton opened this issue Jul 17, 2020 · 3 comments
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug.

Comments

@alexcrichton
Copy link
Member

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)

@jonas-schievink jonas-schievink added A-edition-2018-lints Area: Lints supporting the 2018 edition A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug. labels Jul 17, 2020
@ehuss
Copy link
Contributor

ehuss commented Jul 17, 2020

I think this is a duplicate of #71957.

@ehuss
Copy link
Contributor

ehuss commented Jul 17, 2020

Also, a warning for this was recently added in #73300, but I think it is circumvented in your example by #![allow(warnings)].

@alexcrichton
Copy link
Member Author

Ah yep that looks like the same issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2018-lints Area: Lints supporting the 2018 edition A-lifetimes Area: Lifetimes / regions C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants