use std::f64::consts::PI;
fn main() {
let n = 1.5;
if PI/3. < n && n < PI/2 {
println!("PI/3<1.5<PI/2");
}
}
And it causes internal compiler error
error: internal compiler error: Impl DefId { krate: 2, node: 26299 } was matchable against Obligation(predicate=Binder(TraitPredicate(core::ops::Div<_>)),depth=1) but now is not
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', /Users/yasuyuki/src/github.com/rust-lang/rust/src/libsyntax/diagnostic.rs:209
The right code is:
use std::f64::consts::PI;
fn main() {
let n = 1.5;
if PI/3. < n && n < PI/2. {
println!("PI/3<1.5<PI/2");
}
}
The following code is properly reported as error.
use std::f64::consts::PI;
fn main() {
let n = 1.5;
if PI/3 < n && n < PI/2 {
println!("PI/3<1.5<PI/2");
}
}
src/bug-reproduce-minimum.rs:5:8: 5:12 error: the trait `core::ops::Div<_>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if PI/3 < n && n < PI/2 {
^~~~
src/bug-reproduce-minimum.rs:5:8: 5:12 error: the trait `core::ops::Div<_>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if PI/3 < n && n < PI/2 {
^~~~
src/bug-reproduce-minimum.rs:5:24: 5:28 error: the trait `core::ops::Div<_>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if PI/3 < n && n < PI/2 {
^~~~
src/bug-reproduce-minimum.rs:5:24: 5:28 error: the trait `core::ops::Div<_>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if PI/3 < n && n < PI/2 {
^~~~
The following is also properly reported.
fn main() {
let n = 1.5;
if 3.14/3. < n && n < 3.14/2 {
println!("PI/3<1.5<PI/2");
}
}
src/bug-reproduce-minimum.rs:5:27: 5:33 error: the trait `core::ops::Div<i32>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if 3.14/3. < n && n < 3.14/2 {
^~~~~~
src/bug-reproduce-minimum.rs:5:27: 5:33 error: the trait `core::ops::Div<i32>` is not implemented for the type `f64` [E0277]
src/bug-reproduce-minimum.rs:5 if 3.14/3. < n && n < 3.14/2 {
^~~~~~
I tried this code:
And it causes
internal compiler error
The right code is:
The following code is properly reported as error.
The following is also properly reported.
Meta
rustc --version --verbose
:Backtrace: