-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE infering higher-ranked lifetime with a builder pattern #80409
Comments
use std::marker::PhantomData;
struct FsmBuilder<TFsm> {
_fsm: PhantomData<TFsm>,
}
impl<TFsm> FsmBuilder<TFsm> {
fn state(&mut self) -> FsmStateBuilder<TFsm> {
todo!()
}
}
struct FsmStateBuilder<TFsm> {
_state: PhantomData<TFsm>,
}
impl<TFsm> FsmStateBuilder<TFsm> {
fn on_entry<TAction: Fn(&mut StateContext<'_, TFsm>)>(&self, _action: TAction) {}
}
trait Fsm {
type Context;
}
struct StateContext<'a, TFsm: Fsm> {
context: &'a mut TFsm::Context
}
fn main() {
let mut builder: FsmBuilder<usize> = todo!();
builder.state().on_entry(|_| {});
} |
Note the error goes away if you add |
Issue: rust-lang/rust#80409
Triage: no change |
No longe crashes with master toolchain |
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
…errors Add regression test for rust-lang#80409 r? `@compiler-errors` Closes rust-lang#80409
Rollup of 7 pull requests Successful merges: - rust-lang#109909 (Deny `use`ing tool paths) - rust-lang#109921 (Don't ICE when encountering `dyn*` in statics or consts) - rust-lang#109922 (Disable `has_thread_local` on OpenHarmony) - rust-lang#109926 (write threads info into log only when debugging) - rust-lang#109968 (Add regression test for rust-lang#80409) - rust-lang#109969 (Add regression test for rust-lang#86351) - rust-lang#109973 (rustdoc: Improve logo display very small screen) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Crashing again after #118553 |
This is also a compiles -> ice regression |
This never should have passed. Removing regression label; this can remain open to track the ICE. |
no longer produces an ICE as of rust 1.81.0 |
I haven't been able to minimize this yet. The similar, already resolved, bug report #56199 doesn't seem to help - changing the
on_entry
's return signature fromSelf
to the full definition doesn't help here.Code
Meta
The bug is also present in the nightly build (
bb1fbbf84 2020-12-22
).Error output
Backtrace
The text was updated successfully, but these errors were encountered: