Skip to content

elided_lifetime_in_path triggers for the format! macro #48385

Description

@nikomatsakis

I was trying to use deny(elided_lifetime_in_path) and encountered the problem that this doesn't work:

#![feature(nll)]
#![deny(elided_lifetime_in_path)]

fn main() {
    format!("foo {}", 22)
}

I get

error: hidden lifetime parameters are deprecated, try `Foo<'_>`
 --> src/main.rs:5:5
  |
5 |     format!("foo {}", 22)
  |     ^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/main.rs:2:9
  |
2 | #![deny(elided_lifetime_in_path)]
  |         ^^^^^^^^^^^^^^^^^^^^^^^
  = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

I suppose the easiest fix is to fix the format! expansion, but maybe better to suppress this warning for macros outside of the current crate? Feels like a more general problem.

Activity

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-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions