Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::compile_crate): Create an immutable
view of the name resolution context.
|
|
gcc/rust/ChangeLog:
* rust-session-manager.cc: Add files for dumping name resolution, call
name resolution dump function.
(Session::dump_name_resolution): New.
* rust-session-manager.h: New declaration.
|
|
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::compile_crate): Create name resolution
context for Session::expansion and subsequent name resolution passes.
(Session::expansion): Take name resolution context as a parameter
instead.
* rust-session-manager.h (Session::expansion): Fix declaration.
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Add new .cc file.
* rust-session-manager.cc (Session::compile_crate): Run
analysis.
* typecheck/rust-tyty-variance-analysis-private.h: New file.
* typecheck/rust-tyty-variance-analysis.cc: New file.
* typecheck/rust-tyty-variance-analysis.h: New file.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::get_variance_analysis_ctx):
Variance analysis context.
* typecheck/rust-hir-type-check.h (TypeCheckItem::visit):
Variance analysis context.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
Add call to ast validation check, also add appropriate step to this pass
and the feature gating.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::compile_crate): Add call to ast
validation.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Compile BIR expr visitor.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go): Use BIR builder.
* rust-session-manager.cc (Session::compile_crate): Run borrow checker.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc: New file.
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h: New file.
* checks/errors/borrowck/rust-bir-builder-internal.h: New file.
* checks/errors/borrowck/rust-bir-builder-lazyboolexpr.h: New file.
* checks/errors/borrowck/rust-bir-builder-pattern.h: New file.
* checks/errors/borrowck/rust-bir-builder-struct.h: New file.
* checks/errors/borrowck/rust-bir-builder.h: New file.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
gcc/rust/ChangeLog:
* lang.opt: CLI flag.
* rust-session-manager.cc (Session::compile_crate): Guard execution.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::BorrowChecker): Opt dump.
(BorrowChecker::go): Opt dump.
* checks/errors/borrowck/rust-borrow-checker.h (class BorrowChecker): Opt dump.
* lang.opt: Add compile until borrowcheck.
* rust-session-manager.cc (Session::enable_dump): Add BIR.
(Session::compile_crate): Handle new options.
* rust-session-manager.h (struct CompileOptions): Add BIR.
Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
|
|
When an error was emitted during the cfg strip pass by the crate loader,
it was ignored and the error state propagated until another pass
(name resolver).
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::expansion): Add early break on
error.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Fixes #2391
gcc/rust/ChangeLog:
* Make-lang.in: fixup formatting
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
* rust-session-manager.cc (Session::compile_crate): call new lint
* resolve/rust-ast-verify-assignee.h: Removed.
* checks/errors/rust-readonly-check.cc: New file.
* checks/errors/rust-readonly-check.h: New file.
gcc/testsuite/ChangeLog:
* rust/compile/wrong_lhs_assignment.rs: update error message
* rust/compile/issue-2391.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* rust-backend.h
(class Backend): Convert to ...
(namespace Backend): ... namespace.
* rust-gcc.cc
(Backend::Backend): Rename to ...
(Backend::init): ... here.
(rust_get_backend): Remove.
* rust-session-manager.cc
(rust_get_backend): Remove.
(Session::init): Use Backend::init instead of rust_get_backend.
(Session::compile_crate):
Initialize Context without pointer to Backend.
* rust-session-manager.h
(Session::backend): Remove.
* backend/rust-compile-context.cc
(Context::Context): Remove pointer to Backend.
* backend/rust-compile-context.h
(class Context): Remove pointer to Backend, update function calls.
* backend/rust-compile-base.cc: Update function calls.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-fnparam.cc: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.cc: Likewise.
* backend/rust-compile-pattern.cc: Likewise.
* backend/rust-compile-resolve-path.cc: Likewise.
* backend/rust-compile-type.cc: Likewise.
* backend/rust-compile-var-decl.h: Likewise.
* backend/rust-compile.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Attribute values were used as raw string, this is error prone and
makes renaming harder. Using a constexpr instead will leverage the power
of the compiler and emit an error when an incorrect builtin attribute
value is used.
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate): Change raw
string to constexpr call.
(Attribute::separate_cfg_attrs): Likewise.
* backend/rust-compile-base.cc (should_mangle_item): Likewise.
(HIRCompileBase::setup_fndecl): Likewise.
(HIRCompileBase::handle_cold_attribute_on_fndecl): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):
Likewise.
* checks/errors/rust-unsafe-checker.cc (check_target_attr):
Likewise.
* expand/rust-cfg-strip.cc (fails_cfg): Likewise.
(fails_cfg_with_expand): Likewise.
(expand_cfg_attrs): Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::lower_macro_definition): Likewise.
* hir/rust-hir-dump.cc (Dump::visit): Likewise.
* parse/rust-parse-impl.h (Parser::parse_doc_comment): Likewise.
* parse/rust-parse.cc (extract_module_path): Likewise.
* resolve/rust-early-name-resolver.cc (is_macro_use_module):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export):
Likwise.
* rust-session-manager.cc (Session::injection): Likewise.
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::parse_repr_options): Likewise.
* util/rust-attributes.cc (is_proc_macro_type): Likewise.
(AttributeChecker::check_attribute): Likewise.
(AttributeChecker::visit): Likewise.
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise.
* util/rust-attribute-values.h: New file.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This part of the code is a bit tricky as it calls multiple functions
with almost the same name and slightly different behaviors. It was even
more with a meaningless variable name.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::load_extern_crate): Change
variable name, add temporaries and comments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Move extern crate resolving under the extern crate declaration instead
of doing it under the crate's root as extern crates are not resolved by
the top level resolver.
gcc/rust/ChangeLog:
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Update definition to allow Extern crate with no content (pure
proc macros).
(ExternCrate::ok): Panic on no content.
(ExternCrate::load): Likewise.
* metadata/rust-extern-crate.h: Update prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Remove macro resolution.
(TopLevel::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.h: Add visit prototype
for extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Adapt
content depending on the loaded crate's content.
* util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros):
Change return type to optional because it is way more
convenient.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
* util/rust-hir-map.h: Update function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This commit moves the procedural macros loaded definition from outside
the AST to the mappings. This means most getters/setters around the
mappings had to be changed. This commit also introduces the top level
visit of those mappings instead of visiting the Crate ast members.
gcc/rust/ChangeLog:
* ast/rust-ast.h (class BangProcMacro): Move class from here to
rust-proc-macro.h. Also remove related functions.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
(struct Crate): Remove proc macro vector members.
* expand/rust-macro-expand.h (struct MacroExpander): Change the
type to the newly created classes.
* expand/rust-proc-macro.cc (BangProcMacro::BangProcMacro): Add
constructor implementation.
(AttributeProcMacro::AttributeProcMacro): Likewise.
(CustomDeriveProcMacro::CustomDeriveProcMacro): Likewise.
* expand/rust-proc-macro.h (class BangProcMacro): Move class to
here.
(class AttributeProcMacro): Likewise.
(class CustomDeriveProcMacro): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Change top level visitor to check mappings instead
* rust-session-manager.cc (Session::load_extern_crate):
Add back macro collection to mappings.
* util/rust-hir-map.cc (Mappings::insert_derive_proc_macros):
Update getter signature with new types.
(Mappings::insert_bang_proc_macros): Likewise.
(Mappings::insert_attribute_proc_macros): Likewise.
(Mappings::lookup_derive_proc_macros): Likewise.
(Mappings::lookup_bang_proc_macros): Likewise.
(Mappings::lookup_attribute_proc_macros): Likewise.
(Mappings::insert_derive_proc_macro_def): Likewise.
(Mappings::insert_bang_proc_macro_def): Likewise.
(Mappings::insert_attribute_proc_macro_def): Likewise.
(Mappings::lookup_derive_proc_macro_def): Likewise.
(Mappings::lookup_bang_proc_macro_def): Likewise.
(Mappings::lookup_attribute_proc_macro_def): Likewise.
(Mappings::insert_derive_proc_macro_invocation): Likewise.
(Mappings::lookup_derive_proc_macro_invocation): Likewise.
(Mappings::insert_bang_proc_macro_invocation): Likewise.
(Mappings::lookup_bang_proc_macro_invocation): Likewise.
(Mappings::insert_attribute_proc_macro_invocation): Likewise.
(Mappings::lookup_attribute_proc_macro_invocation): Likewise.
* util/rust-hir-map.h: Update function prototypes as well as map
types.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add mechanism to discover proc macros in loaded extern crates. In the
top level resolver.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::go):
Visit crate's newly stored proc macros.
* rust-session-manager.cc (Session::load_extern_crate):
Store proc macros in the parsed crate instead of a local
variable to achieve mappings.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Use error object instead of lambda for error collection.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of lambda.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Remove type alias.
* rust-diagnostics.h: Change collection type.
* rust-session-manager.cc (Session::expansion): Change
collection container.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
We need to collect the early resolver's macros error to emit them at a
later stage after further expansion in order to retrieve macros defined
by other macro invocations.
Register some mappings for macro invocations and macro definitions.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):
Collect error instead of emitting it. Also add invocation
registration.
* resolve/rust-early-name-resolver-2.0.h (std::function<void):
Add type definition for collection.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Register macro rule definition in mappings.
* rust-session-manager.cc (Session::expansion): Add macro
resolve error collection.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-mangle.cc (v0_add_identifier): Added punycode encoding
(v0_mangle_item): Likewise.
* lex/rust-lex.cc (assert_source_content): Change type
(test_buffer_input_source): Change type
(test_file_input_source): Change type
* resolve/rust-ast-resolve-toplevel.h: fix typo
* rust-session-manager.cc (Session::load_extern_crate): fix typo
* util/rust-canonical-path.h: fix typo
* util/rust-hir-map.cc (NodeMapping::get_error): fix typo
(Mappings::Mappings): fix typo
* util/rust-mapping-common.h (UNKNOWN_CREATENUM): fix typo
(UNKNOWN_CRATENUM): Change 0 to UINT32_MAX
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
This avoids a use-after-free when reaching the recursion limit.
gcc/rust/ChangeLog:
* expand/rust-macro-expand.h: Keep optional references for last_def
and last_invoc.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Store
optional references.
* rust-session-manager.cc (Session::expansion): Use tl::optional's APIs
for better checking.
|
|
gcc/rust/ChangeLog:
* lex/rust-lex.cc (assert_source_content): Fix namespace specifier
(test_buffer_input_source): Likewise.
(test_file_input_source): Likewise.
* lex/rust-lex.h: Move InputSource ...
* lex/rust-input-source.h: ... to here. (New file)
* lex/rust-token.cc (nfc_normalize_token_string): New function
* lex/rust-token.h (nfc_normalize_token_string): New function
* rust-lang.cc (run_rust_tests): Modify order of selftests.
* rust-session-manager.cc (validate_crate_name): Modify interface of Utf8String.
* util/rust-unicode.cc (lookup_cc): Modify codepoint_t typedef.
(lookup_recomp): Likewise.
(recursive_decomp_cano): Likewise.
(decomp_cano): Likewise.
(sort_cano): Likewise.
(compose_hangul): Likewise.
(assert_normalize): Likewise.
(Utf8String::nfc_normalize): New function.
* util/rust-unicode.h: Modify interface of Utf8String.
gcc/testsuite/ChangeLog:
* rust/compile/unicode_norm1.rs: New test.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-session-manager.cc
(Session::expansion): Use new `Early` name resolution 2.0 pass
|
|
gcc/rust/ChangeLog:
* lex/rust-codepoint.h: Add comment
* lex/rust-lex.h: New method to get decoded characters
* rust-session-manager.cc (validate_crate_name): Modify unicode check
(rust_crate_name_validation_test): Add testcases
* util/rust-unicode.h (RUST_UNICODE_H): New class Utf8String.
(class Utf8String): New class.
* util/rust-unicode.cc (binary_search_sorted_array): Add comment.
(recursive_decomp_cano): Add comment.
(recomp): Remove dead code.
(dump_string): Removed.
gcc/testsuite/ChangeLog:
* rust/compile/bad-crate-name.rs: Moved to...
* rust/compile/bad-crate-name1.rs: ...here.
* rust/compile/bad-crate-name2.rs: New test.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
Sized is implicitly applied to every generic type parameter apart from the
implicit Self type parameter on traits, as that would cause a recursive
bound and would make Traits unable to be appied to unsized types.
In order to keep everything happy this means we also need to support the
anti trait bound '?' so that Sized can be removed properly. The full Sized
rules are not completely implemented here. Slice's and Str's are currently
marked as Sized but there is a small regression here that looks like a more
general bug which should be fixed on its own as part of #2443. There is
a big testsuite update here to pull in the Sized lang item.
Note this lays the bound's ground work so we can start supporting Drop
trait properly which needs tackled very soon.
Fixes: #2375
Addresses: #2443
gcc/rust/ChangeLog:
* expand/rust-proc-macro.cc (literal_from_string): update Lexer constructor
(tokenstream_from_string): likewise
* lex/rust-lex.cc (Lexer::Lexer): likewise
* lex/rust-lex.h: pass through Linemap
* parse/rust-cfg-parser.cc (parse_cfg_option): likewise
* rust-session-manager.cc (Session::load_extern_crate): likewise
* typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait):
dont apply Sized on self
* typecheck/rust-hir-type-check-base.cc (TypeCheckBase::get_marker_predicate): new
* typecheck/rust-hir-type-check-base.h: add prototype
* typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::Resolve): apply Sized
(TypeResolveGenericParam::visit): likewise
* typecheck/rust-hir-type-check-type.h: update prototypes
* typecheck/rust-typecheck-context.cc: remove bad assertions
* typecheck/rust-tyty-bounds.cc (TypeBoundsProbe::assemble_sized_builtin): cleanup
(TypeCheckBase::get_predicate_from_bound): apply sized rules properly
* util/rust-hir-map.cc (Mappings::lookup_trait_item_lang_item): helpers
(Mappings::get_lang_item): likewise
* util/rust-hir-map.h: likewise
* util/rust-token-converter.cc (from_ident): update lexer ctor
(from_punct): likewise
gcc/testsuite/ChangeLog:
* rust/compile/bounds1.rs: Apply sized trait
* rust/compile/canonical_paths1.rs: likewise
* rust/compile/cast_generics.rs: likewise
* rust/compile/closure_no_type_anno.rs: likewise
* rust/compile/complex_qualified_path_in_expr.rs: likewise
* rust/compile/const-issue1440.rs: likewise
* rust/compile/const_generics_1.rs: likewise
* rust/compile/const_generics_8.rs: likewise
* rust/compile/derive_macro1.rs: likewise
* rust/compile/derive_macro3.rs: likewise
* rust/compile/derive_macro4.rs: likewise
* rust/compile/derive_macro6.rs: likewise
* rust/compile/expected_type_args2.rs: likewise
* rust/compile/expected_type_args3.rs: likewise
* rust/compile/generics1.rs: likewise
* rust/compile/generics11.rs: likewise
* rust/compile/generics12.rs: likewise
* rust/compile/generics2.rs: likewise
* rust/compile/generics3.rs: likewise
* rust/compile/generics4.rs: likewise
* rust/compile/generics6.rs: likewise
* rust/compile/generics7.rs: likewise
* rust/compile/generics8.rs: likewise
* rust/compile/if_let_expr.rs: likewise
* rust/compile/issue-1005.rs: likewise
* rust/compile/issue-1019.rs: likewise
* rust/compile/issue-1031.rs: likewise
* rust/compile/issue-1034.rs: likewise
* rust/compile/issue-1128.rs: likewise
* rust/compile/issue-1129-2.rs: likewise
* rust/compile/issue-1130.rs: likewise
* rust/compile/issue-1131.rs: likewise
* rust/compile/issue-1165.rs: likewise
* rust/compile/issue-1173.rs: likewise
* rust/compile/issue-1235.rs: likewise
* rust/compile/issue-1237.rs: likewise
* rust/compile/issue-1289.rs: likewise
* rust/compile/issue-1383.rs: likewise
* rust/compile/issue-1447.rs: likewise
* rust/compile/issue-1589.rs: likewise
* rust/compile/issue-1725-1.rs: likewise
* rust/compile/issue-1725-2.rs: likewise
* rust/compile/issue-1773.rs: likewise
* rust/compile/issue-1786.rs: likewise
* rust/compile/issue-1893.rs: likewise
* rust/compile/issue-1901.rs: likewise
* rust/compile/issue-1930.rs: likewise
* rust/compile/issue-1981.rs: likewise
* rust/compile/issue-2019-1.rs: likewise
* rust/compile/issue-2019-2.rs: likewise
* rust/compile/issue-2019-3.rs: likewise
* rust/compile/issue-2036.rs: likewise
* rust/compile/issue-2037.rs: likewise
* rust/compile/issue-2070.rs: likewise
* rust/compile/issue-2105.rs: likewise
* rust/compile/issue-2106.rs: likewise
* rust/compile/issue-2135.rs: likewise
* rust/compile/issue-2136-1.rs: likewise
* rust/compile/issue-2136-2.rs: likewise
* rust/compile/issue-2139.rs: likewise
* rust/compile/issue-2142.rs: likewise
* rust/compile/issue-2165.rs: likewise
* rust/compile/issue-2166.rs: likewise
* rust/compile/issue-2190-1.rs: likewise
* rust/compile/issue-2190-2.rs: likewise
* rust/compile/issue-2195.rs: likewise
* rust/compile/issue-2238.rs: likewise
* rust/compile/issue-2304.rs: likewise
* rust/compile/issue-850.rs: likewise
* rust/compile/issue-855.rs: likewise
* rust/compile/issue-925.rs: likewise
* rust/compile/macro-issue1400.rs: likewise
* rust/compile/macro20.rs: likewise
* rust/compile/macro23.rs: likewise
* rust/compile/macro40.rs: likewise
* rust/compile/macro54.rs: likewise
* rust/compile/name_resolution2.rs: likewise
* rust/compile/name_resolution4.rs: likewise
* rust/compile/nested_generic.rs: likewise
* rust/compile/parse_associated_type_as_generic_arg.rs: likewise
* rust/compile/parse_associated_type_as_generic_arg2.rs: likewise
* rust/compile/parse_associated_type_as_generic_arg3.rs: likewise
* rust/compile/parse_complex_generic_application.rs: likewise
* rust/compile/parse_complex_generic_application2.rs: likewise
* rust/compile/path_as_generic_arg.rs: likewise
* rust/compile/privacy4.rs: likewise
* rust/compile/privacy6.rs: likewise
* rust/compile/sizeof-stray-infer-var-bug.rs: likewise
* rust/compile/stmt_with_block_dot.rs: likewise
* rust/compile/torture/associated_types1.rs: likewise
* rust/compile/torture/forward_decl_5.rs: likewise
* rust/compile/torture/generics1.rs: likewise
* rust/compile/torture/generics10.rs: likewise
* rust/compile/torture/generics11.rs: likewise
* rust/compile/torture/generics12.rs: likewise
* rust/compile/torture/generics13.rs: likewise
* rust/compile/torture/generics14.rs: likewise
* rust/compile/torture/generics15.rs: likewise
* rust/compile/torture/generics16.rs: likewise
* rust/compile/torture/generics17.rs: likewise
* rust/compile/torture/generics18.rs: likewise
* rust/compile/torture/generics19.rs: likewise
* rust/compile/torture/generics2.rs: likewise
* rust/compile/torture/generics20.rs: likewise
* rust/compile/torture/generics21.rs: likewise
* rust/compile/torture/generics22.rs: likewise
* rust/compile/torture/generics23.rs: likewise
* rust/compile/torture/generics24.rs: likewise
* rust/compile/torture/generics25.rs: likewise
* rust/compile/torture/generics26.rs: likewise
* rust/compile/torture/generics27.rs: likewise
* rust/compile/torture/generics28.rs: likewise
* rust/compile/torture/generics29.rs: likewise
* rust/compile/torture/generics3.rs: likewise
* rust/compile/torture/generics30.rs: likewise
* rust/compile/torture/generics31.rs: likewise
* rust/compile/torture/generics32.rs: likewise
* rust/compile/torture/generics4.rs: likewise
* rust/compile/torture/generics5.rs: likewise
* rust/compile/torture/generics6.rs: likewise
* rust/compile/torture/generics7.rs: likewise
* rust/compile/torture/generics8.rs: likewise
* rust/compile/torture/generics9.rs: likewise
* rust/compile/torture/intrinsics-2.rs: likewise
* rust/compile/torture/intrinsics-6.rs: likewise
* rust/compile/torture/intrinsics-7.rs: likewise
* rust/compile/torture/intrinsics-8.rs: likewise
* rust/compile/torture/issue-1024.rs: likewise
* rust/compile/torture/issue-1075.rs: likewise
* rust/compile/torture/issue-1432.rs: likewise
* rust/compile/torture/issue-1555.rs: likewise
* rust/compile/torture/issue-368.rs: likewise
* rust/compile/torture/issue-808.rs: likewise
* rust/compile/torture/issue-862.rs: likewise
* rust/compile/torture/issue-893-2.rs: likewise
* rust/compile/torture/issue-893.rs: likewise
* rust/compile/torture/must_use2.rs: likewise
* rust/compile/torture/nested_fn2.rs: likewise
* rust/compile/torture/phantom_data.rs: likewise
* rust/compile/torture/range-lang-item1.rs: likewise
* rust/compile/torture/traits1.rs: likewise
* rust/compile/torture/traits11.rs: likewise
* rust/compile/torture/traits12.rs: likewise
* rust/compile/torture/traits13.rs: likewise
* rust/compile/torture/traits14.rs: likewise
* rust/compile/torture/traits15.rs: likewise
* rust/compile/torture/traits16.rs: likewise
* rust/compile/torture/traits17.rs: likewise
* rust/compile/torture/traits18.rs: likewise
* rust/compile/torture/traits19.rs: likewise
* rust/compile/torture/traits2.rs: likewise
* rust/compile/torture/traits3.rs: likewise
* rust/compile/torture/traits4.rs: likewise
* rust/compile/torture/traits5.rs: likewise
* rust/compile/torture/traits6.rs: likewise
* rust/compile/torture/traits7.rs: likewise
* rust/compile/torture/traits8.rs: likewise
* rust/compile/torture/traits9.rs: likewise
* rust/compile/torture/transmute-size-check-1.rs: likewise
* rust/compile/torture/transmute1.rs: likewise
* rust/compile/torture/uninit-intrinsic-1.rs: likewise
* rust/compile/torture/utf8_identifiers.rs: likewise
* rust/compile/traits1.rs: likewise
* rust/compile/traits10.rs: likewise
* rust/compile/traits11.rs: likewise
* rust/compile/traits12.rs: likewise
* rust/compile/traits2.rs: likewise
* rust/compile/traits3.rs: likewise
* rust/compile/traits4.rs: likewise
* rust/compile/traits5.rs: likewise
* rust/compile/traits6.rs: likewise
* rust/compile/traits7.rs: likewise
* rust/compile/traits8.rs: likewise
* rust/compile/traits9.rs: likewise
* rust/compile/type-bindings1.rs: likewise
* rust/compile/unconstrained_type_param.rs: likewise
* rust/compile/unsafe10.rs: likewise
* rust/execute/torture/closure1.rs: likewise
* rust/execute/torture/closure2.rs: likewise
* rust/execute/torture/closure3.rs: likewise
* rust/execute/torture/closure4.rs: likewise
* rust/execute/torture/coercion1.rs: likewise
* rust/execute/torture/coercion2.rs: likewise
* rust/execute/torture/coercion3.rs: likewise
* rust/execute/torture/copy_nonoverlapping1.rs: likewise
* rust/execute/torture/derive_macro1.rs: likewise
* rust/execute/torture/derive_macro3.rs: likewise
* rust/execute/torture/derive_macro4.rs: likewise
* rust/execute/torture/index1.rs: likewise
* rust/execute/torture/issue-1120.rs: likewise
* rust/execute/torture/issue-1133.rs: likewise
* rust/execute/torture/issue-1198.rs: likewise
* rust/execute/torture/issue-1232.rs: likewise
* rust/execute/torture/issue-1249.rs: likewise
* rust/execute/torture/issue-1436.rs: likewise
* rust/execute/torture/issue-1496.rs: likewise
* rust/execute/torture/issue-1720-2.rs: likewise
* rust/execute/torture/issue-1720.rs: likewise
* rust/execute/torture/issue-2052.rs: likewise
* rust/execute/torture/issue-2179.rs: likewise
* rust/execute/torture/issue-2180.rs: likewise
* rust/execute/torture/issue-2236.rs: likewise
* rust/execute/torture/issue-647.rs: likewise
* rust/execute/torture/issue-845.rs: likewise
* rust/execute/torture/issue-851.rs: likewise
* rust/execute/torture/issue-858.rs: likewise
* rust/execute/torture/macros23.rs: likewise
* rust/execute/torture/macros28.rs: likewise
* rust/execute/torture/method2.rs: likewise
* rust/execute/torture/method3.rs: likewise
* rust/execute/torture/method4.rs: likewise
* rust/execute/torture/operator_overload_1.rs: likewise
* rust/execute/torture/operator_overload_10.rs: likewise
* rust/execute/torture/operator_overload_11.rs: likewise
* rust/execute/torture/operator_overload_12.rs: likewise
* rust/execute/torture/operator_overload_2.rs: likewise
* rust/execute/torture/operator_overload_3.rs: likewise
* rust/execute/torture/operator_overload_4.rs: likewise
* rust/execute/torture/operator_overload_5.rs: likewise
* rust/execute/torture/operator_overload_6.rs: likewise
* rust/execute/torture/operator_overload_7.rs: likewise
* rust/execute/torture/operator_overload_8.rs: likewise
* rust/execute/torture/operator_overload_9.rs: likewise
* rust/execute/torture/prefetch_data.rs: likewise
* rust/execute/torture/ref-pattern2.rs: likewise
* rust/execute/torture/slice-magic.rs: likewise
* rust/execute/torture/slice-magic2.rs: likewise
* rust/execute/torture/slice1.rs: likewise
* rust/execute/torture/str-layout1.rs: likewise
* rust/execute/torture/trait1.rs: likewise
* rust/execute/torture/trait10.rs: likewise
* rust/execute/torture/trait11.rs: likewise
* rust/execute/torture/trait12.rs: likewise
* rust/execute/torture/trait13.rs: likewise
* rust/execute/torture/trait2.rs: likewise
* rust/execute/torture/trait3.rs: likewise
* rust/execute/torture/trait4.rs: likewise
* rust/execute/torture/trait5.rs: likewise
* rust/execute/torture/trait6.rs: likewise
* rust/execute/torture/trait7.rs: likewise
* rust/execute/torture/trait8.rs: likewise
* rust/execute/torture/trait9.rs: likewise
* rust/execute/torture/transmute1.rs: likewise
* rust/execute/torture/wrapping_op1.rs: likewise
* rust/execute/torture/wrapping_op2.rs: likewise
* rust/link/generic_function_0.rs: likewise
* rust/link/generic_function_1.rs: likewise
* rust/compile/issue-2375.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Create a mapping for procedural macros with their crate num.
gcc/rust/ChangeLog:
* metadata/rust-extern-crate.h: Add proc macro getter.
* rust-session-manager.cc (Session::load_extern_crate): Collect
mappings and create mappings.
* util/rust-hir-map.cc: Add insertion and lookup functions for
every mapping.
* util/rust-hir-map.h: Add function prototypes.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Replace Stream raw pointer with a smart pointer.
gcc/rust/ChangeLog:
* metadata/rust-import-archive.cc (Stream_concatenate::do_peek):
Remove deletion.
(Stream_concatenate::do_advance): Likewise.
(Import::find_archive_export_data): Replace with a smart
pointer.
* metadata/rust-imports.cc (add_search_path): Change return type
to smart pointer.
(Import::open_package): Likewise.
(Import::try_package_in_directory): Likewise.
(Import::find_export_data): Likewise.
(Import::find_object_export_data): Likewise.
(Import::Import): Change constructor to accept unique_ptr.
* metadata/rust-imports.h: Change constructor prototype.
* rust-session-manager.cc (Session::load_extern_crate): Change
pointer to smart pointer.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Store procedural macro data in extern crate node.
gcc/rust/ChangeLog:
* metadata/rust-extern-crate.cc (ExternCrate::ExternCrate):
Change constructor to accept procedural macro vector.
* metadata/rust-extern-crate.h: Add vector of procecural macro
in extern crate.
* rust-session-manager.cc (Session::load_extern_crate): Add
argument to new constructor call.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Also return a vector of proc macros when trying to open an external
crate.
gcc/rust/ChangeLog:
* metadata/rust-imports.cc (add_search_path): Change prototype,
now return a pair of Stream and procedural macro vector.
(Import::open_package): Likewise.
(Import::try_package_in_directory): Likewise.
* metadata/rust-imports.h: Likewise.
* rust-session-manager.cc (Session::load_extern_crate):
Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
This commit add the ability to specify the path to an extern crate
through the -frust-extern cli option. Path given as cli argument
shall resolve to the exact extern crate location.
gcc/rust/ChangeLog:
* metadata/rust-imports.h: Make the function to load a given
file public.
* rust-session-manager.cc (Session::load_extern_crate): Change
path resolution depending on extern crate declaration in cli
arguments.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add a new option to crab1 cli to accept crate type. This version of the
argument only accept a single crate type. Rustc accepts a comma
separated list of crate types but this might require a litle more work
for gcc.
gcc/rust/ChangeLog:
* lang.opt: Add option
* rust-session-manager.cc: Add option registration in session
target options.
* rust-session-manager.h (struct CompileOptions): Add new getter
for proc macros instead of a boolean.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc: Replace Location with location_t.
* ast/rust-ast.cc: Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.cc: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-base.cc: Likewise.
* backend/rust-compile-base.h: Likewise.
* backend/rust-compile-block.cc: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-expr.h: Likewise.
* backend/rust-compile-fnparam.cc: Likewise.
* backend/rust-compile-fnparam.h: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-pattern.cc: Likewise.
* backend/rust-compile-resolve-path.h: Likewise.
* backend/rust-compile.cc: Likewise.
* checks/errors/rust-const-checker.cc: Likewise.
* checks/errors/rust-const-checker.h: Likewise.
* checks/errors/rust-unsafe-checker.cc: Likewise.
* checks/errors/rust-unsafe-checker.h: Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* expand/rust-macro-expand.h: Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-pattern.h: Likewise.
* hir/tree/rust-hir-stmt.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.cc: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-token.h: Likewise.
* metadata/rust-extern-crate.cc: Likewise.
* metadata/rust-extern-crate.h: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-expr.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-name-resolver.cc: Likewise.
* resolve/rust-name-resolver.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-gcc.cc: Likewise.
* rust-session-manager.cc: Likewise.
* rust-session-manager.h: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-casts.h: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-coercion.h: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-trait-reference.h: Likewise.
* typecheck/rust-hir-trait-resolve.cc: Likewise.
* typecheck/rust-hir-type-check-base.cc: Likewise.
* typecheck/rust-hir-type-check-base.h: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-item.h: Likewise.
* typecheck/rust-hir-type-check-path.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.h: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-hir-type-check-type.h: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-hir-type-check.h: Likewise.
* typecheck/rust-substitution-mapper.cc: Likewise.
* typecheck/rust-substitution-mapper.h: Likewise.
* typecheck/rust-type-util.cc: Likewise.
* typecheck/rust-typecheck-context.cc: Likewise.
* typecheck/rust-tyty-bounds.cc: Likewise.
* typecheck/rust-tyty-call.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty-subst.h: Likewise.
* typecheck/rust-tyty-util.cc: Likewise.
* typecheck/rust-tyty-util.h: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-tyty.h: Likewise.
* typecheck/rust-unify.cc: Likewise.
* typecheck/rust-unify.h: Likewise.
* util/rust-hir-map.cc: Likewise.
* util/rust-hir-map.h: Likewise.
* util/rust-identifier.h: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-location.h
(typedef RichLocation): Remove.
* expand/rust-macro-expand.cc: Replace RichLocation with rich_location.
* hir/rust-ast-lower-base.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-unify.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-linemap.cc
(RichLocation::RichLocation): Remove.
(RichLocation::~RichLocation): Remove.
(RichLocation::add_range): Remove.
(RichLocation::add_fixit_insert_before): Remove.
(RichLocation::add_fixit_insert_after): Remove.
* rust-location.h
(class RichLocation): Remove.
* rust-diagnostics.cc
(rust_be_error_at): Remove RichLocation::get invocation.
* expand/rust-macro-expand.cc: Fix RichLocation constructor.
* hir/rust-ast-lower-base.cc: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-casts.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-inherent-impl-overlap.h: Likewise.
* typecheck/rust-hir-path-probe.h: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-item.cc: Likewise.
* typecheck/rust-hir-type-check-pattern.cc: Likewise.
* typecheck/rust-tyty-cmp.h: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* typecheck/rust-unify.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* lex/rust-lex.cc
(Lexer::get_current_location): Use linemap_position_for_column.
* rust-session-manager.cc
(Session::handle_crate_name): Likewise.
* rust-linemap.cc
(Linemap::get_location): Remove.
* rust-linemap.h
(Linemap::get_location): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* Make-lang.in: Remove rust-optional-test.cc's object file
* ast/rust-macro.h: Remove use of Rust::Optional
* backend/rust-compile-base.cc
(HIRCompileBase::resolve_method_address): Likewise.
* checks/errors/privacy/rust-privacy-reporter.cc
(PrivacyReporter::check_for_privacy_violation): Likewise.
(PrivacyReporter::visit): Likewise.
* checks/errors/privacy/rust-privacy-reporter.h: Likewise.
* checks/errors/rust-feature-gate.cc (FeatureGate::check): Likewise.
* checks/errors/rust-feature.cc (Feature::create): Likewise.
(Feature::as_name): Likewise.
* checks/errors/rust-feature.h: Likewise.
* expand/rust-macro-builtins.cc: Likewise.
* lex/rust-lex.cc (Lexer::Lexer): Likewise.
(Lexer::skip_token): Likewise.
(Lexer::dump_and_skip): Likewise.
* lex/rust-lex.h: Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise.
* rust-lang.cc (run_rust_tests): Likewise.
* rust-session-manager.cc (Session::compile_crate): Likewise.
(TargetOptions::dump_target_options): Likewise.
* rust-session-manager.h (struct TargetOptions): Likewise.
* util/rust-hir-map.cc (Mappings::lookup_module_children): Likewise.
(Mappings::lookup_module_chidren_items): Likewise.
(Mappings::lookup_module_child): Likewise.
(Mappings::lookup_parent_module): Likewise.
* util/rust-hir-map.h (RUST_HIR_MAP_H): Likewise.
* util/rust-optional-test.cc: Removed.
* util/rust-optional.h: Removed.
|
|
gcc/rust/ChangeLog:
* rust-linemap.h (Linemap::unknown_location): Remove.
* ast/rust-ast.cc:
Replace Linemap::unknown_location with UNKNOWN_LOCATION.
* ast/rust-path.cc: Likewise.
* hir/tree/rust-hir.cc: Likewise.
* metadata/rust-imports.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* rust-backend.h: Likewise.
* rust-diagnostics.cc: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* rust-location.h (UNDEF_LOCATION): New.
* ast/rust-ast-collector.cc: Replace Location () with UNDEF_LOCATION.
* ast/rust-ast-fragment.cc: Likewise.
* ast/rust-ast.h: Likewise.
* ast/rust-expr.h: Likewise.
* ast/rust-item.h: Likewise.
* ast/rust-macro.h: Likewise.
* ast/rust-path.h: Likewise.
* ast/rust-type.h: Likewise.
* backend/rust-compile-expr.cc: Likewise.
* backend/rust-compile-extern.h: Likewise.
* backend/rust-compile-implitem.h: Likewise.
* backend/rust-compile-intrinsic.cc: Likewise.
* backend/rust-compile-item.h: Likewise.
* backend/rust-compile.cc: Likewise.
* backend/rust-constexpr.cc: Likewise.
* expand/rust-expand-visitor.cc: Likewise.
* expand/rust-macro-expand.cc: Likewise.
* expand/rust-macro-expand.h: Likewise.
* expand/rust-macro-invoc-lexer.cc: Likewise.
* expand/rust-proc-macro-invoc-lexer.cc: Likewise.
* expand/rust-proc-macro.cc: Likewise.
* hir/tree/rust-hir-expr.h: Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-path.h: Likewise.
* hir/tree/rust-hir-type.h: Likewise.
* hir/tree/rust-hir.h: Likewise.
* lex/rust-lex.cc: Likewise.
* metadata/rust-export-metadata.cc: Likewise.
* parse/rust-parse-impl.h: Likewise.
* resolve/rust-ast-resolve-item.cc: Likewise.
* resolve/rust-ast-resolve.cc: Likewise.
* rust-diagnostics.h: Likewise.
* rust-session-manager.cc: Likewise.
* typecheck/rust-autoderef.cc: Likewise.
* typecheck/rust-coercion.cc: Likewise.
* typecheck/rust-hir-dot-operator.cc: Likewise.
* typecheck/rust-hir-path-probe.cc: Likewise.
* typecheck/rust-hir-trait-reference.cc: Likewise.
* typecheck/rust-hir-trait-reference.h: Likewise.
* typecheck/rust-hir-type-check-expr.cc: Likewise.
* typecheck/rust-hir-type-check-implitem.cc: Likewise.
* typecheck/rust-hir-type-check-type.cc: Likewise.
* typecheck/rust-hir-type-check.cc: Likewise.
* typecheck/rust-tyty-bounds.cc: Likewise.
* typecheck/rust-tyty-subst.cc: Likewise.
* typecheck/rust-tyty.cc: Likewise.
* util/rust-hir-map.cc: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* lex/rust-lex.cc (Lexer::input_source_is_valid_utf8): New method of `Lexer`.
* lex/rust-lex.h: Likewise.
* rust-session-manager.cc (Session::compile_crate): Add error.
gcc/testsuite/ChangeLog:
* rust/compile/broken_utf8.rs: New test.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
This dump will soon replace ast-pretty print and is hence no longer
required.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::enable_dump): Remove
tokenstream dump.
(Session::compile_crate): Likewise.
(Session::dump_tokenstream): Likewise.
* rust-session-manager.h (struct CompileOptions): Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
fixes https://github.com/Rust-GCC/gccrs/issues/2020
gcc/rust/ChangeLog:
* typecheck/rust-tycheck-dump.h: Delete this file
* rust-session-manager.cc: Remove `Session::dump_type_resolution`
and `TYPE_RESOLUTION_DUMP`
* rust-session-manager.h: Likewise
Signed-off-by: Taiwei Wu tieway59@foxmail.com
|
|
Add a first draft for derive proc macros based on the attribute expander
code. Convert the result back to a parsable entity and parse it.
The procedural macro expander was beginning to require almost all
functionalities already provided by the macro expander, hence the merge.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.h: Update enum name to match
definition.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_derive):
Add call to expander.
(ExpandVisitor::expand_outer_attribute):
Change call to macro expander.
(ExpandVisitor::expand_inner_attribute): Likewise.
* expand/rust-expand-visitor.h: Remove const attribute to match
visitor declaration. Attach result to the AST. Add condition for
item erasure.
* expand/rust-proc-macro.h: Add token collector and expansion
call. Add lexers and parsers for each proc macro type and uses
them to parse macro output.
* expand/rust-macro-expand.h (struct MacroExpander): Add
functions.
* expand/rust-proc-macro.cc (ProcMacroExpander::import_proc_macros):
Moved from here...
* expand/rust-macro-expand.cc (MacroExpander::import_proc_macros):
... to here. Unify procedural macro parsing under one function.
Add a flag to determine whether it originate from a derive
macro.
(MacroExpander::parse_procmacro_output):
Parse macro output to statements. Store an error on parsing
failure.
* Make-lang.in: Add const_TokenPtr specific lexer.
* expand/rust-proc-macro-invoc-lexer.cc: New file.
* expand/rust-proc-macro-invoc-lexer.h: New file.
* rust-session-manager.cc (Session::expansion): Remove
ProcMacroExpander declaration.
* ast/rust-ast-fragment.cc (Fragment::Fragment): Add overwrite
flag.
(Fragment::should_overwrite): Add a getter to determine whether
the fragment shall overwrite it's parent or be appended after.
* ast/rust-ast-fragment.h: Add flag to declaration.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add containers and functions to the hir-map in order to register and
lookup all three kind of procedural macros.
Add a first draft for attribute procedural macro expansion. This
expander still lack proper error handling as well as polishing.
gcc/rust/ChangeLog:
* util/rust-hir-map.cc (Mappings::insert_bang_proc_macro):
Add a function to insert a new bang proc macro.
(Mappings::lookup_bang_proc_macro): Add a function to lookup a
bang procedural macro.
(Mappings::insert_derive_proc_macro): Add a function to insert a
derive procedural macro.
(Mappings::lookup_derive_proc_macro): Add a function to lookup a
derive procedural macro.
(Mappings::insert_attribute_proc_macro): Add a function to
insert an attribute procedural macro.
(Mappings::lookup_attribute_proc_macro): Add a function to
lookup an attribute procedural macro.
* util/rust-hir-map.h: Add function prototypes.
* expand/rust-expand-visitor.cc (ExpandVisitor::expand_outer_attribute):
Implement expansion of outer attributes.
(ExpandVisitor::expand_inner_attribute):
Add call for inner attribute expansion.
* expand/rust-expand-visitor.h:
Add new procedural macro expander attribute.
* expand/rust-proc-macro.cc (load_macros_array): Add a function
to load the proc macro array from a given shared object.
(load_macros): Add a function to retrieve procedural macro
vector from a given shared object.
(ProcMacroExpander::import_proc_macros): Add a function to load
procedural macros from a given extern crate name.
* expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Add new
proc-macro file.
(class ProcMacroExpander): Add new ProcMacroExpander class.
* rust-session-manager.cc (Session::expansion): Create new macro
expander and feed it to the expand visitor.
* util/rust-attributes.cc: Add macro_export builtin attribute.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* rust-session-manager.h:
Include "rust-optional.h".
(struct TargetOptions):
Store values in config key/value pairs as Optional<std::string> rather than std::string.
* rust-session-manager.cc
(TargetOptions::dump_target_options):
Handle Optional<std::string> values.
gcc/testsuite/ChangeLog:
* rust/compile/cfg6.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
The file does not contain any TokenStream declaration anymore and thus
should be named more appropriately.
gcc/rust/ChangeLog:
* Make-lang.in: Change file name.
* ast/rust-ast-tokenstream.cc: Moved to...
* ast/rust-ast-collector.cc: ...here.
* ast/rust-ast-tokenstream.h: Moved to...
* ast/rust-ast-collector.h: ...here.
* rust-session-manager.cc: Change header name.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Rename the TokenStream class to TokenCollector as it may induce errors
in the future as it is not a tokenstream as defined by the rust
interface. Furthermore this change match more closely the actual behavior
of the class.
gcc/rust/ChangeLog:
* ast/rust-ast-tokenstream.cc (TokenStream::TokenStream): Rename
TokenStream to TokenCollector.
(TokenCollector::TokenCollector): Likewise.
(TokenStream::collect_tokens): Likewise.
(TokenCollector::collect_tokens): Likewise.
(TokenStream::collect): Likewise.
(TokenCollector::collect): Likewise.
(TokenStream::visit): Likewise.
(TokenCollector::visit): Likewise.
(TokenStream::visit_items_joined_by_separator): Likewise.
(TokenCollector::visit_items_joined_by_separator): Likewise.
(TokenStream::visit_as_line): Likewise.
(TokenCollector::visit_as_line): Likewise.
(TokenStream::visit_items_as_lines): Likewise.
(TokenCollector::visit_items_as_lines): Likewise.
(TokenStream::visit_items_as_block): Likewise.
(TokenCollector::visit_items_as_block): Likewise.
(TokenStream::trailing_comma): Likewise.
(TokenCollector::trailing_comma): Likewise.
(TokenStream::newline): Likewise.
(TokenCollector::newline): Likewise.
(TokenStream::indentation): Likewise.
(TokenCollector::indentation): Likewise.
(TokenStream::increment_indentation): Likewise.
(TokenCollector::increment_indentation): Likewise.
(TokenStream::decrement_indentation): Likewise.
(TokenCollector::decrement_indentation): Likewise.
(TokenStream::visit_closure_common): Likewise.
(TokenCollector::visit_closure_common): Likewise.
(TokenStream::visit_loop_common): Likewise.
(TokenCollector::visit_loop_common): Likewise.
(TokenStream::visit_function_common): Likewise.
(TokenCollector::visit_function_common): Likewise.
* ast/rust-ast-tokenstream.h (class TokenStream): Likewise.
(class TokenCollector): Likewise.
* rust-session-manager.cc (Session::dump_tokenstream): Rename
token vector for clearer intent.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Add a new option to gather extern crates location.
gcc/rust/ChangeLog:
* lang.opt: Add frust-extern option.
* rust-session-manager.cc (Session::handle_extern_option): Add
frust-extern option handler.
* rust-session-manager.h (struct Session): Add an unordered map
to store library name and locations.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* rust-session-manager.cc
(Session::enable_dump): Fix error messages.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Fixes #2021, #2022
Deleted Parser::debug_dump_ast_output, removed any functions that called
it i.e Session::dump_ast and Session::dump_ast_expanded, and any
associated items.
Made it so that when you use the dump option "expanded" it dumps the
pretty ast only.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::debug_dump_ast_output): Removed this funtion.
* rust-session-manager.cc (Session::enable_dump): Removed else if (arg == "parse").
(Session::compile_crate): Removed calls of dump_ast and dump_ast_expanded.
(Session::dump_ast): Removed this function.
(Session::dump_ast_expanded): Removed this function.
* rust-session-manager.h (struct CompileOptions): Removed the PARSER_AST_DUMP option.
Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
|
|
Add an option to the command line interface to dump the ast back to a
tokenstream.
gcc/rust/ChangeLog:
* rust-session-manager.cc (Session::enable_dump): Enable new
dump.
(Session::compile_crate): CLI argument parsing.
(Session::dump_tokenstream): Dump the tokenstream as a string in
the specified file.
* rust-session-manager.h (struct CompileOptions): Add
tokenstream dump option.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Since the expansion and stripping phase are now separated, it does not
make sense to keep AttrVisitor named AttrVisitor. Furthermore, the visitor
is already very complex, with a heavy mental load (erasing iterators,
rearranging them, performing cfg-expansion, etc) so further attribute
handling should probably happen in rust-attribute-checker.h
gcc/rust/ChangeLog:
* Make-lang.in: Rename rust-asttribute-visitor.o -> rust-cfg-strip.o
* expand/rust-attribute-visitor.cc: Moved to...
* expand/rust-cfg-strip.cc: ...here.
* expand/rust-attribute-visitor.h: Moved to...
* expand/rust-cfg-strip.h: ...here.
* expand/rust-macro-expand.cc: Fix include of rust-attribute-visitor.h
* expand/rust-macro-builtins.cc: Likewise.
* rust-session-manager.cc (Session::expansion): Call CfgStrip instead of
AttrVisitor.
|