Handle mismatched generic param kinds in trait impls betterly#96717
Handle mismatched generic param kinds in trait impls betterly#96717bors merged 5 commits intorust-lang:masterfrom
Conversation
|
@bors r+ rollup |
|
📌 Commit 52916657e53bfd5f91190953708120a5be5b2641 has been approved by |
|
@bors r- |
5291665 to
e64b4d1
Compare
lcnr
left a comment
There was a problem hiding this comment.
can you add a test for the following? after that r=me
trait Trait {
fn func<U, const N: usize>() {}
}
impl Trait for () {
fn func<const N: usize, U>() {}
}7ee1b25 to
0cf7604
Compare
0cf7604 to
fea1d76
Compare
| } { | ||
| let make_param_message = |prefix: &str, param: &ty::GenericParamDef| match param.kind { | ||
| Const { .. } => { | ||
| format!("{} const parameter with type `{}`", prefix, tcx.type_of(param.def_id)) |
There was a problem hiding this comment.
| format!("{} const parameter with type `{}`", prefix, tcx.type_of(param.def_id)) | |
| format!("{} const parameter of type `{}`", prefix, tcx.type_of(param.def_id)) |
For me "of type" seems more natural here, idk 😅
Considering that this closure doesn't capture anything, can you move it out of the loop to ty_const_params_of?
There was a problem hiding this comment.
Changed the error wording.
I don't think it'd be good to have the closure be by ty_const_params_of since then its really far away from the code actually calling the closure. I pushed code moving it furthur down so its closer to the call site, imo makes it easier to understand the code.
|
@bors r+ rollup |
|
📌 Commit e4b8ed5 has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#96717 (Handle mismatched generic param kinds in trait impls betterly) - rust-lang#96725 (Expose process windows_process_extensions_main_thread_handle on Windows) - rust-lang#96849 (Move some tests to more reasonable places) - rust-lang#96861 (Use Rust 2021 prelude in std itself.) - rust-lang#96879 (rustdoc: search result ranking fix) - rust-lang#96882 (Don't subst an AdtDef with its own substs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
r? @lcnr