Commit graph

207949 commits

Author SHA1 Message Date
Raiki Tamura
06af44ece1 gccrs: Type annotation for make-unicode-data.py
gcc/rust/ChangeLog:

	* util/make-rust-unicode.py: Add type annotation

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-01-16 19:00:31 +01:00
Philip Herron
18464d32da gccrs: improve name mangling hash
We can endup with duplicate symbol names for different intrinsics with our
current hash setup. This adds in the mappings and extra info to improve
hash uniqueness.

Addresses #1895

gcc/rust/ChangeLog:

	* backend/rust-compile-intrinsic.cc (check_for_cached_intrinsic):
	simplify this cached intrinsic check
	* backend/rust-mangle.cc (legacy_mangle_item): use new interface
	* typecheck/rust-tyty.h: new managle helper

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16 19:00:31 +01:00
Philip Herron
4459962a83 gccrs: simplify matching possible candidates
We do extra checking after the fact here to ensure its a valid candidate
and in the case there is only one candidate lets just go for it.

Addresses #1895

gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc (HIRCompileBase::resolve_method_address):
	use the single candidate

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16 19:00:30 +01:00
Marc Poulhiès
aef47d7966 gccrs: Cleanup HIR dump
visit_field() correctly handles empty unique_ptr<> and displays "none".

gcc/rust/ChangeLog:

	* hir/rust-hir-dump.cc (Dump::visit): Remove useless if/else
	already handled by visit_field.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16 19:00:30 +01:00
Owen Avery
0ebb0a75b4 gccrs: Add missing CHECKING_P guard to rust-punycode.cc
gcc/rust/ChangeLog:

	* util/rust-punycode.cc: Add CHECKING_P guard.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:30 +01:00
Raiki Tamura
007940b753 gccrs: Fix legacy mangling to use Unicode escape
gcc/rust/ChangeLog:

	* backend/rust-mangle.cc (legacy_mangle_name): Use Unicode escape

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-01-16 19:00:30 +01:00
Philip Herron
237564fc08 gccrs: remove horrible hack in solving complex generics on impl blocks
We hit an assertion with range based iterators here. This code was used
to solve complex generics such as:

  struct Foo<X,Y>(X,Y);
  impl<T> Foo<T, i32> {
    fn test<Y>(self, a: Y) { }
  }

The impl item will have the signiture of:

  fn test<T,Y> (Foo<T, i32> self, a:Y)

So in the case where we have:

  let a = Foo(123f32, 456);
  a.test<bool>(true);

We need to solve the generic argument T from the impl block by infering the
arguments there and applying them so that when we apply the generic
argument bool we dont end up in the case of missing number of generics.

Addresses #1895

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): remove hack

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
2024-01-16 19:00:30 +01:00
Owen Avery
ce40be7683 gccrs: Use MacroInvocLexerBase in ProcMacroInvocLexer
gcc/rust/ChangeLog:

	* expand/rust-proc-macro-invoc-lexer.cc
	(ProcMacroInvocLexer::skip_token): Remove.
	* expand/rust-proc-macro-invoc-lexer.h:
	Include "rust-macro-invoc-lexer.h".
	(class ProcMacroInvocLexer):
	Extend MacroInvocLexerBase.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:30 +01:00
Raiki Tamura
5b47923fe5 gccrs: clean up Codepoint and InputSource
gcc/rust/ChangeLog:

	* lex/rust-codepoint.h: Moved to...
	* util/rust-codepoint.h: ...here.
	* lex/rust-input-source.h: Add missing license
	* util/rust-unicode.cc: Add missing license
	* util/rust-punycode.cc (extract_basic_string): Remove constant

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-01-16 19:00:30 +01:00
Arthur Cohen
1e288d66cb gccrs: macro-expand: Keep optional references to last_{def, invoc}
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.
2024-01-16 19:00:29 +01:00
Marc Poulhiès
fa6bba6f22 gccrs: Adjust HIR dump for IfExpr and IfExprConseqElse
Adjust the HIR dump for IfExpr and IfExprConseqElse
to use visit_field() and factor common part.

