about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2021-02-25 00:09:33 +0000
committerAmanieu d'Antras <amanieu@gmail.com>2021-02-25 00:09:33 +0000
commit2451f124c95b2edfcaac9706500163c0224502df (patch)
tree7fc448ef88555f515ea025f8ba4e300330205b8d /compiler/rustc_passes/src
parent00eca69bffcb4ef95ba1dd6013b840bf12a85804 (diff)
downloadrust-2451f124c95b2edfcaac9706500163c0224502df.tar.gz
rust-2451f124c95b2edfcaac9706500163c0224502df.zip
Address review comments
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 947cca3c725..022f1858878 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -789,6 +789,23 @@ impl CheckAttrVisitor<'tcx> {
                 })) = item
                 {
                     let arg_count = decl.inputs.len() as u128 + generics.params.len() as u128;
+                    for param in generics.params {
+                        match param.kind {
+                            hir::GenericParamKind::Const { .. } => {}
+                            _ => {
+                                self.tcx
+                                    .sess
+                                    .struct_span_err(
+                                        meta.span(),
+                                        "#[rustc_legacy_const_generics] functions must \
+                                         only have const generics",
+                                    )
+                                    .span_label(param.span, "non-const generic parameter")
+                                    .emit();
+                                break;
+                            }
+                        }
+                    }
                     if *val >= arg_count {
                         let span = meta.span();
                         self.tcx