aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-session-manager.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-05-02 14:32:12 +0000
committerGitHub <noreply@github.com>2022-05-02 14:32:12 +0000
commitfb136314f9584744ccc7b09ace3cea99129b7cf4 (patch)
tree49040fe0347cbe57412c4fd79d7e2e55c18abcc0 /gcc/rust/rust-session-manager.cc
parent27e562a2c07c9f09c80f905cf7ebc4a5b25672eb (diff)
parent98e1de2d8fdc0f39af161284d2cc74755aa1d260 (diff)
downloadgcc-fb136314f9584744ccc7b09ace3cea99129b7cf4.zip
gcc-fb136314f9584744ccc7b09ace3cea99129b7cf4.tar.gz
gcc-fb136314f9584744ccc7b09ace3cea99129b7cf4.tar.bz2
Merge #1191
1191: Resolve simple paths in use items r=CohenArthur a=CohenArthur In order to resolve `SimplePath`s, we have to expand all paths present in a `UseDeclaration` and resolve them. For example, we want to resolve two paths with the following statement `use foo::bar::{baz, bul}`: `foo::bar::baz` and `foo::bar::bul` This also removes the prelude inclusion (`use std::prelude::v1::*`) since we cannot resolve it (yet!) Needs #1172 to compile Adresses #1159 Adresses #1187 Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/rust-session-manager.cc')
-rw-r--r--gcc/rust/rust-session-manager.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index 845a66a..0b0e5af 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -932,23 +932,25 @@ Session::injection (AST::Crate &crate)
// create use tree path
// prelude is injected_crate_name
- std::vector<AST::SimplePathSegment> segments
- = {AST::SimplePathSegment (injected_crate_name, Location ()),
- AST::SimplePathSegment ("prelude", Location ()),
- AST::SimplePathSegment ("v1", Location ())};
- // create use tree and decl
- std::unique_ptr<AST::UseTreeGlob> use_tree (
- new AST::UseTreeGlob (AST::UseTreeGlob::PATH_PREFIXED,
- AST::SimplePath (std::move (segments)), Location ()));
- AST::Attribute prelude_attr (AST::SimplePath::from_str ("prelude_import",
- Location ()),
- nullptr);
- std::unique_ptr<AST::UseDeclaration> use_decl (
- new AST::UseDeclaration (std::move (use_tree),
- AST::Visibility::create_error (),
- {std::move (prelude_attr)}, Location ()));
-
- crate.items.insert (crate.items.begin (), std::move (use_decl));
+ // FIXME: Once we do want to include the standard library, add the prelude
+ // use item
+ // std::vector<AST::SimplePathSegment> segments
+ // = {AST::SimplePathSegment (injected_crate_name, Location ()),
+ // AST::SimplePathSegment ("prelude", Location ()),
+ // AST::SimplePathSegment ("v1", Location ())};
+ // // create use tree and decl
+ // std::unique_ptr<AST::UseTreeGlob> use_tree (
+ // new AST::UseTreeGlob (AST::UseTreeGlob::PATH_PREFIXED,
+ // AST::SimplePath (std::move (segments)), Location ()));
+ // AST::Attribute prelude_attr (AST::SimplePath::from_str ("prelude_import",
+ // Location ()),
+ // nullptr);
+ // std::unique_ptr<AST::UseDeclaration> use_decl (
+ // new AST::UseDeclaration (std::move (use_tree),
+ // AST::Visibility::create_error (),
+ // {std::move (prelude_attr)}, Location ()));
+
+ // crate.items.insert (crate.items.begin (), std::move (use_decl));
/* TODO: potentially add checking attribute crate type? I can't figure out
* what this does currently comment says "Unconditionally collect crate