gcc/rust/ChangeLog:

	* hir/rust-hir-dump.h (do_ifexpr): New.
	* hir/rust-hir-dump.cc (Dump::do_ifexpr): New.
	(Dump::visit): Use do_ifexpr and visit_field

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16 19:00:29 +01:00
Muhammad Mahad
2952785b16 gccrs: [E0054/E0604/E0620/E0606] TypeCasting ErrorCodes
Added errorcodes according to different conditions
and updated error message according to type casting
type.

gcc/rust/ChangeLog:

	* typecheck/rust-casts.cc (TypeCastRules::emit_cast_error):
	Refactored ErrorCodes & error messages.

gcc/testsuite/ChangeLog:

	* rust/compile/bad_as_bool_char.rs:
	Updated comment to pass test case.
	* rust/compile/cast1.rs: likewise.
	* rust/compile/cast4.rs: likewise.
	* rust/compile/cast5.rs: likewise.
	* rust/compile/all-cast.rs: New test for all error codes.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:29 +01:00
Muhammad Mahad
2b20054948 gccrs: [E0541] Use of unknown meta item
gcc/rust/ChangeLog:

	* backend/rust-compile-base.cc:
	Added ErrorCode.

gcc/testsuite/ChangeLog:

	* rust/compile/attr_deprecated_2.rs:
	Updated comment to pass the testcase.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:29 +01:00
Muhammad Mahad
9f09284d8f gccrs: [E0703] Use of Invalid ABI
Added error code support for invalid ABI.

gcc/rust/ChangeLog:

	* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
	called error function.
	(ASTLoweringBase::lower_extern_block): likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/abi-options1.rs: updated comment for testcase.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:29 +01:00
Owen Avery
55cf783df8 gccrs: Basic formatting/comment fixes
gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc: Adjust formatting.
	* checks/errors/rust-feature-gate.cc: Add trailing newline.
	* rust-diagnostics.h: Remove old comment.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:29 +01:00
Owen Avery
b2234633dc gccrs: Remove unneeded references to "this" in backend methods
gcc/rust/ChangeLog:

	* rust-gcc.cc
	(Gcc_backend::struct_type): Remove references to "this".
	(Gcc_backend::union_type): Likewise.
	(Gcc_backend::array_type): Likewise.
	(Gcc_backend::wchar_constant_expression): Likewise.
	(Gcc_backend::convert_expression): Likewise.
	(Gcc_backend::constructor_expression): Likewise.
	(Gcc_backend::array_initializer): Likewise.
	(Gcc_backend::assignment_statement): Likewise.
	(Gcc_backend::global_variable): Likewise.
	(Gcc_backend::temporary_variable): Likewise.
	(Gcc_backend::function_defer_statement): Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:29 +01:00
Raiki Tamura
619f1874b0 gccrs: Add function Rust::encode_punycode
gcc/rust/ChangeLog:

	* Make-lang.in: Add rust-punycode.o.
	* rust-lang.cc (run_rust_tests): Add selftest.
	* util/rust-punycode.cc: New file.
	* util/rust-punycode.h: New file.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-01-16 19:00:29 +01:00
Muhammad Mahad
c24d0e9033 gccrs: [E0308] array misamatch types
gcc/rust/ChangeLog:

	* backend/rust-compile.cc (HIRCompileBase::verify_array_capacities):
	Added ErrorCode.

gcc/testsuite/ChangeLog:

	* rust/compile/arrays2.rs: changed comment to pass
	testcase.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:29 +01:00
Muhammad Mahad
f26df74ce3 gccrs: [E0282] type annotations needed
type must be known at compile time.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check.cc (TypeResolution::Resolve):
	added errorcode.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:28 +01:00
Owen Avery
77fbe55f8e gccrs: Move Backend::error_variable to Bvariable::error_variable
gcc/rust/ChangeLog:

	* rust-backend.h
	(Backend::error_variable): Remove.
	(Gcc_backend::error_variable): Move to ...
	* rust-gcc.cc
	(Bvariable::error_variable): ... here ...
	* rust-gcc.h
	(Bvariable::error_variable): ... and declare here.
	(Gcc_backend::global_variable): Update error_variable call.
	(Gcc_backend::local_variable): Likewise.
	(Gcc_backend::parameter_variable): Likewise.
	(Gcc_backend::static_chain_variable): Likewise.
	(Gcc_backend::temporary_variable): Likewise.
	* backend/rust-compile-extern.h
	(CompileExternItem::visit): Likewise.
	* backend/rust-compile-fnparam.cc
	(CompileFnParam::CompileFnParam): Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:28 +01:00
