Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upExplicit OIBIT impls hide the default impls #27554
Comments
Aatch
added
the
A-traits
label
Aug 6, 2015
This comment has been minimized.
This comment has been minimized.
|
I've been experimenting with ways to fix this, and, oddly, there's a unit test checking that this doesn't work: https://github.com/rust-lang/rust/blob/master/src/test/compile-fail/typeck-default-trait-impl-precedence.rs The OIBIT RFC seems pretty clear that this is supposed to be accepted, but I know that the rules specified there for negative impls are thought to be too lenient, so maybe this part is also frowned upon? |
huonw
added
I-nominated
T-lang
T-compiler
labels
Oct 7, 2015
This comment has been minimized.
This comment has been minimized.
|
As explained in #23072, this was the semantics we implemented, which diverged somewhat from the RFC. It's interesting that this can come about without feature gates (though obvious in retrospect). |
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium We discussed this last week in the language subteam meeting. Our conclusion was that there is (potentially) an issue here where the desired semantics are not entirely clear. It is backwards incompatible to fix it but deemed low risk, because the bad scenario is when one is trying to "add to" the default set that obey a particular trait (or remove further from the negative set, I suppose). Some notes from our discussion: The intent of an impl like this is somewhat unclear. Why did one write the impl in the first place? Was the goal to cover a case that the default rules would have excluded? Or was it perhaps to narrow down the default rules to a smaller set of acceptable cases (which kind of "opts out" by "opting in")? The latter is the current semantics; it does seem plausible that a naive read of the code might think that the impl was listing out the cases that are |
rust-highfive
added
P-medium
and removed
I-nominated
labels
Oct 14, 2015
wthrowe
referenced this issue
Oct 16, 2015
Merged
RFC: Amend `recover` with a `PanicSafe` bound #1323
brson
added
I-nominated
I-wrong
A-typesystem
labels
Jul 14, 2016
This comment has been minimized.
This comment has been minimized.
|
Nominating for retriage and updates. Old type system issue. |
arielb1
removed
the
I-wrong
label
Jul 17, 2016
This comment has been minimized.
This comment has been minimized.
|
Not |
This comment has been minimized.
This comment has been minimized.
|
I believe that there is no bug here: the compiler is doing the right thing, essentially. I've been meaning for some time to write-up an amendment to the OIBIT (now: auto trait) RFC to talk about it for some time. My current thoughts (more-or-less) are embedded in this gist, which also covers the connection to negative reasoning. |
nikomatsakis
removed
the
T-compiler
label
Jul 21, 2016
This comment has been minimized.
This comment has been minimized.
|
Going to close this issue -- this is the desired semantics -- but we do need to write an amendment to the RFC, I think. |
wthrowe commentedAug 6, 2015
Nothing in this example opts out of
Syncor contains a type that opts out, so everything should beSync.I suspect this is the same underlying issue as #23072, but unlike in that case this seems like something that should be allowed.