Skip to content

Commit 67972c7

Browse files
committed
refactor(core): associated types can now imply ~const Trait
`[ref:const_trait_not_implied]` has been resolved by [rust-lang/rust#101989][1]. [1]: rust-lang/rust#101989
1 parent f6014cc commit 67972c7

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

doc/toolchain_limitations.md

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -130,35 +130,6 @@ const A: MaybeUninit<*mut ()> = unsafe {
130130
```
131131

132132

133-
### `[tag:const_trait_not_implied]` `~const` in associated type bounds are not implied in the trait's use sites
134-
135-
Associated type bounds are usually implied in the trait's use sites (e.g., if an associated type `Trait::Proj` is bounded by `Clone`, `T: Trait` implies `T::Proj: Clone`). However, this doesn't seem to apply to `~const`.
136-
137-
```rust
138-
trait Trait {
139-
type Proj: Clone;
140-
}
141-
142-
fn clone_projection<T: Trait>(p: &T::Proj) -> T::Proj {
143-
p.clone()
144-
}
145-
```
146-
147-
```rust,compile_fail,E0277
148-
#![feature(const_trait_impl)]
149-
150-
#[const_trait]
151-
trait Trait {
152-
type Proj: ~const Clone;
153-
}
154-
155-
const fn clone_projection<T: ~const Trait>(p: &T::Proj) -> T::Proj {
156-
// error[E0277]: the trait bound `<T as Trait>::Proj: ~const Clone` is not satisfied
157-
p.clone()
158-
}
159-
```
160-
161-
162133
### `[tag:impl_block_const_bounds]` The trait bounds of an `impl` block can't include `~const`
163134

164135
```rust,compile_fail

src/r3_core/src/bind/sorter.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,6 @@ const fn topological_sort<
603603
) -> bool
604604
where
605605
Graph: ~const GraphAccess<VertexRef>,
606-
// [ref:const_trait_not_implied] necessitates `: ~const MyIterator`
607-
Graph::VertexIter<'a>: ~const MyIterator + ~const Destruct,
608-
// [ref:const_trait_not_implied] necessitates `: ~const MyIterator`
609-
Graph::SuccessorIter<'a>: ~const MyIterator + ~const Destruct,
610606
VertexRef: Copy + ~const Destruct,
611607
VertexRefLessThan: ~const FnMut(&VertexRef, &VertexRef) -> bool,
612608
ReadyVertexQueue: ~const VecLike<Element = VertexRef>,

0 commit comments

Comments
 (0)