Owen Avery
79b52e6956 gccrs: Remove Backend::bool_type and Backend::char_type
gcc/rust/ChangeLog:

	* backend/rust-compile-type.cc
	(TyTyResolveCompile::visit): Inline Backend::bool_type call.
	* rust-backend.h
	(Backend::bool_type): Remove.
	(Backend::char_type): Remove.
	(Gcc_backend::bool_type): Remove.
	(Gcc_backend::char_type): Remove.
	* rust-gcc.cc
	(Gcc_backend::char_constant_expression): Inline Backend::char_type call.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 19:00:28 +01:00
Raiki Tamura
fadf5f5994 gccrs: Normalize all identifier tokens
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>
2024-01-16 19:00:28 +01:00
Muhammad Mahad
c75db430f0 gccrs: [E0412] used type name not in scope
gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go):
	Added ErrorCode.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:28 +01:00
Pierre-Emmanuel Patry
5249b87d9a gccrs: Fix a warning about extra semicolon
This semicolon produces several warning in each TU the header file is
included in.

gcc/rust/ChangeLog:

	* util/rust-common.h (enum_to_str): Remove extra semicolon after
	the function.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16 19:00:28 +01:00
Muhammad Mahad
a60bafec5a gccrs: [E0658] Unstable langauge feature
gcc/rust/ChangeLog:

	* checks/errors/rust-const-checker.cc (ConstChecker::visit):
	Use of mutable reference in constant functions.
	* checks/errors/rust-feature-gate.cc (FeatureGate::gate):
	ErrorCode for intrinsics are subject to change.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:28 +01:00
Muhammad Mahad
9e208648cb gccrs: [E0015] Use of non-const inside const
gcc/rust/ChangeLog:

	* checks/errors/rust-const-checker.cc (ConstChecker::check_function_call):
	Added errorcode.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:28 +01:00
Muhammad Mahad
24fe3afef2 gccrs: [E0107] Wrong number of generic argument
gcc/rust/ChangeLog:

	* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_mappings_from_generic_args):
	Added errorcode.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:28 +01:00
Arthur Cohen
e99ee91a95 gccrs: nr2.0: Add macros 2.0 resolution testcase.
gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution10.rs: New test.
2024-01-16 19:00:28 +01:00
Arthur Cohen
8ea51b5c81 gccrs: nr2.0: Add macros 2.0 in Ribs in TopLevel visitor
gcc/rust/ChangeLog:

	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Declare
	macros in the current rib if they are macros 2.0.
2024-01-16 19:00:27 +01:00
Arthur Cohen
c2ea7f6f36 gccrs: ast: Add get_kind method to MacroRulesDefinition
gcc/rust/ChangeLog:

	* ast/rust-macro.h: Add new method to `MacroRulesDefinition` to allow
	getting the `MacroKind` contained.
2024-01-16 19:00:27 +01:00
Arthur Cohen
44ec7404b9 gccrs: nr2.0: Add complex macro name resolution test cases
gcc/testsuite/ChangeLog:

	* rust/compile/name_resolution6.rs: New test.
	* rust/compile/name_resolution7.rs: New test.
	* rust/compile/name_resolution8.rs: New test.
	* rust/compile/name_resolution9.rs: New test.
2024-01-16 19:00:27 +01:00
Arthur Cohen
301e59b864 gccrs: session-manager: Run name resolution 2.0 if the option is present
gcc/rust/ChangeLog:

	* rust-session-manager.cc
	(Session::expansion): Use new `Early` name resolution 2.0 pass
2024-01-16 19:00:27 +01:00
Arthur Cohen
f7084d4872 gccrs: nr2.0: Add Early name resolution visitor
This visitor takes care of resolving macro invocations, procedural macros
and imports - it is used in conjunction with the `TopLevel` pass and
the macro expander.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-early-name-resolver-2.0.cc: New file.
	* resolve/rust-early-name-resolver-2.0.h: New file.
