-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #103319 - fee1-dead-contrib:improve_tilde_const_msg, …
…r=oli-obk Improve "`~const` is not allowed here" message r? `@oli-obk`
- Loading branch information
Showing
6 changed files
with
85 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(const_trait_impl)] | ||
|
||
#[const_trait] | ||
trait Bar {} | ||
|
||
fn foo<T>() where T: ~const Bar {} | ||
//~^ ERROR `~const` is not allowed | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: `~const` is not allowed here | ||
--> $DIR/issue-90052.rs:6:22 | ||
| | ||
LL | fn foo<T>() where T: ~const Bar {} | ||
| ^^^^^^^^^^ | ||
| | ||
note: this function is not `const`, so it cannot have `~const` trait bounds | ||
--> $DIR/issue-90052.rs:6:4 | ||
| | ||
LL | fn foo<T>() where T: ~const Bar {} | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/test/ui/rfc-2632-const-trait-impl/tilde-const-and-const-params.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: `~const` is not allowed here | ||
--> $DIR/tilde-const-and-const-params.rs:25:11 | ||
| | ||
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { | ||
| ^^^^^^^^^^^^ | ||
| | ||
note: this function is not `const`, so it cannot have `~const` trait bounds | ||
--> $DIR/tilde-const-and-const-params.rs:25:4 | ||
| | ||
LL | fn bar<A: ~const Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { | ||
| ^^^ | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters