aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-08-04 14:26:10 +0000
committerGitHub <noreply@github.com>2021-08-04 14:26:10 +0000
commit15635e68bb65d5ce6963ce0c820719a06ca794cd (patch)
treea1b2dfdc3aa8c82367b4a71ae5cb3c633bd35292 /gcc/rust/parse/rust-parse.h
parent7bdd8599b99a80b5930945bb87d1abffba8ee157 (diff)
parentc4077cc2a8c9ade9bd9b61804d756fcfc2cc9931 (diff)
downloadgcc-15635e68bb65d5ce6963ce0c820719a06ca794cd.zip
gcc-15635e68bb65d5ce6963ce0c820719a06ca794cd.tar.gz
gcc-15635e68bb65d5ce6963ce0c820719a06ca794cd.tar.bz2
Merge #605
605: Merge both module classes in one r=philberty a=CohenArthur This PR merges both kinds of Modules (formerly `ModuleBodied` and `ModuleNoBody`) as one class with an enum. This is the [behavior used by rustc](https://github.com/rust-lang/rust/blob/2939249f294dd54a9ce78a8ee1f2922a44e7fb7c/compiler/rustc_ast/src/ast.rs#L2274), where both variants are kept in an enum with one holding a vector of items. This change is important for multiple file parsing: An external mod (`mod foo; // defined in foo.rs or foo/mod.rs`) will see its items expanded during expansion, which occurs after parsing. This means that the previous directive will be "replaced" by `mod foo { <items> }` at the AST level. In order to achieve this, we need to be able to modify a previously parsed instance of an AST element. In rustc, this is done [here](https://github.com/rust-lang/rust/blob/2939249f294dd54a9ce78a8ee1f2922a44e7fb7c/compiler/rustc_expand/src/expand.rs#L1427), where `mod_kind` was previously `ModKind::Unloaded` and becomes `ModKind::Loaded(parsed_items, ...)`. Co-authored-by: CohenArthur <arthur.cohen@epita.fr>
Diffstat (limited to 'gcc/rust/parse/rust-parse.h')
0 files changed, 0 insertions, 0 deletions