You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
D111: an unannotated let of a str field, and a str global read, still need .clone() (seven sites the #2942 sweep could not remove) #3026
Found by the #2942 sweep (branch ceremony-sweeps): removing .clone() at the census's 483 str-clone sites leaves seven the compiler refuses, all one gap.
Field and local-record fields.let source_path = self.source_path (compiler/Compilation.w:1125), let saved_module_path = self.current_module_path (SemaCheck.w:29540), let record_name = record.name (ComptimeEval.w:6428): an unannotated let of a str field binds a view of the place (field_let_binds_as_view; MIR alias-binds it), so a later self.…(…) mutation is refused ("cannot mutate self while source_path is a live view into it") and consuming record afterwards is refused ("view record_name may outlive its origin"). The diagnostic's own help is let source_path: str = …, which is the str-view-copy-annotation ceremony the census counts, and D179's comment on type_takes_value_on_binding says the unannotated binding takes the str — but that rule runs only when the expression is a &str, not a str place.
Globals.g_migrate_shared_defs_prefix as a tail value (CiMigrate.w:395), g_ci_bail_location / g_ci_bail_message (CImport.w:18486, 18492), build_cache_compiler_fingerprint (BuildGraphCache.w:276): "cannot move out of global …: clone it (.clone()) instead" (reject_move_out_of_global, keyed on type_needs_drop). A str read out of a global is a count increment, never a move.
D111: a str is a value; passing a str always copies; code using str never sees "use of moved value" and never needs .clone(). So: an unannotated let of a str place (field, element, global) takes the str (a str_clone_ref copy in MIR, the annotated form's path), and a global str read in value position copies. Fixtures: let s = self.name; self.name = "x"; print(s) prints the old name; fn f() -> str: g_name compiles. Then the seven sites drop their .clone() and the census pattern str-view-copy-annotation can sweep.
Activity
#3026: MIR aliases a field let only when Sema said view; the live-vie…
#2942: a str is a value — the `.clone()` on a str goes (476 sites)
#3026 (D111, D179): an unannotated let of a str place takes the str; …
#3026: MIR aliases a field let only when Sema said view; the live-vie…
#3026: the #1819/#1827 global-view pins keep a List field — a str fie…
#3026 (D111): an unannotated let of a str place takes the str; a str …
#2942: a str is a value — the `.clone()` on a str goes (476 sites)
#2942: a str is a value — the `.clone()` on a str goes (476 sites)
#2942, #2939: the str .clone() and the explicit &x at a &T parameter …