Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upICE `OutputTypeParameterMismatch` #29997
Comments
huonw
added
the
I-ICE
label
Nov 23, 2015
arielb1
added
the
T-compiler
label
Nov 23, 2015
This comment has been minimized.
This comment has been minimized.
|
Minified: trait Mirror { type Image; }
impl<T> Mirror for T { type Image = T; }
fn test<L,T>(l: L) where L: FnOnce(Option<<&T as Mirror>::Image>),
for<'a> &'a T: Mirror
{ l(None); }
fn main() {
test::<_,u8>(|_| {});
}@nikomatsakis @eddyb : why is |
This comment has been minimized.
This comment has been minimized.
|
ok, finally getting to some of my older notifications, sorry. An interesting question. Digging through the codebase, I see that there is only one call -- Let me look into your minified example a bit. |
This comment has been minimized.
This comment has been minimized.
|
I guess we should just erase regions in that case too. |
This comment has been minimized.
This comment has been minimized.
|
The The root cause of the problem here is that typeck/trans assume that if |
This comment has been minimized.
This comment has been minimized.
|
I've hit this I think. Other issues with visually similar error messages which I assume are related: #33364 (comment), #39779. |
Mark-Simulacrum
referenced this issue
May 22, 2017
Closed
ICE: OutputTypeParameterMismatch using HRTB + associated types #39779
This comment has been minimized.
This comment has been minimized.
|
Reposting #39779 here for future reference: This seems to cause rustc to crash (link shows a slightly more complicated example than the reduced example below): trait Fun<'a> { type Output; }
impl<'a> Fun<'a> for () { type Output = &'a str; }
fn with<F, G>(x: <F as Fun<'static>>::Output, g: G)
where F: for<'a> Fun<'a>,
G: for<'a> FnOnce(<F as Fun<'a>>::Output) {
g(x)
}
fn main() {
with::<(), _>("", |_| ());
}It looks like it forgot to normalize
Crash log for 1.15.0-stable (10893a9 2017-01-19)
Crash log for 1.17.0-nightly (c49d102 2017-02-07)
|
Mark-Simulacrum
added
the
C-bug
label
Jul 22, 2017
This comment has been minimized.
This comment has been minimized.
|
While working on a StreamingIterator trait, I got a similar ICE about an OutputTypeParameterMismatch. pub trait StreamingIterator<'a> {
type Item: 'a;
fn next(&'a mut self) -> Option<Self::Item>;
}
pub trait StreamingIteratorExt: for<'a> StreamingIterator<'a> {
fn for_each<F>(mut self, mut func: F) where
Self: Sized,
F: for<'a> FnMut(<Self as StreamingIterator<'a>>::Item)
{
while let Some(item) = self.next() {
func(item)
}
}
}
impl<I> StreamingIteratorExt for I where
I: for<'a>StreamingIterator<'a>
{}
impl<'a, I: Iterator + 'a> StreamingIterator<'a> for I {
type Item = I::Item;
fn next(&'a mut self) -> Option<Self::Item> {
self.next()
}
}
#[test]
fn test_basic_stuff() {
let it = vec![1i32,2,3].into_iter();
StreamingIteratorExt::for_each(it, |x| println!("{}", x));
}
And here's the error on Rust 1.21.0 stable
Backtrace on Rust 1.21.0 stable
Note that |
This comment has been minimized.
This comment has been minimized.
|
Another minimal example (#53420): trait Lt<'a> {
type T;
}
impl<'a> Lt<'a> for () {
type T = ();
}
fn main() {
let _:fn(<() as Lt<'_>>::T) = |()| {};
} |
pnkfelix
referenced this issue
Oct 4, 2018
Closed
ICE: librustc/traits/codegen/mod.rs:68: Encountered error `OutputTypeParameterMismatch` #53420
arielb1
added
the
P-medium
label
Oct 4, 2018
earthengine
referenced this issue
Oct 8, 2018
Open
ICE when using anonymization in impl Trait with HRTB #54895
This comment has been minimized.
This comment has been minimized.
|
Is #33364 a duplicate of this? |
frankmcsherry commentedNov 23, 2015
The error is very long, and the example is not reduced (I tried, but the simple reduction worked ok, so no dice there). To reproduce, one can pull
TimelyDataflow/differential-dataflow@2fa719e
and then
cargo build --example cc. I'm onThe same project ICEs on stable as well, but for a different reason (issue #29991; EDIT: Sorry, not actually this issue; rather, a different ICE that seems fixed in nightly).
I think the salient points are in the complaint
where it seems to be unhappy that it found a weird associated type rather than a
DifferenceIterator<u32>. Of course, the associated type is thatDifferenceIterator<u32>, which Rust knew at one point but seems to have lost track of, maybe? There is admittedly a bunch of horribleness going on with associated types, specifically faking out HKT for lifetimes through associated types of traits containing a lifetime implemented for references with that lifetime to the type in question. I can explain what it is doing if that helps, but given that it just ICEs differently in each release mode, maybe it's just time to delete it and try another way.Full backtrace: