about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-10-18 14:24:51 +0300
committerGitHub <noreply@github.com>2023-10-18 14:24:51 +0300
commita536d58607844b25dde518688b22e0f1e96eb1d5 (patch)
tree26c645a4a16ee5110fb15361a865058b2a513079 /tests
parent0653d7eebf81bfe699e3d3bf327c9953518a157e (diff)
parentbcdd3d77397295f1e20cd257c306d25c3a32dde2 (diff)
downloadrust-a536d58607844b25dde518688b22e0f1e96eb1d5.tar.gz
rust-a536d58607844b25dde518688b22e0f1e96eb1d5.zip
Rollup merge of #116856 - oli-obk:no_effects, r=compiler-errors
Disable effects in libcore again

r? `@fee1-dead`

This was accidentally allowed by https://github.com/rust-lang/rust/pull/114776 without feature gates
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/consts/effect_param.rs11
-rw-r--r--tests/ui/consts/effect_param.stderr19
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/consts/effect_param.rs b/tests/ui/consts/effect_param.rs
new file mode 100644
index 00000000000..f11ec739fce
--- /dev/null
+++ b/tests/ui/consts/effect_param.rs
@@ -0,0 +1,11 @@
+//! Ensure we don't allow accessing const effect parameters from stable Rust.
+
+fn main() {
+    i8::checked_sub::<true>(42, 43);
+    //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+}
+
+const FOO: () = {
+    i8::checked_sub::<false>(42, 43);
+    //~^ ERROR: method takes 0 generic arguments but 1 generic argument was supplied
+};
diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr
new file mode 100644
index 00000000000..f8c4bfc02e5
--- /dev/null
+++ b/tests/ui/consts/effect_param.stderr
@@ -0,0 +1,19 @@
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/effect_param.rs:9:9
+   |
+LL |     i8::checked_sub::<false>(42, 43);
+   |         ^^^^^^^^^^^--------- help: remove these generics
+   |         |
+   |         expected 0 generic arguments
+
+error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied
+  --> $DIR/effect_param.rs:4:9
+   |
+LL |     i8::checked_sub::<true>(42, 43);
+   |         ^^^^^^^^^^^-------- help: remove these generics
+   |         |
+   |         expected 0 generic arguments
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0107`.