diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-10-30 14:37:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-30 14:37:03 +0200 |
| commit | d99dc7abfaaf9ddee9110f834dbadda302d183ad (patch) | |
| tree | 0fdf40c263811e126db5d870fcaa4229d5b33862 /src | |
| parent | 88e0bea7ca8966c5ee57915cf5afa128168595b2 (diff) | |
| parent | 87fbf3c5aaff62cb70cf95ccfd756f4f147e8fea (diff) | |
| download | rust-d99dc7abfaaf9ddee9110f834dbadda302d183ad.tar.gz rust-d99dc7abfaaf9ddee9110f834dbadda302d183ad.zip | |
Rollup merge of #90396 - b-naber:type_flags_ices_default_anon_consts, r=lcnr
Prevent type flags assertions being thrown in default_anon_const_substs if errors occurred Fixes https://github.com/rust-lang/rust/issues/90364 Fixes https://github.com/rust-lang/rust/issues/88997 r? ``@lcnr``
Diffstat (limited to 'src')
4 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/issues/issue-88997.rs b/src/test/ui/const-generics/issues/issue-88997.rs new file mode 100644 index 00000000000..7666a514101 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-88997.rs @@ -0,0 +1,14 @@ +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +struct ConstAssert<const COND: bool>; +trait True {} +impl True for ConstAssert<true> {} + +struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T) +//~^ ERROR the type of const parameters must not depend on other generic parameters +//~| ERROR the type of const parameters must not depend on other generic parameters +where + ConstAssert<{ MIN <= MAX }>: True; + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-88997.stderr b/src/test/ui/const-generics/issues/issue-88997.stderr new file mode 100644 index 00000000000..505ba0da232 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-88997.stderr @@ -0,0 +1,15 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/issue-88997.rs:8:40 + | +LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T) + | ^ the type must not depend on the parameter `T` + +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/issue-88997.rs:8:54 + | +LL | struct Range<T: PartialOrd, const MIN: T, const MAX: T>(T) + | ^ the type must not depend on the parameter `T` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0770`. diff --git a/src/test/ui/const-generics/issues/issue-90364.rs b/src/test/ui/const-generics/issues/issue-90364.rs new file mode 100644 index 00000000000..b11b07b5023 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90364.rs @@ -0,0 +1,9 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +pub struct Foo<T, const H: T>(T) +//~^ ERROR the type of const parameters must not depend on other generic parameters +where + [(); 1]:; + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-90364.stderr b/src/test/ui/const-generics/issues/issue-90364.stderr new file mode 100644 index 00000000000..e85bd136ef6 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-90364.stderr @@ -0,0 +1,9 @@ +error[E0770]: the type of const parameters must not depend on other generic parameters + --> $DIR/issue-90364.rs:4:28 + | +LL | pub struct Foo<T, const H: T>(T) + | ^ the type must not depend on the parameter `T` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0770`. |
