Repository navigation
Self.make(x) in a method body calls the static method: MIR reads Sema's record of a type receiver (#3335) - #3342
Merged
Merged
Conversation
…'s record of a type receiver instead of asking named_types, where Self is bound only while its body is checked (#3335)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self.make(x)in a method body (a trait's default method, or an impl's own) was lowered with a receiver the static method does not take: invalid LLVM (call @i32.Make.make(%str zeroinitializer, %str …)) or "MIR lowering failed".Exact line. Sema read
Selfas the type and resolved the call with no receiver (resolved-call args=1).MirLower.lower_method_callasked again whether the receiver named a type, withself.sema.named_types.contains(sym), a table in whichSelfis bound only while its body is checked; at lowering time it is absent, so the receiver was lowered as a value.Fix (D65). Sema records the calls whose receiver it read as a type (
static_receiver_calls, where the method call's parameter offset is decided); MIR reads that at its three is-static tests instead of deriving it again.Test:
behav_3335_self_static_call_in_method_body(a one-argument and a no-argument static, from a default body, for a primitive and a record). Fails on the installed compiler, passes here; the five reduced programs from the issue pass.Battery: GREEN on f8e5f9d.
Closes #3335.