about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2022-06-09 21:30:18 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2022-06-09 21:49:14 +0200
commit4d871a25bf96e577992218ac69b449e3648166be (patch)
treee5162a0e7acd0f95586659e20ff40bc06781455e /src
parent7fe2c4b00dfbc33643e1af4b293eb057306a8339 (diff)
downloadrust-4d871a25bf96e577992218ac69b449e3648166be.tar.gz
rust-4d871a25bf96e577992218ac69b449e3648166be.zip
Do not introduce bindings for types and consts in HRTB.
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs7
-rw-r--r--src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr14
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs b/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs
new file mode 100644
index 00000000000..1a9bb252340
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.rs
@@ -0,0 +1,7 @@
+fn a() where for<T> T: Copy {}
+//~^ ERROR only lifetime parameters can be used in this context
+
+fn b() where for<const C: usize> [(); C]: Copy {}
+//~^ ERROR only lifetime parameters can be used in this context
+
+fn main() {}
diff --git a/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr b/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
new file mode 100644
index 00000000000..f31aa554634
--- /dev/null
+++ b/src/test/ui/higher-rank-trait-bounds/hrtb-wrong-kind.stderr
@@ -0,0 +1,14 @@
+error: only lifetime parameters can be used in this context
+  --> $DIR/hrtb-wrong-kind.rs:1:18
+   |
+LL | fn a() where for<T> T: Copy {}
+   |                  ^
+
+error: only lifetime parameters can be used in this context
+  --> $DIR/hrtb-wrong-kind.rs:4:24
+   |
+LL | fn b() where for<const C: usize> [(); C]: Copy {}
+   |                        ^
+
+error: aborting due to 2 previous errors
+