-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Type inference regression and ICE in nightly 2020-10-06 #77638
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
#73905 looks suspicious? |
Minimal repro: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=55f8795c91867fec5550107d789a60f8 (at time of writing the playground does not have the affected nightly yet) |
Yeah, bisecting it's indeed 08e2d46 or #73905 . |
Assigning |
that playground link now fails with the error described above. |
Hey, so I tried porting our code to compile with latest nightly and I almost got it working but ultimately it ended with an internal compiler error:
I created a branch that fails with this or a similar ICE when you run |
I'm curious if this issue is related to a type inference regression we're experiencing on nightly-2020-10-06 which was NOT present on nightly-2020-10-05: cometbft/tendermint-rs#584 (comment) Our particular problem can be reproduced with:
On nightly-2020-10-05, it compiles. On nightly-2020-10-06, we get:
Note that |
This might be related: both |
@lqd that crater report is great, thanks. I figured that the type inference changes might be an intentional bugfix, I'll try to fix embedded-time. |
Can someone help me understand this? This fixed the problem: pub fn checked_add<Dur: Duration>(self, duration: Dur) -> Option<Self>
where
Dur: FixedPoint,
- Clock::T: TryFrom<Dur::T>
+ Clock::T: TryFrom<Dur::T> + ops::Div<Output=Clock::T> But that bound seems redundant because |
Reduced the playground above to remove the dependency on use core::ops::Div;
trait CheckedDiv: Sized + Div<Self, Output = Self> {}
trait Bounded {
fn max_value() -> Self;
}
struct Fraction;
trait TimeInt: Bounded + CheckedDiv + Div<Fraction, Output = Self> {}
trait Clock {
type T: TimeInt;
}
trait FixedPoint {
type T: TimeInt;
}
struct Instant<Clock: crate::Clock> {
ticks: Clock::T,
}
impl<Clock: crate::Clock> Instant<Clock> {
pub fn checked_add<Dur: FixedPoint>(self, duration: Dur) {
let _ = <Clock::T as Bounded>::max_value() / 2.into();
}
} (It could probably be reduced further to a MCVE mostly involving the two |
The `ecdsa` crate no longer builds on `nightly`, possibly due to: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `ecdsa` crate no longer builds on `nightly`, possibly due to: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `ecdsa` crate no longer builds on `nightly`, possibly due to: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `ecdsa` crate no longer builds on `nightly`, possibly due to: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `ecdsa` crate no longer builds on `nightly`, possibly due to: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `elliptic-curve` crate no longer builds on `nightly`. Possible cause: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
The `elliptic-curve` crate no longer builds on `nightly`. Possible cause: rust-lang/rust#77638 Unfortunately this means rustdoc builds on https://docs.rs fail! This commit works around the issue.
I believe |
The uom issue is fallout from fixing #27675 The really minimal example of this is use std::ops::Add;
trait A {
type U: Add<i64> + Add<u64>;
}
fn f<T: A>(t: T::U) {
let x = t + Default::default();
} on stable the compiler will arbitrarily decide to use the |
@matthewjasper Oh awesome, that means you fixed #72582 (and a few of its duplicates). Should I add a regression test? |
There should already be some tests in #73905, if you can find anything not covered by the tests added there then please add some. |
Looks like https://github.com/rust-lang/rust/pull/73905/files#diff-9930232eb2ce0b857a7afb6bc22d8fc8 should cover it. Thanks! |
Can this issue be closed? |
@Aaron1011 Since it seems that these regressions were already known about when #73905 was merged, I suppose they were intentional. Additionally, @matthewjasper saw this and hasn't said anything to the effect of these being issues that need to be fixed so I'm going to close. |
rust-lang/rust#73905 introduced changes to typechecking that made previously accepted trait bounds where a trait was automatically chosen now ambiguous. Resolves #210. See rust-lang/rust#77638 (comment) for additional discussion.
rust-lang/rust#73905 introduced changes to typechecking that made previously accepted trait bounds where a trait was automatically chosen now ambiguous. Resolves #210. See rust-lang/rust#77638 (comment) for additional discussion.
Fixes the following error: cannot multiply-assign `<E as Engine>::Fr` by `&&<E as Engine>::Fr` I think this is related to: rust-lang/rust#77638
I think this is related to rust-lang/rust#77638
I tried this code:
FluenTech/embedded-time@521569d
I expected to see this happen:
Successful compilation. This works with stable, and nightly 2020-10-05.
Instead, this happened:
https://github.com/FluenTech/embedded-time/pull/77/checks?check_run_id=1218050695
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: