22
33## The ` HostEffect ` predicate
44
5- [ ` HostEffectPredicate ` ] s are a kind of predicate from ` ~ const Tr` or ` const Tr ` bounds.
5+ [ ` HostEffectPredicate ` ] s are a kind of predicate from ` [ const] Tr` or ` const Tr ` bounds.
66It has a trait reference, and a ` constness ` which could be ` Maybe ` or
77` Const ` depending on the bound.
8- Because ` ~ const Tr` , or rather ` Maybe ` bounds
8+ Because ` [ const] Tr` , or rather ` Maybe ` bounds
99apply differently based on whichever contexts they are in, they have different
1010behavior than normal bounds.
1111Where normal trait bounds on a function such as
1212` T: Tr ` are collected within the [ ` predicates_of ` ] query to be proven when a
1313function is called and to be assumed within the function, bounds such as
14- ` T: ~ const Tr ` will behave as a normal trait bound and add ` T: Tr ` to the result
14+ ` T: [ const] Tr ` will behave as a normal trait bound and add ` T: Tr ` to the result
1515from ` predicates_of ` , but also adds a ` HostEffectPredicate ` to the [ ` const_conditions ` ] query.
1616
1717On the other hand, ` T: const Tr ` bounds do not change meaning across contexts,
@@ -37,7 +37,7 @@ In a similar vein,
3737an item * in const contexts* . If we adjust the example above to use ` const ` trait bounds:
3838
3939``` rust
40- const fn foo <T >() where T : ~ const Default {}
40+ const fn foo <T >() where T : [ const ] Default {}
4141```
4242
4343Then ` foo ` would get a ` HostEffect(T: Default, maybe) ` in the ` const_conditions `
@@ -55,7 +55,7 @@ Note that we don't check
5555if the function is only referred to but not called, as the following code needs to compile:
5656
5757``` rust
58- const fn hi <T : ~ const Default >() -> T {
58+ const fn hi <T : [ const ] Default >() -> T {
5959 T :: default ()
6060}
6161const X : fn () -> u32 = hi :: <u32 >;
@@ -69,7 +69,7 @@ Here's an example:
6969
7070``` rust
7171const trait Bar {}
72- const trait Foo : ~ const Bar {}
72+ const trait Foo : [ const ] Bar {}
7373// `const_conditions` contains `HostEffect(Self: Bar, maybe)`
7474
7575impl const Bar for () {}
@@ -86,13 +86,13 @@ We do the same for `const_conditions`:
8686
8787``` rust
8888const trait Foo {
89- fn hi <T : ~ const Default >();
89+ fn hi <T : [ const ] Default >();
9090}
9191
92- impl <T : ~ const Clone > Foo for Vec <T > {
93- fn hi <T : ~ const PartialEq >();
94- // ^ we can't prove `T: ~ const PartialEq` given `T: ~ const Clone` and
95- // `T: ~ const Default`, therefore we know that the method on the impl
92+ impl <T : [ const ] Clone > Foo for Vec <T > {
93+ fn hi <T : [ const ] PartialEq >();
94+ // ^ we can't prove `T: [ const] PartialEq` given `T: [ const] Clone` and
95+ // `T: [ const] Default`, therefore we know that the method on the impl
9696 // is stricter than the method on the trait.
9797}
9898```
@@ -117,11 +117,11 @@ Bounds on associated types, opaque types, and supertraits such as the following
117117have their bounds represented differently:
118118
119119``` rust
120- trait Foo : ~ const PartialEq {
121- type X : ~ const PartialEq ;
120+ trait Foo : [ const ] PartialEq {
121+ type X : [ const ] PartialEq ;
122122}
123123
124- fn foo () -> impl ~ const PartialEq {
124+ fn foo () -> impl [ const ] PartialEq {
125125 // ^ unimplemented syntax
126126}
127127```
0 commit comments