summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/issues
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/issues')
-rw-r--r--src/test/ui/const-generics/issues/issue-100313.rs21
-rw-r--r--src/test/ui/const-generics/issues/issue-100313.stderr15
-rw-r--r--src/test/ui/const-generics/issues/issue-73260.stderr24
-rw-r--r--src/test/ui/const-generics/issues/issue-79674.stderr12
-rw-r--r--src/test/ui/const-generics/issues/issue-83466.rs2
-rw-r--r--src/test/ui/const-generics/issues/issue-83765.stderr4
-rw-r--r--src/test/ui/const-generics/issues/issue-87493.stderr8
7 files changed, 74 insertions, 12 deletions
diff --git a/src/test/ui/const-generics/issues/issue-100313.rs b/src/test/ui/const-generics/issues/issue-100313.rs
new file mode 100644
index 000000000..4e9d3626a
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-100313.rs
@@ -0,0 +1,21 @@
+#![allow(incomplete_features)]
+#![feature(const_mut_refs)]
+#![feature(adt_const_params)]
+
+struct T<const B: &'static bool>;
+
+impl <const B: &'static bool> T<B> {
+ const fn set_false(&self) {
+ unsafe {
+ *(B as *const bool as *mut bool) = false;
+ //~^ ERROR evaluation of constant value failed [E0080]
+ }
+ }
+}
+
+const _: () = {
+ let x = T::<{&true}>;
+ x.set_false();
+};
+
+fn main() {}
diff --git a/src/test/ui/const-generics/issues/issue-100313.stderr b/src/test/ui/const-generics/issues/issue-100313.stderr
new file mode 100644
index 000000000..f3ce357c2
--- /dev/null
+++ b/src/test/ui/const-generics/issues/issue-100313.stderr
@@ -0,0 +1,15 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/issue-100313.rs:10:13
+ |
+LL | *(B as *const bool as *mut bool) = false;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | writing to alloc7 which is read-only
+ | inside `T::<&true>::set_false` at $DIR/issue-100313.rs:10:13
+...
+LL | x.set_false();
+ | ------------- inside `_` at $DIR/issue-100313.rs:18:5
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/const-generics/issues/issue-73260.stderr b/src/test/ui/const-generics/issues/issue-73260.stderr
index f1fc50e6e..7670032e5 100644
--- a/src/test/ui/const-generics/issues/issue-73260.stderr
+++ b/src/test/ui/const-generics/issues/issue-73260.stderr
@@ -4,8 +4,16 @@ error[E0308]: mismatched types
LL | let x: Arr<{usize::MAX}> = Arr {};
| ^^^^^^^^^^^^^^^^^ expected `false`, found `true`
|
- = note: expected type `false`
- found type `true`
+ = note: expected constant `false`
+ found constant `true`
+note: required by a bound in `Arr`
+ --> $DIR/issue-73260.rs:6:37
+ |
+LL | struct Arr<const N: usize>
+ | --- required by a bound in this
+LL | where
+LL | Assert::<{N < usize::MAX / 2}>: IsTrue,
+ | ^^^^^^ required by this bound in `Arr`
error[E0308]: mismatched types
--> $DIR/issue-73260.rs:16:32
@@ -13,8 +21,16 @@ error[E0308]: mismatched types
LL | let x: Arr<{usize::MAX}> = Arr {};
| ^^^ expected `false`, found `true`
|
- = note: expected type `false`
- found type `true`
+ = note: expected constant `false`
+ found constant `true`
+note: required by a bound in `Arr`
+ --> $DIR/issue-73260.rs:6:37
+ |
+LL | struct Arr<const N: usize>
+ | --- required by a bound in this
+LL | where
+LL | Assert::<{N < usize::MAX / 2}>: IsTrue,
+ | ^^^^^^ required by this bound in `Arr`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/const-generics/issues/issue-79674.stderr b/src/test/ui/const-generics/issues/issue-79674.stderr
index 8c029289c..02b48b55f 100644
--- a/src/test/ui/const-generics/issues/issue-79674.stderr
+++ b/src/test/ui/const-generics/issues/issue-79674.stderr
@@ -4,8 +4,16 @@ error[E0308]: mismatched types
LL | requires_distinct("str", 12);
| ^^^^^^^^^^^^^^^^^ expected `true`, found `false`
|
- = note: expected type `true`
- found type `false`
+ = note: expected constant `true`
+ found constant `false`
+note: required by a bound in `requires_distinct`
+ --> $DIR/issue-79674.rs:23:37
+ |
+LL | fn requires_distinct<A, B>(_a: A, _b: B) where
+ | ----------------- required by a bound in this
+LL | A: MiniTypeId, B: MiniTypeId,
+LL | Lift<{is_same_type::<A, B>()}>: IsFalse {}
+ | ^^^^^^^ required by this bound in `requires_distinct`
error: aborting due to previous error
diff --git a/src/test/ui/const-generics/issues/issue-83466.rs b/src/test/ui/const-generics/issues/issue-83466.rs
index c488a663f..73c930101 100644
--- a/src/test/ui/const-generics/issues/issue-83466.rs
+++ b/src/test/ui/const-generics/issues/issue-83466.rs
@@ -1,5 +1,5 @@
// regression test for #83466- tests that generic arg mismatch errors between
-// consts and types are not supressed when there are explicit late bound lifetimes
+// consts and types are not suppressed when there are explicit late bound lifetimes
struct S;
impl S {
diff --git a/src/test/ui/const-generics/issues/issue-83765.stderr b/src/test/ui/const-generics/issues/issue-83765.stderr
index 28ddddf1b..d5f914f46 100644
--- a/src/test/ui/const-generics/issues/issue-83765.stderr
+++ b/src/test/ui/const-generics/issues/issue-83765.stderr
@@ -4,13 +4,13 @@ error[E0391]: cycle detected when resolving instance `<LazyUpdim<T, { T::DIM },
LL | const DIM: usize;
| ^^^^^^^^^^^^^^^^
|
-note: ...which requires checking if `TensorDimension` fulfills its obligations...
+note: ...which requires computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>`...
--> $DIR/issue-83765.rs:4:1
|
LL | trait TensorDimension {
| ^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires resolving instance `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>::DIM`, completing the cycle
-note: cycle used when checking if `TensorDimension` fulfills its obligations
+note: cycle used when computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>`
--> $DIR/issue-83765.rs:4:1
|
LL | trait TensorDimension {
diff --git a/src/test/ui/const-generics/issues/issue-87493.stderr b/src/test/ui/const-generics/issues/issue-87493.stderr
index f998c1187..653afae21 100644
--- a/src/test/ui/const-generics/issues/issue-87493.stderr
+++ b/src/test/ui/const-generics/issues/issue-87493.stderr
@@ -13,15 +13,17 @@ error[E0107]: this trait takes 0 generic arguments but 1 generic argument was su
--> $DIR/issue-87493.rs:8:8
|
LL | T: MyTrait<Assoc == S::Assoc>,
- | ^^^^^^^ ----------------- help: replace the generic bound with the associated type: `Assoc = Assoc == S::Assoc`
- | |
- | expected 0 generic arguments
+ | ^^^^^^^ expected 0 generic arguments
|
note: trait defined here, with 0 generic parameters
--> $DIR/issue-87493.rs:1:11
|
LL | pub trait MyTrait {
| ^^^^^^^
+help: replace the generic bound with the associated type
+ |
+LL | T: MyTrait<Assoc = Assoc == S::Assoc>,
+ | +++++++
error: aborting due to 2 previous errors