2024-01-16 19:00:27 +01:00
Arthur Cohen
2bde73fa46 gccrs: nr2.0: Visit receiver/call expression and arguments in calls/methods
gcc/rust/ChangeLog:

	* resolve/rust-default-resolver.cc
	(DefaultResolver::visit): Visit CallExpr and MethodCallExpr properly.
	* resolve/rust-default-resolver.h: Switch "node" to plural in documentation.
2024-01-16 19:00:27 +01:00
Arthur Cohen
3a5a74d917 gccrs: toplevel: Handle macro definitions properly
gcc/rust/ChangeLog:

	* resolve/rust-toplevel-name-resolver-2.0.cc
	(TopLevel::insert_or_error_out): Fix format string.
	(is_macro_export): New method.
	(TopLevel::visit): Handle macro definitions.
2024-01-16 19:00:27 +01:00
Arthur Cohen
d3d006d6b0 gccrs: resolver: Resolve macros too.
gcc/rust/ChangeLog:

	* resolve/rust-name-resolution-context.cc
	(Resolver::insert): Do not call into `rust_unreachable` when resolving
	macros anymore.
2024-01-16 19:00:27 +01:00
Arthur Cohen
79d8fb09c6 gccrs: forever stack: Add path resolution
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h
	(insert_at_root): New method.
	(resolve_path): New method.
	(reverse_iter): Iterate on `Node`s instead of `Rib`s
	* resolve/rust-forever-stack.hxx: Add path resolution.
2024-01-16 19:00:27 +01:00
Arthur Cohen
5a0e099e89 gccrs: rib2.0: Add shadowing
gcc/rust/ChangeLog:

	* resolve/rust-rib.h: Add shadowing parameter. Make kind field public.
	* resolve/rust-rib.cc (Rib::insert): Likewise.
2024-01-16 19:00:26 +01:00
Muhammad Mahad
7c10950f54 gccrs: [E0426] Use of undeclared label
Refactored error message to print more
userfriendly message and added error
code.

gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit):
	refactored message and called error function.

gcc/testsuite/ChangeLog:

	* rust/compile/undeclared_label.rs: New test for E0426.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:26 +01:00
Muhammad Mahad
f0193accb7 gccrs: [E0635] Use of Unknown feature.
Added ErrorCode support for use of unknown
feature.

gcc/rust/ChangeLog:

	* checks/errors/rust-feature-gate.cc (FeatureGate::check):
	errorcode support for unknown feature.

gcc/testsuite/ChangeLog:

	* rust/compile/feature.rs: Added new unknown feature.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:26 +01:00
Muhammad Mahad
5db4f84f88 gccrs: [E0308] mismatch types on assignment
This errorcode emits when there are
mismatch types between lhs & rhs of
assignment operator & refactored
message. This error code was used
in many test cases, so updated the
error comments.

gcc/rust/ChangeLog:

	* typecheck/rust-unify.cc (UnifyRules::emit_type_mismatch):
	refactored & called error function.

gcc/testsuite/ChangeLog:

	* rust/compile/arrays1.rs: changed comment to pass testcase.
	* rust/compile/bad_type1.rs: likewise.
	* rust/compile/bad_type2.rs: likewise.
	* rust/compile/const_generics_6.rs: likewise.
	* rust/compile/deadcode_err1.rs: likewise.
	* rust/compile/deadcode_err2.rs: likewise.
	* rust/compile/func1.rs: likewise.
	* rust/compile/func3.rs: likewise.
	* rust/compile/func4.rs: likewise.
	* rust/compile/func5.rs: likewise.
	* rust/compile/generics1.rs: likewise.
	* rust/compile/generics2.rs: likewise.
	* rust/compile/generics3.rs: likewise.
	* rust/compile/implicit_returns_err1.rs: likewise.
	* rust/compile/implicit_returns_err2.rs: likewise.
	* rust/compile/implicit_returns_err3.rs: likewise.
	* rust/compile/implicit_returns_err4.rs: likewise.
	* rust/compile/issue-1152.rs: likewise.
	* rust/compile/issue-2477.rs: likewise.
	* rust/compile/reference1.rs: likewise.
	* rust/compile/stmt_with_block_err1.rs: likewise.
	* rust/compile/traits1.rs: likewise.
	* rust/compile/traits2.rs: likewise.
	* rust/compile/tuple_mismatch.rs: likewise.
	* rust/compile/tuple_struct3.rs: likewise.
	* rust/compile/mismatched-types.rs: New test from rustc.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 19:00:26 +01:00
