| Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Reindent according to latest clang-format settings.
No functional change.
gcc/rust/ChangeLog:
* lex/rust-lex.cc (rust_input_source_test): Reindent.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
|
|
This fixes a false positive with undefined features, improves the
implementation of Feature::as_name, and configures the testsuite to
check further stages of libcore compilation.
gcc/rust/ChangeLog:
* ast/rust-macro.h (MetaNameValueStr::get_name): New function.
(MetaNameValueStr::get_value): Likewise.
* checks/errors/feature/rust-feature-gate.cc
(FeatureGate::visit): Tweak unknown feature detection.
(FeatureGate::gate): Handle field rename.
(FeatureGate::note_stability_attribute): New function
definition.
* checks/errors/feature/rust-feature-gate.h
(FeatureGate::note_stability_attribute): New function
declaration.
(FeatureGate::Stability): New enum class.
(FeatureGate::valid_features): Rename field to...
(FeatureGate::valid_lang_features): ...here.
(FeatureGate::valid_lib_features): New field.
(FeatureGate::defined_lib_features): Likewise.
* checks/errors/feature/rust-feature.cc (Feature::as_name):
Improve implementation.
gcc/testsuite/ChangeLog:
* rust/core/core.exp: Change -frust-compile-until=astvalidation
to -frust-compile-until=nameresolution.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* checks/errors/feature/rust-feature-gate.cc (FeatureGate::visit): Add check for lang_items.
* checks/errors/feature/rust-feature-gate.h: Likewise.
Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_function): Return a nullptr on
error instead of a valid function.
(Parser::parse_let_stmt): Remove non leaf error.
(Parser::parse_if_expr): Likewise.
(Parser::parse_loop_expr): Likewise.
(Parser::parse_expr): Return error on null denotation error.
gcc/testsuite/ChangeLog:
* rust/compile/braced_macro_arm.rs: Remove parent errors.
* rust/compile/issue-407-2.rs: Likewise.
* rust/compile/issue-407.rs: Likewise.
* rust/compile/issue-4162.rs: Likewise.
* rust/compile/issue-867.rs: Likewise.
* rust/compile/raw_ref_op_invalid.rs: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_delim_token_tree):
Remove error message.
(Parser::parse_token_tree): Split error message.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-issue3608.rs: Remove error.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Fixes #122886
gcc/rust/ChangeLog:
* backend/rust-constexpr.cc (eval_binary_expression): Set initial value
equality value to false.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-expand.h: Fix typos in comment.
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_items): Remove item parsing
error.
gcc/testsuite/ChangeLog:
* rust/compile/braced_macro_arm.rs: Remove superfluous error message
matching.
* rust/compile/decl_macro6.rs: Likewise.
* rust/compile/decl_macro7.rs: Likewise.
* rust/compile/extern_type_item_missing_semi.rs: Likewise.
* rust/compile/issue-2187.rs: Likewise.
* rust/compile/issue-407-2.rs: Likewise.
* rust/compile/issue-407.rs: Likewise.
* rust/compile/issue-4162.rs: Likewise.
* rust/compile/issue-867.rs: Likewise.
* rust/compile/macros/mbe/macro-issue1053-2.rs: Likewise.
* rust/compile/macros/mbe/macro-issue1395-2.rs: Likewise.
* rust/compile/macros/mbe/macro-issue3608.rs: Likewise.
* rust/compile/macros/mbe/macro27.rs: Likewise.
* rust/compile/macros/mbe/macro28.rs: Likewise.
* rust/compile/macros/mbe/macro29.rs: Likewise.
* rust/compile/macros/mbe/macro30.rs: Likewise.
* rust/compile/macros/mbe/macro31.rs: Likewise.
* rust/compile/macros/mbe/macro33.rs: Likewise.
* rust/compile/macros/mbe/macro35.rs: Likewise.
* rust/compile/macros/mbe/macro37.rs: Likewise.
* rust/compile/macros/mbe/macro38.rs: Likewise.
* rust/compile/macros/mbe/macro39.rs: Likewise.
* rust/compile/macros/mbe/macro48.rs: Likewise.
* rust/compile/parse_invalid_specialization.rs: Likewise.
* rust/compile/parse_simple_path_fail_1.rs: Likewise.
* rust/compile/parse_simple_path_fail_2.rs: Likewise.
* rust/compile/raw-string-loc.rs: Likewise.
* rust/compile/raw-byte-string-loc.rs: Likewise.
* rust/compile/self_const_ptr.rs: Likewise.
* rust/compile/self_mut_ptr.rs: Likewise.
* rust/compile/static_var1.rs: Likewise.
* rust/compile/self_ptr.rs: Likewise.
* rust/compile/torture/identifier-missing-impl-1.rs: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-expand-visitor.cc (builtin_derive_item): Collect derived nodes.
(derive_item): Collect derived nodes.
* util/rust-hir-map.cc (Mappings::add_derived_nodes): Add derived set to collect derived
nodes.
(Mappings::is_derived_node): Add derived set to collect derived nodes.
* util/rust-hir-map.h: Add derived set to collect derived nodes.
Signed-off-by: Ryutaro Okada <1015ryu88@gmail.com>
|
|
|
|
Looks like Jose forgot to one last regenerate of the opt.urls file.
Pushed as obvious after quickly looking to make sure they look decent.
gcc/ada/ChangeLog:
* gcc-interface/lang.opt.urls: Regenerate.
gcc/ChangeLog:
* algol68/lang.opt.urls: Regenerate.
gcc/c-family/ChangeLog:
* c.opt.urls: Regenerate.
gcc/cobol/ChangeLog:
* lang.opt.urls: Regenerate.
gcc/d/ChangeLog:
* lang.opt.urls: Regenerate.
gcc/fortran/ChangeLog:
* lang.opt.urls: Regenerate.
gcc/go/ChangeLog:
* lang.opt.urls: Regenerate.
gcc/m2/ChangeLog:
* lang.opt.urls: Regenerate.
gcc/rust/ChangeLog:
* lang.opt.urls: Regenerate.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
|
|
|
|
I've committed earlier today https://gcc.gnu.org/r16-5628 to switch C++ to
-std=gnu++20 by default. That apparently broke rust build (I don't have
cargo installed, so am not testing rust at all).
Here is a completely untested attempt to fix that.
Note, in C++20 u8"abc" literal has const char8_t[4] type rather than
const char[4] which was the case in C++17, and there is std::u8string
etc.
The casts below to (const char *) is what I've used in libcody as well
to make it compilable with all of C++11 to C++26.
Another thing is that the source for some reason expects -fexec-charset=
to be ASCII compatible and -fwide-exec-charset= to be UTF-16 or UTF-32
or something similar. That is certainly not guaranteed.
Now, if rust-lex.cc can be only compiled with C++17 or later, we
could just use u8'_' etc., but as GCC still only requires C++14, I'd
go with u'_' etc.
2025-11-27 Jakub Jelinek <jakub@redhat.com>
* lex/rust-lex.cc (rust_input_source_test): Cast char8_t string
literals to (const char *) to make it compilable with C++20. Use
char16_t or char32_t character literals instead of ordinary
character literals or wide character literals in expected
initializers.
|
|
Remove container of incomplete type and reorder headers.
gcc/rust/ChangeLog:
* typecheck/rust-tyty-subst.h: Remove now useless inclusion.
* typecheck/rust-tyty.h (class TypeBoundPredicate): New, moved from rust-tyty-bounds.h
(class TypeBoundsMappings): Likewise.
* typecheck/rust-tyty-bounds.h: Removed.
|
|
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h: Add early exit condition to parsing loop.
Signed-off-by: Lúcio Boari Fleury <lucboari@gmail.com>
|
|
This patch is the initial part in supporting generic associated types. In rust we have
trait item types that get implemented for example:
trait Foo<T> {
type Bar
}
impl<T> Foo for T {
type Bar = T
}
The trait position uses a Ty::Placeholder which is just a thing that gets set for
lazy evaluation to the impl type alias which is actually a Ty::Projection see:
0798add3d3c1bf4b20ecc1b4fa1047ba4ba19759
For more info the projection type needs to hold onto generics in order to properly
support generic types this GAT's support extends this all the way to the placeholder
which still needs to be done.
Fixes Rust-GCC#4276
gcc/rust/ChangeLog:
* ast/rust-ast.cc (TraitItemType::as_string): add generic params
* ast/rust-ast.h: remove old comment
* ast/rust-item.h: add generic params to associated type
* ast/rust-type.h: remove old comment
* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit): hir lowering for gat's
* hir/tree/rust-hir-item.cc (TraitItemType::TraitItemType): gat's on TraitItemType
(TraitItemType::operator=): preserve generic params
* hir/tree/rust-hir-item.h: likewise
* hir/tree/rust-hir.cc (TraitItemType::as_string): likewise
* parse/rust-parse-impl.h (Parser::parse_trait_type): hit the < and parse params
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): typecheck
* typecheck/rust-tyty.cc (BaseType::has_substitutions_defined): dont destructure
gcc/testsuite/ChangeLog:
* rust/compile/gat1.rs: New test.
* rust/execute/torture/gat1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Derive may only be applied to structs, enums and unions.
gcc/rust/ChangeLog:
* expand/rust-derive.cc (DeriveVisitor::derive):
Add check and error.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3971.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_doc_item_attribute): Make error.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4226.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (compile_float_literal): Add is_negative
check to compile negative float literals properly.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit(RangePattern)):
Minor optimization to E0579 checks to reduce memory copy.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
This includes a program, written using flex and bison, to extract
information on unstable features from rustc source code and save it to a
header file.
The script does fetch files from https://github.com/rust-lang/rust (the
official rustc git repository), which should be alright, as it's only
intended to be run by maintainers.
See https://doc.rust-lang.org/unstable-book/ for information on unstable
features.
gcc/rust/ChangeLog:
* checks/errors/feature/rust-feature-gate.cc
(FeatureGate::gate): Handle removal of Feature::create.
(FeatureGate::visit): Refer to AUTO_TRAITS as
OPTIN_BUILTIN_TRAITS.
* checks/errors/feature/rust-feature.cc (Feature::create):
Remove.
(Feature::feature_list): New static member variable.
(Feature::name_hash_map): Use "rust-feature-defs.h" to define.
(Feature::lookup): New member function definition.
* checks/errors/feature/rust-feature.h (Feature::State): Add
comments.
(Feature::Name): Use "rust-feature-defs.h" to define.
(Feature::as_string): Make const.
(Feature::name): Likewise.
(Feature::state): Likewise.
(Feature::issue): Likewise.
(Feature::description): Remove member function declaration.
(Feature::create): Remove static member function declaration.
(Feature::lookup): New member function declarations.
(Feature::Feature): Adjust arguments.
(Feature::m_rustc_since): Rename to...
(Feature::m_rust_since): ...here.
(Feature::m_description): Remove.
(Feature::m_reason): New member variable.
(Feature::feature_list): New static member variable.
* checks/errors/feature/rust-feature-defs.h: New file.
* checks/errors/feature/contrib/parse.y: New file.
* checks/errors/feature/contrib/scan.l: New file.
* checks/errors/feature/contrib/.gitignore: New file.
* checks/errors/feature/contrib/Makefile: New file.
* checks/errors/feature/contrib/fetch: New file.
* checks/errors/feature/contrib/regen: New file.
* checks/errors/feature/contrib/copyright-stub.h: New file.
* checks/errors/feature/contrib/README: New file.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate): Make error when attribute has no input.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4262.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
This should make it easier for us to move away from leaking pointers to
Bvariable everywhere. Since LocalVariable has a single field of type
tree, it should be the same size as a pointer to Bvariable, making the
switch to LocalVariable wherever possible strictly an improvement.
gcc/rust/ChangeLog:
* backend/rust-compile-expr.cc (CompileExpr::visit): Implicitly
convert LocalVariable to pointer to Bvariable.
* rust-backend.h (local_variable): Return LocalVariable.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
* rust-gcc.cc (local_variable): Likewise.
(parameter_variable): Likewise.
(static_chain_variable): Likewise.
(temporary_variable): Likewise.
(LocalVariable::get_tree): New function.
(LocalVariable::error_variable): Likewise.
* rust-gcc.h (class LocalVariable): New class.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Check if parser throw an error to avoid cloning nullptr
Fixes Rust-GCC#4140
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc (transcribe_expression): Check if
parser didn't fail.
(transcribe_type): Likewise.
(transcribe_pattern): Likewise.
Signed-off-by: lenny.chiadmi-delage <lenny.chiadmi-delage@epita.fr>
|
|
|
|
When we typecheck a trait impl block item, at the end we validate it
against the trait definition by doing a final unify but if the type check
fails on the the impl item it returns NULL here. The other issue was that
if we fail to resolve the specified lifetime we return error early, this
changes the typechecking to default to an anon lifetime so we can continue
typechecking.
Fixes Rust-GCC#4188
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItemWithTrait::visit): null guard
* typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): default to anon
gcc/testsuite/ChangeLog:
* rust/compile/issue-4188.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Impl items can have constants defined which could in turn be generic this was
not supported by gccrs and missed. So for example:
impl<T> Foo<T> {
const MAGIC: usize = mem::size_of::<T>();
}
This is a normal type parameter but in order to setup the generics we need to
create a synthetic TyTy::FnType so we can bind the parent's impl generics to
the type system and it just works like any other generic item at that point.
Then for example we have:
impl<const N: usize> Foo<N> {
const VALUE: usize = N;
}
Again we consistently bind the this const generic parameter the same way so
the lazy evaluation of the generic can take place.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): support the synthetic function consts
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::Resolve): likewise
* typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): create the synth
* typecheck/rust-tyty.h: new flag for synthetic constant
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-5.rs: New test.
* rust/execute/torture/const-generics-6.rs: New test.
* rust/execute/torture/const-generics-7.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
When we were processing generic const param types on arrays the size type
was overriding the const param decl because of a hirid reference mismatch
Fixes Rust-GCC#3879
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): fix mappings
gcc/testsuite/ChangeLog:
* rust/compile/const_generics_18.rs: New test.
* rust/compile/const_generics_19.rs: New test.
* rust/execute/torture/const-generics-3.rs: New test.
* rust/execute/torture/const-generics-4.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::is_derive):
Change is_derive method with its valid path.
* util/rust-attribute-values.h:
Delete redudant derive attribute.
* util/rust-attributes.cc (AttributeChecker::check_inner_attribute):
Helper method for check_inner_attributes
(AttributeChecker::check_inner_attributes):
Implement method for errors check.
* util/rust-attributes.h:
Add methods above in header.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4212.rs:
* rust/compile/issue-4219.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
Adds a proper check for missing patterns in while expressions.
Fixes Rust-GCC#4162
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h(Parser<ManagedTokenSource>::parse_while_let_loop_expr):
Add check for missing pattern.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4162.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (MetaItemLitExpr::check_cfg_predicate): Make error.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4222.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate): add cfg path in condition
gcc/testsuite/ChangeLog:
* rust/compile/issue-4261.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::check_cfg_predicate):
Make error.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4267.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>
|
|
Const generics bind values which can be accessed like a normal path but the difference
is that they can be true expression values not just type paths. This patch adds support
to resolving a method inference which passes a generic value into the method and fixes
some missed bugs along the way. The tricky part was that there is a case where in the
return position of a method returning a const param type vs the type of the method
there is a special case in the unify rules so that we unify the specified type of the
const param type not the const param itself.
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc: handle const param values
* typecheck/rust-hir-type-check-item.cc: generate const infer vars when required
* typecheck/rust-type-util.cc (unify_site_and): handle a null param cleanup
* typecheck/rust-tyty-util.cc (TyVar::get_implicit_const_infer_var): helper interface
* typecheck/rust-tyty-util.h: update header prototypes
* typecheck/rust-tyty.cc (BaseType::is_concrete): correctly handle const types
(ConstParamType::get_name): emit the specified type
(ConstParamType::is_equal): fix recursion loop
* typecheck/rust-unify.cc (UnifyRules::go): const infer vars need cleanup too
* typecheck/rust-unify.h: support base generics
gcc/testsuite/ChangeLog:
* rust/execute/torture/const-generics-2.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Checks whether upper bound of range is not lower or equal to the lower bound.
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc(compilePatternCheckExpr::visit(RangePattern)):
Add E0579 check to ensure that lower bound is always below upper bound.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
GIMPLE output for compile/issue-4242.rs:
...
x = 1;
RUSTTMP.2 = x;
_1 = RUSTTMP.2 >= -55;
_2 = RUSTTMP.2 < 0;
_3 = _1 & _2;
if (_3 != 0) goto <D.112>; else goto <D.113>;
<D.112>:
{
RUSTTMP.1 = 2;
goto <D.105>;
}
<D.113>:
_4 = RUSTTMP.2 >= -99;
_5 = RUSTTMP.2 < -55;
_6 = _4 & _5;
if (_6 != 0) goto <D.114>; else goto <D.115>;
<D.114>:
{
RUSTTMP.1 = 3;
goto <D.105>;
}
...
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc (compile_range_pattern_bound): Set litexpr
to negative if has_minus is present in the RangePatternBoundLiteral param.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
When a const generic with a default value is not trailing, emit an
error.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_generic_params): Emit
an error when const generics with a default value is not
trailing.
gcc/testsuite/ChangeLog:
* rust/compile/const_generics_17.rs: New test.
* rust/compile/generics14.rs: New test.
Signed-off-by: vishruth-thimmaiah <vishruththimmaiah@gmail.com>
|
|
GIMPLE output for literalpattern_neg.rs test case:
...
x = -55;
RUSTTMP.2 = x;
if (RUSTTMP.2 == 55) goto <D.113>; else goto <D.114>;
<D.113>:
{
RUSTTMP.1 = 1;
goto <D.107>;
}
<D.114>:
if (RUSTTMP.2 == -55) goto <D.115>; else goto <D.116>;
<D.115>:
{
RUSTTMP.1 = 0;
goto <D.107>;
}
<D.116>:
if (1 != 0) goto <D.117>; else goto <D.118>;
<D.117>:
{
RUSTTMP.1 = 1;
goto <D.107>;
}
...
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (parse_literal_or_range_pattern): Parse minus sign
properly for LiteralPattern.
* ast/rust-pattern.h (LiteralPattern): Add has_minus boolean for LiteralPattern.
* hir/tree/rust-hir-pattern.h (LiteralPattern): Ditto.
* ast/rust-pattern.cc (LiteralPattern::as_string): Update to include minus sign
if present.
* hir/tree/rust-hir.cc (LiteralPattern::as_string): Ditto.
* hir/rust-ast-lower-pattern.cc (visit(LiteralPattern)): Pass has_minus boolean
from AST to HIR.
* backend/rust-compile-pattern.cc (CompilePatternCheckExpr::visit(LiteralPattern)):
Compile litexpr as negative if minus sign is present.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
An imbricated exported macro leads to a segfault.
gcc/rust/ChangeLog:
* metadata/rust-export-metadata.cc (ExportContext::emit_macro):
Change method argument NodeId to AST::MacroRulesDefinition.
* metadata/rust-export-metadata.h:
Likewise.
* util/rust-hir-map.cc (Mappings::insert_exported_macro):
Insert AST::MacroRulesDefinition instead of NodeId.
* util/rust-hir-map.h:
Change methods declarations of exported macros.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3617.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.fr>
|
|
|
|
There was a typo in the original commit where the diagnostic context was not being popped,
however popping the context still causes issues while bootstrapping.
For now, just mark -Warray-bounds as a warning to fix bootstrap on trunk and think about
a proper fix (probably adding a push and pop on every file including rust-fmt.h...) later if
the C++ warning issue is still not fixed.
gcc/rust/ChangeLog:
* ast/rust-fmt.h: Simplify diagnostic avoidance.
|
|
Since this warning is not easily fixable, avoid it for now and wait for
the underlying issue to be resolved.
gcc/rust/ChangeLog:
PR rust/122498
* ast/rust-fmt.h: Add -Warray-bounds pragma to avoid the issue during
bootstraps
Co-authored-by: Thomas Schwinge <tschwinge@gcc.gnu.org>
|
|
|
|
gcc/rust/ChangeLog:
* ast/rust-ast-pointer-visitor.cc (PointerVisitor::visit):
Handle the expression contained in an ErrorPropagationExpr.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (visit(TuplePattern)): Update HAS_REST
case to continue to attempt to resolve pattern items after emitting size error.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
When we typecheck a tuple struct pattern and the type of its path is
an enum, it may refer to the enum itself and not a variant. Emit an
E0532 error on such cases.
Fixes Rust-GCC/gccrs#3917
Fixes Rust-GCC/gccrs#3918
Fixes Rust-GCC/gccrs#3926
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Emit
an error when the path refers to an enum itself rather than its variant.
gcc/testsuite/ChangeLog:
* rust/compile/match-tuplestructpattern-non-variant.rs: New test.
Signed-off-by: Ryo Yoshida <low.ryoshida@gmail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-base.cc (parse_repr_options): Changed TOKEN_TREE
assert into error, update malformed repr attribute error message to be inline
with other attribute error messages.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-ast.cc (Attribute::is_derive):
Change string derive to its definition.
* util/rust-attribute-values.h:
Add attribute definition derive.
* util/rust-attributes.cc (AttributeChecker::visit):
Add method check_inner_attributes.
(AttributeChecker::check_inner_attributes):
Check if there is a bad inner attribute.
* util/rust-attributes.h:
Add method check_inner_attributes in .h.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4212.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.fr>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-tyty-util.cc (TyVar::TyVar): Add null check to avoid ICE.
(TyVar::get_tyty): Return nullptr when lookup fails.
(TyVar::clone): Handle null base type safely.
(TyVar::monomorphized_clone): Add fallback for error types.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3556.rs: New test.
Signed-off-by: lishin <lishin1008@gmail.com>
|