You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#![feature(negative_impls, auto_traits)]
auto traitNotEqual{}impl<T> ! NotEqualfor(T,T){}// expected: NotEqual is not implemented only and only if for tuple(a, b) a and b are of the same typefncall<T>(_:T)whereT: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 okfnmain(){// compile ok in all nightly; it's exactly what i expectedcall(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
$ 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
The text was updated successfully, but these errors were encountered:
rustbot
added
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Dec 8, 2023
This is intentional. This broke in #113312 -- see the FCP in #113312 (comment), which decided that we would adjust the way that impls (positive or negative) interact with auto traits to fix unsoundness.
This is intentional. This broke in #113312 -- see the FCP in #113312 (comment), which decided that we would adjust the way that impls (positive or negative) interact with auto traits to fix unsoundness.
OK, thanks
apiraino
removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
labels
Dec 8, 2023
Code
I tried this code:
I expected to see this happen:
just compile ok like before nightly-2023-07-28 version
Instead, this happened:
compile error after nightly-2023-07-29 version
Version it worked on
It most recently worked on: nightly-2023-07-28
Version with regression
rustc --version --verbose
:nightly-2023-07-28
nightly-2023-07-28
Backtrace
Backtrace
I'd like to know what considerations changed it or is it a problem in itself
The text was updated successfully, but these errors were encountered: