about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs4
-rw-r--r--tests/crashes/137188.rs6
-rw-r--r--tests/crashes/138166.rs8
-rw-r--r--tests/crashes/138240.rs9
-rw-r--r--tests/crashes/138266.rs7
-rw-r--r--tests/crashes/138359.rs8
-rw-r--r--tests/ui/const-generics/mgca/missing_generic_params.rs16
-rw-r--r--tests/ui/const-generics/mgca/missing_generic_params.stderr19
8 files changed, 37 insertions, 40 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index 249d1a99d72..59ec70ae961 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -2147,7 +2147,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
                 ty_id,
                 &None,
                 path,
-                ParamMode::Optional,
+                ParamMode::Explicit,
                 AllowReturnTypeNotation::No,
                 // FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
                 ImplTraitContext::Disallowed(ImplTraitPosition::Path),
@@ -2219,7 +2219,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
                 expr.id,
                 qself,
                 path,
-                ParamMode::Optional,
+                ParamMode::Explicit,
                 AllowReturnTypeNotation::No,
                 // FIXME(mgca): update for `fn foo() -> Bar<FOO<impl Trait>>` support
                 ImplTraitContext::Disallowed(ImplTraitPosition::Path),
diff --git a/tests/crashes/137188.rs b/tests/crashes/137188.rs
deleted file mode 100644
index fdd098d300f..00000000000
--- a/tests/crashes/137188.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ known-bug: #137188
-#![feature(min_generic_const_args)]
-trait Trait {}
-impl Trait for [(); N] {}
-fn N<T>() {}
-pub fn main() {}
diff --git a/tests/crashes/138166.rs b/tests/crashes/138166.rs
deleted file mode 100644
index 98003bd6dae..00000000000
--- a/tests/crashes/138166.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ known-bug: #138166
-#![feature(min_generic_const_args)]
-#![feature(inherent_associated_types)]
-struct a(Box<[u8; Box::b]>);
-impl a {
-  fn c(self) { self.0.d() }
-}
-fn main() {}
diff --git a/tests/crashes/138240.rs b/tests/crashes/138240.rs
deleted file mode 100644
index 6ffb7868bd5..00000000000
--- a/tests/crashes/138240.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ known-bug: #138240
-//@edition:2024
-#![feature(min_generic_const_args)]
-#![feature(inherent_associated_types)]
-async fn _CF() -> Box<[u8; Box::b]> {
-    Box::new(true)
-}
-
-fn main() {}
diff --git a/tests/crashes/138266.rs b/tests/crashes/138266.rs
deleted file mode 100644
index 9a4de9abcff..00000000000
--- a/tests/crashes/138266.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ known-bug: #138266
-//@compile-flags: --crate-type=lib
-#![feature(min_generic_const_args)]
-#![feature(inherent_associated_types)]
-pub fn f(mut x: [u8; Box::b]) {
-    x[72] = 1;
-}
diff --git a/tests/crashes/138359.rs b/tests/crashes/138359.rs
deleted file mode 100644
index d4376d536ee..00000000000
--- a/tests/crashes/138359.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ known-bug: #138359
-#![feature(min_generic_const_args)]
-#![feature(inherent_associated_types)]
-struct a(Box<[u8; Box::b]>);
-impl a {
-  fn c(self) { self.0.da }
-}
-fn main() {}
diff --git a/tests/ui/const-generics/mgca/missing_generic_params.rs b/tests/ui/const-generics/mgca/missing_generic_params.rs
new file mode 100644
index 00000000000..ab1db3364ec
--- /dev/null
+++ b/tests/ui/const-generics/mgca/missing_generic_params.rs
@@ -0,0 +1,16 @@
+// This used to ICE: #137188
+// The missing parameter list on `N` was set to
+// "infer from use site" in ast lowering, which
+// caused later code to not emit a missing generic
+// param error. The missing param was then attempted
+// to be inferred, but inference of generic params
+// is only possible within bodies. So a delayed
+// bug was generated with no error ever reported.
+
+#![feature(min_generic_const_args)]
+#![allow(incomplete_features)]
+trait Trait {}
+impl Trait for [(); N] {}
+//~^ ERROR: missing generics for function `N`
+fn N<T>() {}
+pub fn main() {}
diff --git a/tests/ui/const-generics/mgca/missing_generic_params.stderr b/tests/ui/const-generics/mgca/missing_generic_params.stderr
new file mode 100644
index 00000000000..78010c75621
--- /dev/null
+++ b/tests/ui/const-generics/mgca/missing_generic_params.stderr
@@ -0,0 +1,19 @@
+error[E0107]: missing generics for function `N`
+  --> $DIR/missing_generic_params.rs:13:21
+   |
+LL | impl Trait for [(); N] {}
+   |                     ^ expected 1 generic argument
+   |
+note: function defined here, with 1 generic parameter: `T`
+  --> $DIR/missing_generic_params.rs:15:4
+   |
+LL | fn N<T>() {}
+   |    ^ -
+help: add missing generic argument
+   |
+LL | impl Trait for [(); N<T>] {}
+   |                      +++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0107`.