Conversation
This comment has been minimized.
This comment has been minimized.
9c81041 to
5d2b04a
Compare
|
r? @lcnr |
|
@rustbot label: +S-waiting-on-review |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@rustbot label: +S-waiting-on-review -S-waiting-on-author |
lcnr
left a comment
There was a problem hiding this comment.
after this r=me 😅 thanks for working on this ❤️
compiler/rustc_privacy/src/lib.rs
Outdated
There was a problem hiding this comment.
for this to work you have to modify fn opt_const_param_of to also run for GenericArg::Infer, don't you?
For that we probably want to remove the filter(|arg| arg.is_const()) and such and instead look at all const and type parameters to find the right one. Feel free to either add a FIXME in that method or implement it in this PR
There was a problem hiding this comment.
I changed them all to match on GenericArg::Infer | GenericArg::Const which may need to be changed since some code depends on matching on GenericParamDefKind::Const, but need to double check that
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
this isn't quite right, further down we use the arg_index while filtering by matches!(param.kind, ty::GenericParamDefKind::Const { .. }) so we can get mismatches here. I think we want to filter with !arg.is_lifetime()
There was a problem hiding this comment.
hm just changing it to lifetimes doesn't seem to work, is there any reason to filter later and instead just move the conditional into the position call: position(|a| matches!(a, Infer|Const) && ...)? and have nth(index)
(sorry, it's a bit late where I am so will get to this tmrw)
There was a problem hiding this comment.
you also have to modify the GenericParamKind filter when searching for the param in the generics.
There was a problem hiding this comment.
i.e. use !is_lifetime both when computing and when using the arg_index
There was a problem hiding this comment.
I've been trying to finagle this, but it seems to be more annoying than this small change, so I'll just leave a FIXME
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors r=oli-obk,lcnr |
|
📌 Commit 8759f00 has been approved by |
|
while I assume it won't matter, better safe than sorry |
|
⌛ Testing commit 8759f00 with merge cc4cb3f8f09c50d50407106fee4b008df6e11b1e... |
|
💔 Test failed - checks-actions |
|
@bors retry |
|
☀️ Test successful - checks-actions |
In order to extend inference to consts, make an Infer type on hir::GenericArg.