about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-22 16:13:30 +0100
committerGitHub <noreply@github.com>2024-01-22 16:13:30 +0100
commitba542c823d319eca5e8a4fc274aa4df3e392e014 (patch)
tree1974a4331446202065b896254b06a8aa6a3acd45 /tests
parent2346647daf532de8dcf7e002375c2ff65cb9046e (diff)
parent802d16ce3a530786757670e954693b125f3fa957 (diff)
downloadrust-ba542c823d319eca5e8a4fc274aa4df3e392e014.tar.gz
rust-ba542c823d319eca5e8a4fc274aa4df3e392e014.zip
Rollup merge of #120213 - compiler-errors:dont-make-non-lifetime-binders-in-rtn, r=fmease
Don't actually make bound ty/const for RTN

Avoid creating an unnecessary non-lifetime binder when we do RTN on a method that has ty/const params.

Fixes #120208

r? oli-obk
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs17
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr20
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs
new file mode 100644
index 00000000000..3b350e14fd9
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs
@@ -0,0 +1,17 @@
+// edition: 2021
+
+#![feature(return_type_notation)]
+//~^ WARN the feature `return_type_notation` is incomplete
+
+trait HealthCheck {
+    async fn check<const N: usize>() -> bool;
+}
+
+async fn do_health_check_par<HC>(hc: HC)
+where
+    HC: HealthCheck<check(): Send> + Send + 'static,
+    //~^ ERROR return type notation is not allowed for functions that have const parameters
+{
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr
new file mode 100644
index 00000000000..8a3f037d003
--- /dev/null
+++ b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr
@@ -0,0 +1,20 @@
+warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/issue-120208-higher-ranked-const.rs:3:12
+   |
+LL | #![feature(return_type_notation)]
+   |            ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error: return type notation is not allowed for functions that have const parameters
+  --> $DIR/issue-120208-higher-ranked-const.rs:12:21
+   |
+LL |     async fn check<const N: usize>() -> bool;
+   |                    -------------- const parameter declared here
+...
+LL |     HC: HealthCheck<check(): Send> + Send + 'static,
+   |                     ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error; 1 warning emitted
+