Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upICE with GATs #50115
Comments
This comment has been minimized.
This comment has been minimized.
|
Similar situation with this, what's the right way to instantiate the GAT (with types this time)? pub trait ToOther {
type Other<P: AsPitch, V: AsVal, B: AsPitchBend>;
fn to_other<Pitch: AsPitch, Val: AsVal, Pb: AsPitchBend>(&self) -> Self::Other/*<Pitch, Val, Pb>*/;
}
impl<Pitch: AsPitch, Val: AsVal, Pb: AsPitchBend> ToOther for HighLvlMsg<Pitch, Val, Pb> {
type Other<P, V, B> = HighLvlMsg<P, V, B>;
fn to_other<Pitch2: AsPitch, Val2: AsVal, Pb2: AsPitchBend>(&self) -> Self::Other/*<Pitch2, Val2, Pb2>*/ {
use HighLvlMsg::*;
match *self {
NoteOn { pitch, vel, len } => NoteOn { pitch: AsPitch::conv(pitch), vel, len },
NoteOff { pitch, vel } => NoteOff { pitch: AsPitch::conv(pitch), vel },
ControlChange { cc, val } => ControlChange { cc, val: AsVal::conv(val) },
ProgramChange { prog } => ProgramChange { prog },
PitchBend { semitones } => PitchBend { semitones: AsPitchBend::conv(semitones) },
PolyphonicAftertouch { pitch, val } => PolyphonicAftertouch { pitch: AsPitch::conv(pitch), val: AsVal::conv(val) },
ChannelAftertouch { val } => ChannelAftertouch { val: AsVal::conv(val) },
}
}
}
|
pietroalbini
added
I-ICE
T-compiler
C-bug
labels
Apr 20, 2018
This comment has been minimized.
This comment has been minimized.
|
Thanks for reporting this! Can you provide a small example to reproduce the ICE? With the custom types you used it's difficult for us to bisect/reproduce ourself :) |
This comment has been minimized.
This comment has been minimized.
#![feature(generic_associated_types)]
#![feature(associated_type_defaults)]
struct Foo;
struct Bar;
struct Baz;
struct A<'a> {
foo: &'a Foo,
}
struct B<'a> {
inherited: A<'a>,
own: Bar,
}
trait Trait: Clone + Default {
type Ctx<'a> = A<'a>;
fn process<'a>(&mut self, ctx: &Self::Ctx/*<'a>*/);
}
impl Trait for Baz {
type Ctx<'a> = B<'a>;
fn process<'a>(&mut self, ctx: &Self::Ctx/*<'a>*/) {}
}
fn main() {}https://play.rust-lang.org/?gist=5fc07e14a633f3ec4db4de1c421053ff&version=nightly |
This comment has been minimized.
This comment has been minimized.
|
This seems to be a known issue. GAT (#44265) is a WIP feature and probably not supposed to be usable yet. |
This comment has been minimized.
This comment has been minimized.
|
Closing as a duplicate of #49362. |
dtolnay
closed this
Jun 16, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Boscop commentedApr 20, 2018
•
edited
What is the right way to do this?
It's underlinining
&Self::Ctx<'a>but how else am I supposed to instantiate the GAT with a lifetime?Now I tried to omit the
<'a>:But I get this (ICE):
What is the correct way to instantiate the GAT with a lifetime here?