diff options
| author | varkor <github@varkor.com> | 2019-09-10 18:46:27 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-09-10 22:30:46 +0100 |
| commit | 14e6947fa4b9a144802869286a937c987d6a3c54 (patch) | |
| tree | 06f05989e684d853cbddbaa9130c15a11a510332 /src/test/ui | |
| parent | 4894123d21ed4b153a2e5c32c0870cb2d97f9b46 (diff) | |
| download | rust-14e6947fa4b9a144802869286a937c987d6a3c54.tar.gz rust-14e6947fa4b9a144802869286a937c987d6a3c54.zip | |
Correct the polymorphic extern fn error for const parameters
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/const-generics/foreign-item-const-parameter.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/const-generics/foreign-item-const-parameter.stderr | 27 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/foreign-item-const-parameter.rs b/src/test/ui/const-generics/foreign-item-const-parameter.rs new file mode 100644 index 00000000000..4673c8606c3 --- /dev/null +++ b/src/test/ui/const-generics/foreign-item-const-parameter.rs @@ -0,0 +1,10 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +extern "C" { + fn foo<const X: usize>(); //~ ERROR foreign items may not have const parameters + + fn bar<T, const X: usize>(_: T); //~ ERROR foreign items may not have type or const parameters +} + +fn main() {} diff --git a/src/test/ui/const-generics/foreign-item-const-parameter.stderr b/src/test/ui/const-generics/foreign-item-const-parameter.stderr new file mode 100644 index 00000000000..0a74537dfef --- /dev/null +++ b/src/test/ui/const-generics/foreign-item-const-parameter.stderr @@ -0,0 +1,27 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/foreign-item-const-parameter.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +error[E0044]: foreign items may not have const parameters + --> $DIR/foreign-item-const-parameter.rs:5:5 + | +LL | fn foo<const X: usize>(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't have const parameters + | + = help: use specialization instead of const parameters by replacing them with concrete consts + +error[E0044]: foreign items may not have type or const parameters + --> $DIR/foreign-item-const-parameter.rs:7:5 + | +LL | fn bar<T, const X: usize>(_: T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't have type or const parameters + | + = help: use specialization instead of type or const parameters by replacing them with concrete types or consts + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0044`. |
