Repository navigation
Emitter seal: see through aliases; don't parse a sealed-reaching data row from JSON - #13013
Merged
Merged
Conversation
…w is not parsed from JSON Two more paths by which a type reaching a sole_constructor carrier kept or used Deserialize, found by the full rustc list of #12942's self-host build (srv1, neat-boar-16): - decl_member_type_nodes read an alias (a leaf type item) as a coproduct and visited nothing, so DagSourceAst { tree: ParseTree } (ParseTree = Node) kept its derive. An alias's one member is now its resolved target. - emit_data_def_body realized a nested-record data row by parsing JSON through serde, which needs Deserialize and is the very mint the seal forbids; six empty List rows of sealed-reaching element types refused E0277. A row whose type reaches a sealed carrier now takes the typed-expression arm. Controls in emitter_sole_constructor_seal_witness_test: an alias-typed field drops Deserialize while a plain alias keeps it; a sealed-reaching data row reaches no serde_json while a plain row of the same shape still does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Follow-up to #12999. The full rustc list of #12942's self-host build (srv1, neat-boar-16; 9 × E0277) showed two more paths by which a type that reaches a
sole_constructorcarrier still kept or usedDeserialize. Both break the existing rule indag/extdeps/languages/rust/capabilities.dag(the sealed-construction derive contract): a derivedDeserializeis a second, unsealed mint.(B) Aliases (3 errors).
decl_member_type_nodesread an alias, a leaf type item with connectiveNoConnective, as a coproduct and visited no member. Sov2.compiler.source_authorityDagSourceAst { tree: ParseTree }kept its derive, wherev2.std.grammarParseTree = Node. An alias's one member is now its resolved target. The contrast caseNormalizedDagSourceAst { tree: NormalizedTree }was already correct.(A) Data rows (6 errors).
emit_data_def_bodyrealizes a nested-record data row by parsing a JSON document throughserde_json::from_str. That needsDeserializeon the row type, and it is the forbidden mint. The six sites were emptyListrows whose element types (Frame,CacheProvider,Diagnostic,FnArrowDecl) transitively holdNode. A row whose type reaches a sealed carrier now takes the typed-expression arm, which builds the value with the constructors the source wrote. This is the rule, not an empty-list special case: a non-empty row of such a type would have minted through serde too.Controls (
test.claim.emitter_sole_constructor_seal_witness_test), each paired with a positive control so its negative pattern is known to match:alias_of_a_seal_drops_deserialize: a field typed bytype Hold = Sealeddrops the derive. Atype PlainHold = Intfield keeps it.sealed_data_row_is_not_parsed_from_json:data carriers: List<Carrier> = []over a sealed-reachingCarrierreaches noserde_json.plain_data_row_is_parsed_from_jsonshows the same shape over a plain record still does.Mirror:
v1_compiler_emit_rust.rsneeds regeneration on srv1, as #12999 did. CI's first run should show the reds and thegenerateddrift.Unblocks #12942's self-host build (emit-build).
🤖 Generated with Claude Code