Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode lifetime param spans too #110469

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ fn should_encode_span(def_kind: DefKind) -> bool {
| DefKind::AssocTy
| DefKind::TyParam
| DefKind::ConstParam
| DefKind::LifetimeParam
| DefKind::Fn
| DefKind::Const
| DefKind::Static(_)
Expand All @@ -840,10 +841,7 @@ fn should_encode_span(def_kind: DefKind) -> bool {
| DefKind::Impl { .. }
| DefKind::Closure
| DefKind::Generator => true,
DefKind::ForeignMod
| DefKind::ImplTraitPlaceholder
| DefKind::LifetimeParam
| DefKind::GlobalAsm => false,
DefKind::ForeignMod | DefKind::ImplTraitPlaceholder | DefKind::GlobalAsm => false,
}
}

Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions tests/ui/consts/foreign-generic-mismatch-with-const-arg.rs

This file was deleted.

21 changes: 0 additions & 21 deletions tests/ui/consts/foreign-generic-mismatch-with-const-arg.stderr

This file was deleted.

3 changes: 3 additions & 0 deletions tests/ui/generics/auxiliary/foreign-generic-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn const_arg<const N: usize, T>() {}

pub fn lt_arg<'a: 'a>() {}
10 changes: 10 additions & 0 deletions tests/ui/generics/foreign-generic-mismatch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// aux-build: foreign-generic-mismatch.rs

extern crate foreign_generic_mismatch;

fn main() {
foreign_generic_mismatch::const_arg::<()>();
//~^ ERROR function takes 2 generic arguments but 1 generic argument was supplied
foreign_generic_mismatch::lt_arg::<'static, 'static>();
//~^ ERROR function takes 1 lifetime argument but 2 lifetime arguments were supplied
}
35 changes: 35 additions & 0 deletions tests/ui/generics/foreign-generic-mismatch.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0107]: function takes 2 generic arguments but 1 generic argument was supplied
--> $DIR/foreign-generic-mismatch.rs:6:31
|
LL | foreign_generic_mismatch::const_arg::<()>();
| ^^^^^^^^^ -- supplied 1 generic argument
| |
| expected 2 generic arguments
|
note: function defined here, with 2 generic parameters: `N`, `T`
--> $DIR/auxiliary/foreign-generic-mismatch.rs:1:8
|
LL | pub fn const_arg<const N: usize, T>() {}
| ^^^^^^^^^ -------------- -
help: add missing generic argument
|
LL | foreign_generic_mismatch::const_arg::<(), T>();
| +++

error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were supplied
--> $DIR/foreign-generic-mismatch.rs:8:31
|
LL | foreign_generic_mismatch::lt_arg::<'static, 'static>();
| ^^^^^^ ------- help: remove this lifetime argument
| |
| expected 1 lifetime argument
|
note: function defined here, with 1 lifetime parameter: `'a`
--> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8
|
LL | pub fn lt_arg<'a: 'a>() {}
| ^^^^^^ --

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0107`.