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
Overflow on double nested container types #34137
Comments
In case it is useful, this much shorter program gives similar behaviour: Compare this version, which compiles and runs just fine: |
Here's a further minimization of @apt1002 's program: https://play.rust-lang.org/?gist=0a77e1bd0f8e539d8a85ee30ed63b1f6&version=stable&backtrace=0 A common thread on all these failing programs is that there are 2 layers of "containerization", whether that be |
Good idea to remove the lifetime nonsense. Much clearer. I think we've both made errors! Mine was that "where Target: From<&'m T>" should have been "where Target: for<'a> From<&'a T>". I only just learned about this. Yours is that "(a.0).0" should be "C((a.0).0)". The error message is unchanged in both cases, i.e. it still looks like a compiler bug. I think these examples should work, but at the very least the compiler is not giving the right error message. |
Triage: Let's close this because
|
I have the following code:
https://play.rust-lang.org/?gist=b8c78d5084a9b9ab7c53a2a9faa022af&version=stable&backtrace=0
As it can be seen the #[test] works fine, but if I try to run a cargo test on it I get the following error on the doc_test:
failures:
---- vec::<&'a Vector>::add_0 stdout ----
error: overflow evaluating the requirement
<&_ as std::ops::Add<_>>::Output
[E0275]:1:1: 1:1 note: consider adding a
#![recursion_limit="128"]
attribute to your crateerror: aborting due to previous error
It seems like which function will fail depends on the compiler. I have the impression that at home both implemententions of Add for &Vector will fail, but I might be mistaken and will update this issue when I get home.
This is the rust version I'm using here:
rustc 1.10.0-dev (14f61c8 2016-04-18)
binary: rustc
commit-hash: 14f61c8
commit-date: 2016-04-18
host: x86_64-unknown-linux-gnu
release: 1.10.0-dev
The discussion on the rust forums can be found here:
https://users.rust-lang.org/t/weird-problems-with-recursion-in-type-bounds-in-tests-on-libs/6101/4
update: I was mistaken, at home I get the same behavior. But like @mbrubeck said on the forum discussion, if I remove the last two Add impls everything works.
The text was updated successfully, but these errors were encountered: