Work around warning from late_bound_lifetime_arguments lint#260
Work around warning from late_bound_lifetime_arguments lint#260bors-servo merged 1 commit intoservo:masterfrom lqd:warning_begone
late_bound_lifetime_arguments lint#260Conversation
|
(added a scope to make it build on 1.31, this is not required for the current stable) |
|
Is there any good reason to do this other than building warning-free? I don't think we should adapt your code for this necessarily, unless there's a very good reason to do this. Doubly so if this makes the code uglier tbf... |
|
Yes building without the warning was the reason for the change, as it's not clear when this is going to become an error. |
|
As long as this is working around a rust bug I don't think they can reasonably turn it into an error... |
|
Ah but this PR is not working around a rustc bug, it is "fixing" rust-cssparser's workaround for the rustc bug and which generates a compatiblity lint warning. (the code is not that ugly on current stable. I haven't tested older stables so I don't know which one fixed the scope requirement, I only added it because CI fails on 1.31. These, and the existing ones, eg in parser.rs IIRC, could be removed on newer versions) |
|
The code comment is useful, but perhaps the whole explanation does not need to be repeated every time. Maybe move it to a github comment in #254, and have the code link there? With that change I feel the ugliness would not be too bad. I think warning-freedom is valuable, although in this case we aren’t actively doing a lot of work on this crate so warnings haven’t been much of a bother. |
|
@bors-servo r+ |
|
📌 Commit d5006f6 has been approved by |
Work around warning from `late_bound_lifetime_arguments` lint The generic parsing functions require lifetime annotations to build because of rust-lang/rust#42508. However, this creates a warning from the `late_bound_lifetime_arguments` compatibility lint, described in rust-lang/rust#42868, because they have both early-bound and late-bound lifetime parameters. This PR works around this warning, in a functional but sub-optimal way. The result is quite verbose, and I didn't manage to "convince" rustc to think all lifetimes were early-bound at the `fn` definitions, but manages to avoid triggering both rust-lang/rust#42508 and the lint, by passing these closures via variables at each call-site. Fixes #254
|
☀️ Test successful - checks-travis |
The generic parsing functions require lifetime annotations to build because of rust-lang/rust#42508.
However, this creates a warning from the
late_bound_lifetime_argumentscompatibility lint, described in rust-lang/rust#42868, because they have both early-bound and late-bound lifetime parameters.This PR works around this warning, in a functional but sub-optimal way. The result is quite verbose, and I didn't manage to "convince" rustc to think all lifetimes were early-bound at the
fndefinitions, but manages to avoid triggering both rust-lang/rust#42508 and the lint, by passing these closures via variables at each call-site.Fixes #254