]> git.lizzy.rs Git - rust.git/commitdiff
Add error for const parameters depending on type parameters
authorvarkor <github@varkor.com>
Tue, 5 Feb 2019 15:52:31 +0000 (16:52 +0100)
committervarkor <github@varkor.com>
Thu, 7 Feb 2019 14:02:17 +0000 (15:02 +0100)
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
src/librustc_resolve/diagnostics.rs

index 0db8689c0c17c27f855390636c7ba83099d27ad1..a5f9124674a55cbbcab32d9c0d4590b5e925c4b6 100644 (file)
@@ -414,8 +414,8 @@ fn main() {}
 "##,
 
 E0401: r##"
-Inner items do not inherit type parameters from the functions they are embedded
-in.
+Inner items do not inherit type or const parameters from the functions
+they are embedded in.
 
 Erroneous code example:
 
@@ -1642,6 +1642,17 @@ fn main() {
 ```
 "##,
 
+E0670: r##"
+Const parameters cannot depend on type parameters.
+The following is therefore invalid:
+
+```
+fn const_id<T, const N: T>() -> T {
+    N
+}
+```
+"##,
+
 }
 
 register_diagnostics! {