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: failed to get layout #43132
Comments
This comment has been minimized.
This comment has been minimized.
|
Minimized a bit (52 lines): (expand)extern crate futures;
extern crate futures_mpsc;
extern crate tk_http;
extern crate tk_listen;
extern crate tokio_core;
use std::sync::Arc;
use futures::{Future, Sink, Stream};
use futures::future::FutureResult;
use futures::stream::empty as empty_stream;
use tokio_core::reactor::Core;
use tk_http::server::buffered::{Request, BufferedDispatcher};
use tk_http::server::{Encoder, EncoderDone, Config, Proto, Error};
use tk_listen::ListenExt;
use tokio_core::net::TcpStream;
use std::net::SocketAddr;
fn http<S>(_: Request, _: Encoder<S>)
-> FutureResult<EncoderDone<S>, Error>
{
unimplemented!()
}
fn main() {
let h = Core::new().unwrap().handle();
let (sender, receiver) = futures_mpsc::channel::<()>(1);
let sender = Arc::new(sender);
let _ = empty_stream::<(TcpStream, SocketAddr), ()>()
.map(|(socket, addr)| {
let sender = sender.clone();
Proto::new(socket, &Config::new().done(),
BufferedDispatcher::new_with_websockets(addr, &h,
http,
move |_, _| {
let sender = (*sender).clone();
futures::future::ok(()).and_then(move |_| {
empty_stream::<(), String>().fold(sender, |sender, _| {
sender.send(()).map_err(|_| "")
})
})
.then(|_| Ok(()))
}),
&h)
.then(|_| Ok(()))
})
.listen(1000)
.join(receiver.for_each(|_| Ok(())));
} |
This comment has been minimized.
This comment has been minimized.
|
This showed up in the |
This comment has been minimized.
This comment has been minimized.
|
A smaller version of what I believe is the same ICE: extern crate futures;
use futures::{Future, Stream, Sink};
use futures::stream::iter;
fn foo<T>() -> T {
loop {}
}
fn main() {
iter(foo::<std::iter::Cloned<std::slice::Iter<i32>>>().map(Ok))
.forward(
foo::<Box<Sink<SinkItem = i32, SinkError = ()>>>()
)
.join(
foo::<Box<Stream<Item = i32, Error = ()>>>()
.for_each(|_| Ok(()))
);
} |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton yeah now that I look at it is that on stable OP's example has a different ICE error than on nightly, very alike to #40274, while the one on nightly matches your example. |
alexcrichton
added
the
I-ICE
label
Jul 10, 2017
This comment has been minimized.
This comment has been minimized.
|
Bisected the nightly ICE using bisect-rust to #42840 (9b85e1c) -- cc @arielb1 @nikomatsakis |
arielb1
self-assigned this
Jul 12, 2017
This comment has been minimized.
This comment has been minimized.
|
Looks like the projection cache is dropping normalization obligations on the floor at https://github.com/rust-lang/rust/blob/master/src/librustc/traits/project.rs#L1392: fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>( //
// ...
let result = // ...
Normalized {
value: normalized_ty,
obligations,
} // ...
infcx.projection_cache.borrow_mut()
.complete(projection_ty, &result, cacheable);
Some(result)
// ...
fn complete(&mut self,
key: ty::ProjectionTy<'tcx>,
value: &NormalizedTy<'tcx>,
cacheable: bool) {
let fresh_key = if cacheable {
debug!("ProjectionCacheEntry::complete: adding cache entry: key={:?}, value={:?}",
key, value);
// <-- WHERE DID value.obligations JUST DISAPPEAR TO?
self.map.insert(key, ProjectionCacheEntry::NormalizedTy(value.value))
} else {
debug!("ProjectionCacheEntry::complete: cannot cache: key={:?}, value={:?}",
key, value);
!self.map.remove(key)
};
assert!(!fresh_key, "never started projecting `{:?}`", key);
}This causes problems with my new evaluation code because it causes an earlier call into evaluation, which allows the cache pollution to proceed (I think). |
This comment has been minimized.
This comment has been minimized.
|
Actually, the problem is that the projection cache is incompatible with 1-pass evaluation. Not sure how to solve this. |
Mark-Simulacrum
added
the
C-bug
label
Jul 22, 2017
alexcrichton
added
regression-from-stable-to-beta
and removed
regression-from-stable-to-nightly
labels
Jul 23, 2017
This comment has been minimized.
This comment has been minimized.
|
@arielb1 do you have further thoughts on this? The regression is now on beta :( |
This comment has been minimized.
This comment has been minimized.
|
cc @eddyb |
This comment has been minimized.
This comment has been minimized.
|
I don't have any specific knowledge of how the caches involved here interact. It seems like layout code triggers this but the problem could arise in a number of other ways. |
This comment has been minimized.
This comment has been minimized.
|
I have to talk to @nikomatsakis about this. |
This comment has been minimized.
This comment has been minimized.
|
I can look into this, but not until Saturday. |
This comment has been minimized.
This comment has been minimized.
|
triage: P-high |
rust-highfive
added
P-high
and removed
I-nominated
labels
Jul 27, 2017
nikomatsakis
self-assigned this
Jul 27, 2017
This comment has been minimized.
This comment has been minimized.
|
So I have a fix pending in this branch but I'm not sure what to use for a regression test, since I don't want to add a dependency on futures. |
nikomatsakis
referenced this issue
Jul 29, 2017
Merged
save subobligations in the projection cache #43546
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis here's a "reasonably sized" test case which reproduces the error here. |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis I've minimized @alexcrichton 's example to roughly the half here. |
bors
added a commit
that referenced
this issue
Jul 31, 2017
bors
closed this
in
#43546
Jul 31, 2017
This comment has been minimized.
This comment has been minimized.
|
The nightly is out and I no longer run into that ICE! On the other hand compiling this simple program now takes 8 minutes. The previous commit (before I introduced the ICE) is up from 6s to 1m51s. |
This comment has been minimized.
This comment has been minimized.
|
@remram44 I suggest you file a separate bug report for this. |
This comment has been minimized.
This comment has been minimized.
|
@remram44 hm I can't seem to get the commit linked above to compile? What compiler are you using to compile it "pre ICE"? |
This comment has been minimized.
This comment has been minimized.
|
I'm compiling using stable and the nightly from the 28th from rustup... not sure why this would fail for you? |
Marwes
referenced this issue
Aug 2, 2017
Closed
rustc runs out of memory when compiling trait heavy code #43613
This comment has been minimized.
This comment has been minimized.
|
@remram44 sorry I still can't get the code to compile. Can you list the exact commands you're using, along with the exact toolchain in rustup-style syntax? |
This comment has been minimized.
This comment has been minimized.
|
The toolchains I tried are Whatever your environment you can reproduce this from scratch in Docker with:
|
This comment has been minimized.
This comment has been minimized.
|
Ok thanks for the repro @remram44! Want to open a new issue with that so we can be sure to track it? |
This comment has been minimized.
This comment has been minimized.
|
Will do! [edit: #43787] |
remram44 commentedJul 9, 2017
•
edited
Code: https://gitlab.com/remram44/rs-web/blob/bf5066037ffb627c98b4988ff7d46b054ce33e40/src/main.rs#L92
Using versions (similar crash; logs):
rustc 1.20.0-nightly (720c596 2017-07-08)
rustc 1.18.0 (03fc9d6 2017-06-06)
I don't know too much about the compiler internals, but a bug search for "layout_of" didn't bring up anything that seemed relevant. So here you go.
Seems similar to #37096 but I'm not using impl Trait?