Rollup merge of #110425 - compiler-errors:def-span-for-ct-param, r=petrochenkov
Encode def span for `ConstParam` Fixes #110206 r? ``@petrochenkov``
This commit is contained in:
commit
d01c62bcef
4 changed files with 32 additions and 2 deletions
|
@ -823,6 +823,7 @@ fn should_encode_span(def_kind: DefKind) -> bool {
|
||||||
| DefKind::TraitAlias
|
| DefKind::TraitAlias
|
||||||
| DefKind::AssocTy
|
| DefKind::AssocTy
|
||||||
| DefKind::TyParam
|
| DefKind::TyParam
|
||||||
|
| DefKind::ConstParam
|
||||||
| DefKind::Fn
|
| DefKind::Fn
|
||||||
| DefKind::Const
|
| DefKind::Const
|
||||||
| DefKind::Static(_)
|
| DefKind::Static(_)
|
||||||
|
@ -837,8 +838,7 @@ fn should_encode_span(def_kind: DefKind) -> bool {
|
||||||
| DefKind::Impl { .. }
|
| DefKind::Impl { .. }
|
||||||
| DefKind::Closure
|
| DefKind::Closure
|
||||||
| DefKind::Generator => true,
|
| DefKind::Generator => true,
|
||||||
DefKind::ConstParam
|
DefKind::ExternCrate
|
||||||
| DefKind::ExternCrate
|
|
||||||
| DefKind::Use
|
| DefKind::Use
|
||||||
| DefKind::ForeignMod
|
| DefKind::ForeignMod
|
||||||
| DefKind::ImplTraitPlaceholder
|
| DefKind::ImplTraitPlaceholder
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
pub fn test<const N: usize, T>() {}
|
|
@ -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
|
||||||
|
}
|
|
@ -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`.
|
Loading…
Add table
Add a link
Reference in a new issue