-
Notifications
You must be signed in to change notification settings - Fork 387
Description
Building the demo with -W elided-lifetimes-in-paths
results in the following:
warning: hidden lifetime parameters in types are deprecated
--> demo/src/main.rs:22:63
|
22 | fn new_blobstore_client() -> UniquePtr<BlobstoreClient>;
| ^- help: indicate the anonymous lifetime: `<'_>`
|
= note: requested on the command line with `-W elided-lifetimes-in-paths`
warning: 1 warning emitted
However, neither cxx::UniquePtr
nor BlobstoreClient
have a lifetime parameter, so of course trying to add one is an error (and of course the lint still triggers too):
warning: hidden lifetime parameters in types are deprecated
--> demo/src/main.rs:22:66
|
22 | fn new_blobstore_client() -> UniquePtr<BlobstoreClient<'_>>;
| ^^- help: indicate the anonymous lifetime: `<'_>`
|
= note: requested on the command line with `-W elided-lifetimes-in-paths`
error[E0106]: missing lifetime specifier
--> demo/src/main.rs:22:64
|
22 | fn new_blobstore_client() -> UniquePtr<BlobstoreClient<'_>>;
| ^^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime
|
22 | fn new_blobstore_client() -> UniquePtr<BlobstoreClient<'static>>;
| ^^^^^^^
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> demo/src/main.rs:22:48
|
22 | fn new_blobstore_client() -> UniquePtr<BlobstoreClient<'_>>;
| ^^^^^^^^^^^^^^^---- help: remove these generics
| |
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> demo/src/main.rs:20:14
|
20 | type BlobstoreClient;
| ^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted
Looking at the expanded output with cargo expand
, I don't see any clues as to what missing anonymous lifetime the compiler might be intending to flag here. It's unclear to me if this is a lint bug, if the compiler diagnostic is just confusing due to the cxx::bridge
proc macro, or something else.
This is an issue for us because our codebase uses both -W rust_2018_idioms
and -D warnings
by default. Worse, elided-lifetimes-in-paths
can only be allowed at the crate level (rust-lang/rust#71957) so we can't just allow it for the cxx::bridge
module.