diff options
| author | bors <bors@rust-lang.org> | 2020-08-08 01:48:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-08-08 01:48:35 +0000 |
| commit | f9c2177ddc605f9c75ca1a3e6ddb33835b8a178d (patch) | |
| tree | d8f6d0b66e018cde836a6fb6faa7a7f38116c84b /src/test/rustdoc-ui/coverage/doc-examples.rs | |
| parent | f3a9de9b08659e20ce7c282ed77bc43ddd149107 (diff) | |
| parent | 644c8949121da0c16f65b772bf6e217748d94530 (diff) | |
| download | rust-f9c2177ddc605f9c75ca1a3e6ddb33835b8a178d.tar.gz rust-f9c2177ddc605f9c75ca1a3e6ddb33835b8a178d.zip | |
Auto merge of #74877 - lcnr:min_const_generics, r=oli-obk
Implement the `min_const_generics` feature gate
Implements both https://github.com/rust-lang/lang-team/issues/37 and https://github.com/rust-lang/compiler-team/issues/332.
Adds the new feature gate `#![feature(min_const_generics)]`.
This feature gate adds the following limitations to using const generics:
- generic parameters must only be used in types if they are trivial. (either `N` or `{ N }`)
- generic parameters must be either integers, `bool` or `char`.
We do allow arbitrary expressions in associated consts though, meaning that the following is allowed,
even if `<[u8; 0] as Foo>::ASSOC` is not const evaluatable.
```rust
trait Foo {
const ASSOC: usize;
}
impl<const N: usize> Foo for [u8; N] {
const ASSOC: usize = 64 / N;
}
```
r? @varkor cc @eddyb @withoutboats
Diffstat (limited to 'src/test/rustdoc-ui/coverage/doc-examples.rs')
0 files changed, 0 insertions, 0 deletions
