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 upLoop evaluating Cow<'a, T>: Sized in recursive structure #23714
Comments
This comment has been minimized.
This comment has been minimized.
|
I believe that @nikomatsakis recently made a change that detected overflow, that may be related (I don't recall the details offhand). |
This comment has been minimized.
This comment has been minimized.
freebroccolo
referenced this issue
Mar 26, 2015
Merged
Refactor how we handle overflow and remove blanket Pattern impl #23580
This comment has been minimized.
This comment has been minimized.
|
I think #23707 might be related |
This comment has been minimized.
This comment has been minimized.
|
so yes I think this is a dup of #23707 but the error was being swallowed somewhere |
This comment has been minimized.
This comment has been minimized.
|
and I think #23707 is a dup of an older issue too :) |
This comment has been minimized.
This comment has been minimized.
|
sorry I'm not sure if this is a dup of #23707 specifically; I was thinking of another issue |
apasel422
added
the
A-borrow-checker
label
Oct 28, 2015
wthrowe
referenced this issue
Oct 29, 2015
Closed
Incorrect error for overflow in bound evaluation #29446
This comment has been minimized.
This comment has been minimized.
|
Any progress here? I'm running into this as well. |
aturon
added
T-compiler
I-nominated
labels
Jun 10, 2016
This comment has been minimized.
This comment has been minimized.
|
Nominating for discussion at compiler team meeting. |
This comment has been minimized.
This comment has been minimized.
|
assigning P-medium |
pnkfelix
added
P-medium
and removed
I-nominated
labels
Jun 23, 2016
This comment has been minimized.
This comment has been minimized.
|
This produces "error: overflow evaluating the requirement use std::borrow::ToOwned;
enum Foo {
Bar,
Baz { cow: Result<&'static Foo, <Foo as ToOwned>::Owned> }
}
impl ToOwned for Foo {
type Owned = Box<Foo>;
fn to_owned(&self) -> Box<Foo> { loop {} }
}However, this works: use std::borrow::Borrow;
pub trait ToOwned {
type Owned: Borrow<Self>;
fn to_owned(&self) -> Self::Owned;
}
enum Foo {
Bar,
Baz { cow: Result<&'static Foo, <Foo as ToOwned>::Owned> }
}
impl ToOwned for Foo {
type Owned = Box<Foo>;
fn to_owned(&self) -> Box<Foo> { loop {} }
}Does this have to do with coherence cross-crate interactions? |
This comment has been minimized.
This comment has been minimized.
|
Both of @eddyb's examples compile now, while the code in the OP still fails. |
freebroccolo commentedMar 25, 2015
The example causes the checker to loop with build
rustc 1.0.0-dev (81938ec58 2015-03-25) (built 2015-03-25):It does still work using the Rust playpen here. I'm not sure if something changed in the API or if it's a bug or something else. The docs show
ToOwned::Owned: Sizedso the requirement should be satisfied. /cc @aturon