diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-04-17 18:13:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-17 18:13:36 +0200 |
| commit | d01c62bcef9ed70f308cc151b6a714f27af1caf8 (patch) | |
| tree | a7ec5f4165290c0e1d2e174baef6b633a814907a /tests | |
| parent | 0790996a07e309e169d363b0c59edb1f3d5d3b82 (diff) | |
| parent | 1ee189cde53a4cecd3e8811d6ffe983676a70c7b (diff) | |
| download | rust-d01c62bcef9ed70f308cc151b6a714f27af1caf8.tar.gz rust-d01c62bcef9ed70f308cc151b6a714f27af1caf8.zip | |
Rollup merge of #110425 - compiler-errors:def-span-for-ct-param, r=petrochenkov
Encode def span for `ConstParam` Fixes #110206 r? ``@petrochenkov``
Diffstat (limited to 'tests')
3 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/consts/auxiliary/foreign-generic-mismatch-with-const-arg.rs b/tests/ui/consts/auxiliary/foreign-generic-mismatch-with-const-arg.rs new file mode 100644 index 00000000000..85b0c6c9df8 --- /dev/null +++ b/tests/ui/consts/auxiliary/foreign-generic-mismatch-with-const-arg.rs @@ -0,0 +1 @@ +pub fn test<const N: usize, T>() {} diff --git a/tests/ui/consts/foreign-generic-mismatch-with-const-arg.rs b/tests/ui/consts/foreign-generic-mismatch-with-const-arg.rs new file mode 100644 index 00000000000..7590abbd827 --- /dev/null +++ b/tests/ui/consts/foreign-generic-mismatch-with-const-arg.rs @@ -0,0 +1,8 @@ +// aux-build: foreign-generic-mismatch-with-const-arg.rs + +extern crate foreign_generic_mismatch_with_const_arg; + +fn main() { + foreign_generic_mismatch_with_const_arg::test::<1>(); + //~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied +} diff --git a/tests/ui/consts/foreign-generic-mismatch-with-const-arg.stderr b/tests/ui/consts/foreign-generic-mismatch-with-const-arg.stderr new file mode 100644 index 00000000000..4cc03a20514 --- /dev/null +++ b/tests/ui/consts/foreign-generic-mismatch-with-const-arg.stderr @@ -0,0 +1,21 @@ +error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied + --> $DIR/foreign-generic-mismatch-with-const-arg.rs:6:46 + | +LL | foreign_generic_mismatch_with_const_arg::test::<1>(); + | ^^^^ - supplied 1 generic argument + | | + | expected 2 generic arguments + | +note: function defined here, with 2 generic parameters: `N`, `T` + --> $DIR/auxiliary/foreign-generic-mismatch-with-const-arg.rs:1:8 + | +LL | pub fn test<const N: usize, T>() {} + | ^^^^ -------------- - +help: add missing generic argument + | +LL | foreign_generic_mismatch_with_const_arg::test::<1, T>(); + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. |
