I am using rsasl = { version = "2.0.0", default-features = false, features = ["config_builder", "provider", "login", "plain", "scram-sha-1", "scram-sha-2"]} in my project. I was using a stable version of rust and everything was compiling correctly. I switched to nightly version, which right now is 1.82.0 and now rsasl will not compile. Here is a dump of the compile error:
Compiling rsasl v2.0.1
error: lifetime may not live long enough
--> /Users/hgking/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsasl-2.0.1/src/callback.rs:302:24
|
292 | impl<'a> Request<'a> {
| -- lifetime `'a` defined here
...
299 | pub(crate) fn new_action<'t, 'p, P: Property<'p>>(
| -- lifetime `'p` defined here
...
302 | unsafe { &mut *(val as &mut dyn Erased as *mut dyn Erased as *mut Self) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'p`
|
= help: consider adding the following bound: `'a: 'p`
= note: requirement occurs because of a mutable pointer to `callback::Request<'_>`
= note: mutable pointers are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
error: lifetime may not live long enough
--> /Users/hgking/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsasl-2.0.1/src/callback.rs:302:24
|
292 | impl<'a> Request<'a> {
| -- lifetime `'a` defined here
...
299 | pub(crate) fn new_action<'t, 'p, P: Property<'p>>(
| -- lifetime `'p` defined here
...
302 | unsafe { &mut *(val as &mut dyn Erased as *mut dyn Erased as *mut Self) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'p` must outlive `'a`
|
= help: consider adding the following bound: `'p: 'a`
= note: requirement occurs because of a mutable pointer to `callback::Request<'_>`
= note: mutable pointers are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
help: `'a` and `'p` must be the same: replace one with the other
error: lifetime may not live long enough
--> /Users/hgking/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsasl-2.0.1/src/validate.rs:134:24
|
133 | pub(crate) fn new<'opt, V: Validation>(opt: &'opt mut Tagged<'_, V>) -> &'opt mut Self {
| --- -------------- return type is &mut Validate<'1>
| |
| has type `&mut Tagged<'2, V>`
134 | unsafe { &mut *(opt as &mut dyn Erased as *mut dyn Erased as *mut Self) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'2`
|
= note: requirement occurs because of a mutable pointer to `Validate<'_>`
= note: mutable pointers are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
error: lifetime may not live long enough
--> /Users/hgking/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsasl-2.0.1/src/validate.rs:134:24
|
133 | pub(crate) fn new<'opt, V: Validation>(opt: &'opt mut Tagged<'_, V>) -> &'opt mut Self {
| --- -------------- return type is &mut Validate<'1>
| |
| has type `&mut Tagged<'2, V>`
134 | unsafe { &mut *(opt as &mut dyn Erased as *mut dyn Erased as *mut Self) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'2` must outlive `'1`
|
= note: requirement occurs because of a mutable pointer to `Validate<'_>`
= note: mutable pointers are invariant over their type parameter
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
Compiling tokio-stream v0.1.15
error[E0621]: explicit lifetime required in the type of `provider`
--> /Users/hgking/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rsasl-2.0.1/src/context.rs:120:14
|
119 | pub fn build_context<'a>(provider: &'a dyn Provider) -> &'a Context<'a> {
| ---------------- help: add explicit lifetime `'a` to the type of `provider`: `&'a (dyn Provider<'a> + 'a)`
120 | unsafe { &*(provider as *const dyn Provider as *const Context) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
For more information about this error, try `rustc --explain E0621`.
error: could not compile `rsasl` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
From my tests this was fixed by #40; I've published rsasl v2.0.2 that contains said PR. If this doesn't fix the problem for you please re-open this issue :)
I am using
rsasl = { version = "2.0.0", default-features = false, features = ["config_builder", "provider", "login", "plain", "scram-sha-1", "scram-sha-2"]}
in my project. I was using a stable version of rust and everything was compiling correctly. I switched to nightly version, which right now is1.82.0
and now rsasl will not compile. Here is a dump of the compile error: