Skip to content

unnecessary path disambiguator slips past deny(warnings) #58055

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
tspiteri opened this issue Feb 1, 2019 · 2 comments
Closed

unnecessary path disambiguator slips past deny(warnings) #58055

tspiteri opened this issue Feb 1, 2019 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@tspiteri
Copy link
Contributor

tspiteri commented Feb 1, 2019

#[deny(warnings)]
pub fn foo() {
    type _V = Vec::<u32>;
}

Although there is a deny(warnings) attribute, this code compiles with a warning only.

   Compiling warn v0.1.0 (/tmp/warn)
warning: unnecessary path disambiguator
 --> src/lib.rs:3:18
  |
3 |     type _V = Vec::<u32>;
  |                  ^^ try removing `::`

    Finished dev [unoptimized + debuginfo] target(s) in 0.23s

This behavior is present in all versions I tested including the latest nightly 2019-01-31 and 1.21.0 when relaxed path syntax was introduced.

@zackmdavis zackmdavis added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 1, 2019
@zackmdavis
Copy link
Member

This happens because the warning is issued unconditionally, rather than under the purview of a lint:

self.diagnostic().struct_span_warn(self.prev_span, "unnecessary path disambiguator")
.span_label(self.prev_span, "try removing `::`").emit();

Reservations were expressed at the time. (@estebank do we have a policy anywhere on unsilenceable warnings? It seems kind of bad for it to be a thing the compiler mostly doesn't do, except sometimes very rarely when it didn't feel "worthy" of a top-level lint.)

@petrochenkov
Copy link
Contributor

All hard-coded warnings should generally be subsumed by lints or eliminated.
For this specific warning #57565 does the job.

Centril added a commit to Centril/rust that referenced this issue Mar 27, 2019
syntax: Remove warning for unnecessary path disambiguators

`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in rust-lang#43540 (where it was introduced).
One hardcoded warning less.

Closes rust-lang#58055

r? @nikomatsakis
Centril added a commit to Centril/rust that referenced this issue Mar 27, 2019
syntax: Remove warning for unnecessary path disambiguators

`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in rust-lang#43540 (where it was introduced).
One hardcoded warning less.

Closes rust-lang#58055

r? @nikomatsakis
Centril added a commit to Centril/rust that referenced this issue Mar 27, 2019
syntax: Remove warning for unnecessary path disambiguators

`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in rust-lang#43540 (where it was introduced).
One hardcoded warning less.

Closes rust-lang#58055

r? @nikomatsakis
cuviper added a commit to cuviper/rust that referenced this issue Mar 28, 2019
syntax: Remove warning for unnecessary path disambiguators

`rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in rust-lang#43540 (where it was introduced).
One hardcoded warning less.

Closes rust-lang#58055

r? @nikomatsakis
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants