Repository navigation
Merged
Conversation
…refused at the receiver
§9.5: a top-level `fn Type.name` is an associated function with no
receiver; only the typed transition forms (`mut self: Self`) are
accepted there. A bare `mut self` parsed as an untyped parameter, and a
field write through it reached the MIR validator as an ICE ('use rvalue
type is incompatible with assign destination'); a bare `move self`
failed in code generation; a plain `self` said 'method receiver mode is
missing; compiler effects require `fn`'. The parser now refuses all
three where they are written and names the two accepted spellings: the
typed parameter, or the method inside `impl Type:` with its keyword.
(#897 fixed the same inside a type, where the keyword decides.)
Fixtures: err_3112_bare_{mut_,move_,}self_on_dotted_fn.
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.
Fixes #3112. §9.5: a top-level
fn Type.namehas no receiver; only the typed transition forms are accepted there. A baremut selfreached the MIR validator as an ICE on a field write, a baremove selffailed in code generation, a plainselfsaid 'method receiver mode is missing'. The parser refuses all three where written and names the two accepted spellings (the typed parameter, or the method insideimpl Type:). A trait's or impl's method list is untouched (afree_fn_paramsflag set only by a top-level fn declaration). Fixtures err_3112_bare_{mut_,move_,}self_on_dotted_fn.Battery history, stated plainly. Run 1 (163018e) was red on four fixtures my first version wrongly refused (bare
selfin trait/impl methods; fixed by the flag) plus behav_3166. Run 2 (c567f6c) was red on behav_3166 and behav_3087 only: both test binaries were linked with the pinned seed's runtime inside battery-checks (the kept binary is byte-size identical to a seed build and fails deterministically), while the lane alone ran both and passed (src/main build :behavior-tests --no-deps: 2108 files ok, 2106 cached, 2 ran). That harness race is filed as #3209 with the evidence. Run 3 on the same commit c567f6c: GREEN (wall 182 s; the lanes that had passed were served from their verdict cache, behavior-tests from the lane-alone run).