-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Regression in diesel with 2020-01-15 nightly: overflow evaluating requirement #68264
Comments
The same code (diesel 1.4.3) builds fine in stable, so marking as regression. |
There is a bisec in the linked diesel issue.
|
Likely #67914 cc @Aaron1011 |
It looks like we need to run normalization, not just fulfillment, in canonical mode. I'll open a PR later today |
Unfortunately, normalization and projection don't have the equivalent of The root issue here is that const-prop is very much "best effort" - it's okay to bail out if we're uncertain about something. However, trait selection and projection are very much not "best effort" - if we can't prove something, we tend to need to raise an error to avoid unsoundness. A lot of code is designed around this principle (e.g. |
A minimal example to reproduce is this: pub trait Query {}
pub trait AsQuery {
type Query: Query;
}
pub trait Table: AsQuery + Sized {}
pub trait LimitDsl {
type Output;
}
pub(crate) trait LoadQuery<Conn, U>: RunQueryDsl<Conn> {}
impl<T: Query> AsQuery for T {
type Query = Self;
}
impl<T> LimitDsl for T
where
T: Table,
T::Query: LimitDsl,
{
type Output = <T::Query as LimitDsl>::Output;
}
pub(crate) trait RunQueryDsl<Conn>: Sized {
fn first<U>(self, _conn: &Conn) -> U
where
Self: LimitDsl,
Self::Output: LoadQuery<Conn, U>,
{
// Overflow is caused by this function body
unimplemented!()
}
} Please note that this is only reproducible in a library crate, but not in a binary crate (So put it in lib.rs, not in main.rs). |
…, r=oli-obk Filter and test predicates using `normalize_and_test_predicates` for const-prop Fixes rust-lang#68264 Previously, I attempted to use `substitute_normalize_and_test_predicates` to detect unsatisfiable bounds. Unfortunately, since const-prop runs in a generic environment (we don't have any of the function's generic parameters substituted), this could lead to cycle errors when attempting to normalize predicates. This check is replaced with a more precise check. We now only call `normalize_and_test_predicates` on predicates that have the possibility of being proved unsatisfiable - that is, predicates that don't depend on anything local to the function (e.g. generic parameters). This ensures that we don't hit cycle errors when we normalize said predicates, while still ensuring that we detect unsatisfiable predicates. I haven't been able to come up with a minimization of the Diesel issue - however, I've verified that it compiles successfully.
I got this error on diesel 1.4.3 but I guess the difference was I was on rust nightly. Updating rust to nightly 2020-1-25 fixed the issue. spooky |
I'm getting this issue while installing the diesel crate on nightly 2020-01-19. Updating to 2020-1-26 fixed the issue. |
rustc version:
rustc 1.42.0-nightly (3291ae339 2020-01-15)
Notably, there is no information about where the error actually is.
rustc 1.42.0-nightly (31dd4f4ac 2020-01-13)
was fine. I also see a passing CI run on diesel for nightly on commit8a87b945b27
.EDIT: I did run this test on the
master
branch of diesel, but I first discovered the problem in diesel1.4.3
.The text was updated successfully, but these errors were encountered: