diff options
| author | bors <bors@rust-lang.org> | 2022-01-18 09:58:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-01-18 09:58:39 +0000 |
| commit | 7bc7be860f99f4a40d45b0f74e2d01b02e072357 (patch) | |
| tree | bae7d965ae2524594d217ae3022513e7c929ea2c /src/test/ui/const-generics | |
| parent | 7531d2fdd49966d83830a7b4596c95587b1e9573 (diff) | |
| parent | b77bb5cb2589246cf684431ad2a184466940633d (diff) | |
| download | rust-7bc7be860f99f4a40d45b0f74e2d01b02e072357.tar.gz rust-7bc7be860f99f4a40d45b0f74e2d01b02e072357.zip | |
Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
Diffstat (limited to 'src/test/ui/const-generics')
4 files changed, 52 insertions, 16 deletions
diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs index 19e0f38d320..b126b24853f 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.rs @@ -7,8 +7,9 @@ struct Bar; const T: usize = 42; impl Foo<N = 3> for Bar { -//~^ ERROR cannot constrain an associated constant to a value +//~^ ERROR this trait takes 1 generic argument but 0 generic arguments were supplied //~| ERROR associated type bindings are not allowed here +//~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { [0u8; 3] } diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr index bbca92ad63a..59ba054aa11 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr @@ -1,11 +1,27 @@ -error: cannot constrain an associated constant to a value +error[E0658]: associated const equality is incomplete --> $DIR/issue-89013-no-kw.rs:9:10 | LL | impl Foo<N = 3> for Bar { - | -^^^- - | | | - | | ...cannot be constrained to this value - | this associated constant... + | ^^^^^ + | + = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + +error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied + --> $DIR/issue-89013-no-kw.rs:9:6 + | +LL | impl Foo<N = 3> for Bar { + | ^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `N` + --> $DIR/issue-89013-no-kw.rs:1:7 + | +LL | trait Foo<const N: usize> { + | ^^^ - +help: add missing generic argument + | +LL | impl Foo<N, N = 3> for Bar { + | ++ error[E0229]: associated type bindings are not allowed here --> $DIR/issue-89013-no-kw.rs:9:10 @@ -13,6 +29,7 @@ error[E0229]: associated type bindings are not allowed here LL | impl Foo<N = 3> for Bar { | ^^^^^ associated type not allowed here -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0229`. +Some errors have detailed explanations: E0107, E0229, E0658. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013.rs b/src/test/ui/const-generics/parser-error-recovery/issue-89013.rs index ca1158a2f6d..9431779faf8 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013.rs +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013.rs @@ -8,8 +8,9 @@ const T: usize = 42; impl Foo<N = const 3> for Bar { //~^ ERROR expected lifetime, type, or constant, found keyword `const` -//~| ERROR cannot constrain an associated constant to a value +//~| ERROR this trait takes 1 generic //~| ERROR associated type bindings are not allowed here +//~| ERROR associated const equality is incomplete fn do_x(&self) -> [u8; 3] { [0u8; 3] } diff --git a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr index 85379d3f06e..9d473992670 100644 --- a/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/src/test/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -10,14 +10,30 @@ LL - impl Foo<N = const 3> for Bar { LL + impl Foo<N = 3> for Bar { | -error: cannot constrain an associated constant to a value +error[E0658]: associated const equality is incomplete --> $DIR/issue-89013.rs:9:10 | LL | impl Foo<N = const 3> for Bar { - | -^^^^^^^^^- - | | | - | | ...cannot be constrained to this value - | this associated constant... + | ^^^^^^^^^^^ + | + = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + +error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied + --> $DIR/issue-89013.rs:9:6 + | +LL | impl Foo<N = const 3> for Bar { + | ^^^ expected 1 generic argument + | +note: trait defined here, with 1 generic parameter: `N` + --> $DIR/issue-89013.rs:1:7 + | +LL | trait Foo<const N: usize> { + | ^^^ - +help: add missing generic argument + | +LL | impl Foo<N, N = const 3> for Bar { + | ++ error[E0229]: associated type bindings are not allowed here --> $DIR/issue-89013.rs:9:10 @@ -25,6 +41,7 @@ error[E0229]: associated type bindings are not allowed here LL | impl Foo<N = const 3> for Bar { | ^^^^^^^^^^^ associated type not allowed here -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0229`. +Some errors have detailed explanations: E0107, E0229, E0658. +For more information about an error, try `rustc --explain E0107`. |
