Conversation
|
r? @wesleywiser (rustbot has picked a reviewer for you, use r? to override) |
| call_source.from_hir_call(), | ||
| None, | ||
| ); | ||
| if let call_kind::CallKind::FnCall { fn_trait_id: _, self_ty } = |
There was a problem hiding this comment.
You could use let-chains here :)
There was a problem hiding this comment.
made it more readable now
|
We should probably just rip out the trait method call logic here and solely rely on effect checks. I don't like making const checks have more special casing logic, but also won't review in detail until January. So I don't have anything useful to say about the code change cc @fee1-dead |
| if let call_kind::CallKind::FnCall { fn_trait_id: _, self_ty } = | ||
| call_kind | ||
| && let FnDef(def_id, ..) = self_ty.kind() | ||
| && tcx.is_const_fn_raw(*def_id) |
There was a problem hiding this comment.
is_const_fn_raw only checks whether the function is const, and not whether it is const-stable. We'd need a test to check whether this would silently allow calling functions that are not const-stable.
There was a problem hiding this comment.
how do we do that kind of check ?
There was a problem hiding this comment.
I'm not sure if other parts of the const checking code already check for const stability, so the first step would be creating an auxiliary ui test where upstream has a const-unstable function and downstream tries to call that function without the feature enabled (following the snippet for this ICE). If it already passes, then great. If it doesn't, we can change this from is_const_fn_raw to is_const_fn
Yes, that would be the goal. I did leave a comment up there |
|
After looking a little bit into this, it looks like the actual ICE isn't because we aren't doing enough checks here, but probably because of something deeper than that. If I recall correctly, we used to remap the callee |
|
@rustbot author |
|
☔ The latest upstream changes (presumably #118692) made this pull request unmergeable. Please resolve the merge conflicts. |
|
@ouz-a any updates on this? |
|
Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this. @rustbot label: +S-inactive |
We were unable to capture constness of the
fand ended up with ICE, this PR checks constness of thecallee. I also don't understand why we are not checking constness via callingcall_kindand capturingFnCall.Fixes #117795