Marc Poulhiès
8b1e1faa7f gccrs: better handling of incorrect file loading in include_* builtin macros
When the load_file_bytes() fails to open the file, it emits an error but
returns an empty vector (as if the file is empty).

Instead, return a tl::optional nullopt in case of error and an empty
vector in case of an empty file.

fixes #2421

gcc/rust/ChangeLog:

	* expand/rust-macro-builtins.cc
	(load_file_bytes): Return a tl::optional.
	(MacroBuiltin::include_byte_handler): Adjust and check file was
	correctly opened.
	(MacroBuiltin::include_str_handler): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/empty_file: New file.
	* rust/compile/issue-2421_str.rs: New test.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-01-16 19:00:26 +01:00
Arthur Cohen
3b0a200eb8 gccrs: nr2.0: Use DefaultResolver for TopLevel
gcc/rust/ChangeLog:

	* resolve/rust-toplevel-name-resolver-2.0.h
	(class TopLevel): Inherit from DefaultResolver
	* resolve/rust-toplevel-name-resolver-2.0.cc
	(TopLevel::TopLevel): Remove unecessary methods
2024-01-16 19:00:26 +01:00
Arthur Cohen
467794700e gccrs: nr2.0: Add DefaultResolver visitor
The DefaultResolver class provides a visitor framework for all three resolvers
in the new name resolution algorithm, with things such as scoping or visiting
sub items.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-default-resolver.cc: New file.
	* resolve/rust-default-resolver.h: New file.
2024-01-16 19:00:26 +01:00
Raiki Tamura
26c4133a62 gccrs: Normalize Hangul to NFC
gcc/rust/ChangeLog:

	* util/rust-unicode.cc (decomp_cano): Decompose Hangul.
	(sort_cano): Fix bounds check.
	(recomp): use `compose_hangul`.
	(compose_hangul): Compose Hangul.
	(rust_utf8_normalize_test): Add tests.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
2024-01-16 19:00:26 +01:00
Arthur Cohen
6db677bac0 gccrs: forever-stack: Use rust_assert instead of assert
This causes complaints by our GCC 4.8 builder.

gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: assert() -> rust_assert()
2024-01-16 19:00:26 +01:00
Arthur Cohen
daae0c5dff gccrs: top-level: Add base TopLevel visitor
The `TopLevel` pass takes care of collecting definitions, placing them
in the proper namespaces, and making them accessible for later resolution
passes like `Early` and `Late`. It is meant to be run in a fixed point
fashion, as import resolution, macro resolution and macro expansion
may generate multiple new definitions.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-toplevel-name-resolver-2.0.cc: New file.
	* resolve/rust-toplevel-name-resolver-2.0.h: New file.
2024-01-16 19:00:25 +01:00
Arthur Cohen
79df2b3caf gccrs: name resolution 2.0: Add base for our context data structure
This commit adds a first simple `NameResolutionContext` data structure, which will
be used by all passes of the name resolution to store definitions and access
them. Namely, it contains a few instances of `ForeverStack`, for each
namespace we will be using.

gcc/rust/ChangeLog:

	* Make-lang.in: Add new object file.
	* resolve/rust-name-resolution-context.cc: New file.
	* resolve/rust-name-resolution-context.h: New file.
2024-01-16 18:56:04 +01:00
Muhammad Mahad
47576fa5a8 gccrs: [E0572] return is outside of function context
gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
	called error function.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
2024-01-16 18:56:04 +01:00
Owen Avery
c016d443b8 gccrs: Use MacroInvocLexerBase in MacroInvocLexer
gcc/rust/ChangeLog:

	* expand/rust-macro-invoc-lexer.cc
	(MacroInvocLexer::skip_token): Remove.
	* expand/rust-macro-invoc-lexer.h
	(class MacroInvocLexer): Extend MacroInvocLexerBase.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
2024-01-16 18:56:04 +01:00