-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Broken help message for missing lifetime when using <_ as Trait> syntax in type alias #92324
Comments
Also consider the following code, which creates an error message that could be more precise. I wouldn't call the following example a bug, but maybe these two issues are related: #![feature(generic_associated_types)]
use std::marker::PhantomData;
trait Machine<'a> {
type Datum<'b>
where
Self: 'b;
}
#[derive(Default)]
struct LuaMachine<'a> {
_phantom: PhantomData<fn(&'a ()) -> &'a ()>,
}
struct LuaDatum<'a, 'b> {
_machine: &'b LuaMachine<'a>,
}
impl<'a> Machine<'a> for LuaMachine<'a> {
type Datum<'b>
where
Self: 'b,
= LuaDatum<'a, 'b>;
}
type M<'a> = LuaMachine<'a>;
// This won't work:
type D<'a, 'b> = <M<'a> as Machine>::Datum<'b>;
fn main() {
let _m: M = Default::default();
// But this works:
let _d: <M as Machine>::Datum<'_> = LuaDatum { _machine: &_m };
} Error output:
|
@rustbot claim |
@rustbot label +regression-from-stable-to-nightly +A-diagnostics |
Error: Label P-low can only be set by Rust team members Please let |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-medium |
I tried this code:
(Playground)
I expected to see this happen (which works correctly with rustc 1.57.0 stable):
But with
rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
, I get:Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: