Uh oh!
There was an error while loading. Please reload this page.
Use associated constants in std::num::{Zero,One} - #25684
Conversation
rust-highfive
commented
May 21, 2015
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
Gankra
commented
May 21, 2015
What's the status of this in the face of #25687 ? |
tamird
commented
May 21, 2015
It's a superset - I'll rebase this when #25687 lands. |
Gankra
commented
May 21, 2015
The extra bits just ICE, though, right? |
tamird
commented
May 21, 2015
Yeah - I'd file an issue but I wasn't able to reduce the ICE down |
Cleanup extracted from rust-lang#25684. r? @alexcrichton
quantheory
commented
May 23, 2015
We are in the unhappy position where trait-associated constants are not really useful, because you can't actually use them from type parameters. For use of trait-associated constants in non-constant expressions, we need something similar to the existing type projections, so that the compiler isn't confused about constants that can't be resolved. For use in constant expressions, see: rust-lang/rfcs#1062. |
eddyb
commented
May 23, 2015
Like I told @tamird on IRC, this particular ICE is a mishandling of unresolved paths to associated items. |
Cleanup extracted from rust-lang#25684. r? @alexcrichton
Cleanup extracted from rust-lang#25684. r? @alexcrichton
Cleanup extracted from rust-lang#25684. r? @alexcrichton
Cleanup extracted from rust-lang#25684. r? @alexcrichton
72e9aaa to
9bef19dComparequantheory
commented
May 23, 2015
@eddyb Ah, I see. We are asking if it is an lvalue before the type is checked, which is where |
bluss
commented
May 24, 2015
This makes the trait less general (only available to types that can produce a zero in constants). I suppose that's useful and ok, it just needs to be mentioned. |
tamird
commented
May 24, 2015
@bluss this is true, but not such a big problem given https://github.com/rust-lang/rust/pull/25609/files#diff-9e764fdb4b37fceaf4fdf1ddb027dbcaR15 |
bluss
commented
May 24, 2015
BigNum are allocating and can never impl the new trait (?) I don't think it's important. |
eddyb
commented
May 24, 2015
@bluss if the |
alexcrichton
commented
May 26, 2015
I agree with @bluss that this probably excludes bignum from implementing the trait, but I'm somewhat hesitant on casting it aside as not important. The These existence of these traits is necessitated by the iterators that use them, and I believe that's needed for inference to work out ok, so these need to stick around. I think it's fine to experiment with them having associated constants instead of methods, but we'd likely want to give everything a rethink still before stabilizing them. |
This commit causes an ICE!
7322ac0 to
8d7f2e4Comparetamird
commented
May 27, 2015
As a temporary measure, #25091 rejects this code, so this PR is blocked behind a future change that allows associated constants to depend on |
This refactor causes the following ICE: