Repository navigation
The standard library writes no explicit receiver outside a trait body, and an attribute above an impl-block method is the method's (part of #727) - #3586
Merged
Conversation
added 4 commits
November 24, 2026 02:09
…: 205 dotted methods move into impl blocks and 17 trait-impl methods take the keyword form (part of #727)
…corded with the reason (part of #727)
…@[must_use], @[tailrec], @[inline], @[noinline] and @[no_alloc] were read and dropped there (found by #727's move of std.sync into impl blocks)
…, and a function attribute above an impl block is refused instead of dropped (part of #727)
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.
Part of #727, which stays open: the last step there, refusing an explicit
self, changes what compiles and waits for a go.1. The sweep. 205 top-level dotted instance methods in
lib/std(pub fn BuildCtx.fs(self: &Self) -> &ToolFs) move intoimplblocks in the keyword form (pub fn fs() -> &ToolFs,mut fn,move fn), and 17 trait-impl methods take it too (tools/migrate_receivers.with).std.buildheld 150 of them. The generatedDerefimpl of a facade resource is written the same way. What is left in the tree is trait declarations (the carve-out), and source text inside fixtures and templates.2. A compiler bug the sweep found.
Parser.parse_impl_blockread the attributes above a method and dropped them:@[suspends],@[must_use],@[tailrec],@[inline],@[noinline],@[no_alloc]. On main, this is accepted:std.synconly worked because its suspending methods were dotted. The attributes now reach the method, and a function attribute written above theimplline itself is refused instead of dropped.3. Return types. Moving a method changes its signature text, so the
-> Unitreview looked at each. A typed probe showed which are needed: a body ending in an assignment returns the assigned value (D43), so those keep-> Unit. Six that end in a Unit call lose it; nine signatures are recorded indocs/unit-return-reviews.tsvwith the reason.Tests.
err_727_suspends_on_impl_method(fails on main),err_727_function_attribute_above_impl_block,err_727_once_call_in_no_suspend(nothing checked thatOnce.call_oncestill declared it may suspend; the first battery only caught the same slip onBarrier.wait).Evidence at 2c21606.
:behavior-tests,:runtime-tests,:native-compile-error-tests,:validate-all-tests,:deep-debug-tool-tests(audit:receiver-surface), pre-checks green; battery green (the first one was red onerr_barrier_wait_in_no_suspend: an attribute my first script pass left above animplheader); linux-aarch64 container leg green (:build,:behavior-tests,:runtime-tests,:native-compile-error-tests);:release-checkssurvey: all targets green.