Closed
Description
Code
I tried this code:
#![feature(negative_impls, auto_traits)]
auto trait NotEqual {}
impl<T> ! NotEqual for (T, T) {} // expected: NotEqual is not implemented only and only if for tuple(a, b) a and b are of the same type
fn call<T>(_: T) where T: NotEqual {} // expected: only tuple(a, b) a and b are of the same type compile err; but a and b are of the different type compile ok
fn main() {
// compile ok in all nightly; it's exactly what i expected
call(1);
call((1,1.2, 1.3));
// compile not ok in all nightly; yes, it's exactly what i expected
// call((1,1));
// compile ok in nightly-2023-07-28(cmd: cargo +nightly-2023-07-28 run); yes, it's exactly what i expected
// compile not ok after nightly-2023-07-29 version(cmd: cargo +nightly-2023-07-29 run); it's not exactly what i expected! why? for what reasons did it change?
call((1,1.2));
}
I expected to see this happen:
just compile ok like before nightly-2023-07-28 version
$ cargo +nightly-2023-07-28 run
Compiling test_negative_impls v0.1.0 (/Users/wangyanci/workspace_rust/test_negative_impls)
Finished dev [unoptimized + debuginfo] target(s) in 0.20s
Running `target/debug/test_negative_impls`
Instead, this happened:
compile error after nightly-2023-07-29 version
Compiling test_negative_impls v0.1.0 (/Users/wangyanci/workspace_rust/test_negative_impls)
error[E0277]: the trait bound `({integer}, {float}): NotEqual` is not satisfied
--> src/main.rs:15:10
|
15 | call((1,1.2));
| ---- ^^^^^^^ the trait `NotEqual` is not implemented for `({integer}, {float})`
| |
| required by a bound introduced by this call
|
note: required by a bound in `call`
--> src/main.rs:7:27
|
7 | fn call<T>(_: T) where T: NotEqual {}
| ^^^^^^^^ required by this bound in `call`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `test_negative_impls` (bin "test_negative_impls") due to previous error
Version it worked on
It most recently worked on: nightly-2023-07-28
$rustup install nightly-2023-07-28
info: syncing channel updates for 'nightly-2023-07-28-x86_64-apple-darwin'
nightly-2023-07-28-x86_64-apple-darwin unchanged - rustc 1.73.0-nightly (500647fd8 2023-07-27)
info: checking for self-update
Version with regression
rustc --version --verbose
:
nightly-2023-07-28
$ rustup override set nightly-2023-07-28 && rustc --version --verbose
info: using existing install for 'nightly-2023-07-28-x86_64-apple-darwin'
info: override toolchain for '/Users/wangyanci/workspace_rust/test_negative_impls' set to 'nightly-2023-07-28-x86_64-apple-darwin'
nightly-2023-07-28-x86_64-apple-darwin unchanged - rustc 1.73.0-nightly (500647fd8 2023-07-27)
rustc 1.73.0-nightly (500647fd8 2023-07-27)
binary: rustc
commit-hash: 500647fd8138cc09e87edb08d62f81654fbf6ef8
commit-date: 2023-07-27
host: x86_64-apple-darwin
release: 1.73.0-nightly
LLVM version: 16.0.5
nightly-2023-07-28
rustup override set nightly-2023-07-29 && rustc --version --verbose
info: using existing install for 'nightly-2023-07-29-x86_64-apple-darwin'
info: override toolchain for '/Users/wangyanci/workspace_rust/test_negative_impls' set to 'nightly-2023-07-29-x86_64-apple-darwin'
$ nightly-2023-07-29-x86_64-apple-darwin unchanged - rustc 1.73.0-nightly (04abc370b 2023-07-28)
rustc 1.73.0-nightly (04abc370b 2023-07-28)
binary: rustc
commit-hash: 04abc370b9f3855b28172b65a7f7d5a433f41412
commit-date: 2023-07-28
host: x86_64-apple-darwin
release: 1.73.0-nightly
LLVM version: 16.0.5
Backtrace
Backtrace
$ cargo +nightly-2023-07-29 run
error[E0277]: the trait bound `({integer}, {float}): NotEqual` is not satisfied
--> src/main.rs:15:10
|
15 | call((1,1.2));
| ---- ^^^^^^^ the trait `NotEqual` is not implemented for `({integer}, {float})`
| |
| required by a bound introduced by this call
|
note: required by a bound in `call`
--> src/main.rs:7:27
|
7 | fn call<T>(_: T) where T: NotEqual {}
| ^^^^^^^^ required by this bound in `call`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `test_negative_impls` (bin "test_negative_impls") due to previous error
I'd like to know what considerations changed it or is it a problem in itself