Age | Commit message (Collapse) | Author | Files | Lines |
|
gcc/testsuite/ChangeLog:
* rust/execute/torture/const_block1.rs: New test.
|
|
The unify code was a bit dumb here where we always set emit_error to false for any
subtypes for example in comparing tuples we always emitted the whole tuple didnt
match the other tuple but really its much better to say expected bool got i32 because
the element types didn't match.
gcc/rust/ChangeLog:
* typecheck/rust-coercion.cc (TypeCoercionRules::coerce_unsized): dont emit error here
* typecheck/rust-unify.cc (UnifyRules::resolve_subtype): new helper to handle emit error
(UnifyRules::expect_adt): call resolve_subtype
(UnifyRules::expect_reference): likewise
(UnifyRules::expect_pointer): likewise
(UnifyRules::expect_array): likewise
(UnifyRules::expect_slice): likewise
(UnifyRules::expect_fndef): likewise
(UnifyRules::expect_fnptr): likewise
(UnifyRules::expect_tuple): likewise
(UnifyRules::expect_closure): likewise
(UnifyRules::expect_opaque): likeiwse
* typecheck/rust-unify.h: add new helper to header
gcc/testsuite/ChangeLog:
* rust/compile/traits9.rs: update errors
* rust/compile/unify-errors1.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This is the initial patch for RPIT, we can build on this to handle the
more complex cases but there are enough distinct changes going on here
that it should just get merged now.
RPIT is really a sneaky generic so for example:
fn foo() -> impl Bar {
Baz
}
This is represented as: fn () -> OpaqueType Bar. But when we handle the
coercion site for Baz on impl Bar when we type resolve the function we
know that the underlying type is Baz. Note this function is _not_ generic
so its using this special OpaqueType and keeping track of the underlying type
in its ty_ref reference hir-id which will resolve to Baz.
This also means if we have a case where maybe this was in an if statement:
fn foo(a: i32) -> impl Bar {
if a > 10 {
Baz
} else {
Qux
}
}
The rules of impl Bar is that Baz is handled but Baz and Qux are different
underlying types so this is not allowed. The reason is impl traits are not
generic and although from a programmer perspective the callers dont know what
the underlying type is, the compiler _knows_ what it is. So really when
you call a function and get its return position impl trait the compiler knows
what to do and does all whats nessecary to handle calling functions using that
type etc.
gcc/rust/ChangeLog:
* backend/rust-compile-type.cc (TyTyResolveCompile::visit): we need to resolve the
underlying type
* typecheck/rust-substitution-mapper.cc (SubstMapperInternal::visit): just clone
* typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit):
ensure we monomphize to get the underlying
* typecheck/rust-tyty.cc (BaseType::destructure): handle opaque types
(OpaqueType::resolve): this is much simpler now
(OpaqueType::handle_substitions): no longer needed
* typecheck/rust-tyty.h: update header
* typecheck/rust-unify.cc (UnifyRules::expect_opaque): unify rules for opaque
gcc/testsuite/ChangeLog:
* rust/compile/bad-rpit1.rs: New test.
* rust/execute/torture/impl_rpit1.rs: New test.
* rust/execute/torture/impl_rpit2.rs: New test.
* rust/execute/torture/impl_rpit3.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This is similar to 9faba024ef18b9c4d67f22bd3b020b5e445fad0a, but it
applies to execute tests.
gcc/testsuite/ChangeLog:
* rust/execute/torture/for-loop1.rs: Adjust paths.
* rust/execute/torture/for-loop2.rs: Likewise.
* rust/execute/torture/iter1.rs: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/execute/torture/builtin_abort.rs: Fix path to
intrinsics::abort.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Undefined attribute macros have no proc macro definition, which results
in a failing `rust_assert`. This changes that assert to an if statement,
that returns early if there is no proc macro definition. Fixes #3661.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit_attributes): rust_assert to if
gcc/testsuite/ChangeLog:
* rust/compile/issue-3661.rs: Test NR2 has expected behavior
Signed-off-by: Tom Schollenberger <tss2344@g.rit.edu>
|
|
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser::parse_attr_input): Handle more delimeter tokens and the
END_OF_FILE token.
(Parser::skip_after_end_attribute): Handle the END_OF_FILE
token.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/meta-param.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* hir/rust-ast-lower-item.cc
(ASTLoweringItem::visit): Keep going after a duplicate field is
found.
gcc/testsuite/ChangeLog:
* rust/execute/same_field_name.rs: Move to...
* rust/compile/same_field_name.rs: ...here and adjust expected
errors.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This patch ensuers we reuse the Builder for new type to
ensure we create a new type from scratch ensuring consistent
new node-ids.
gcc/rust/ChangeLog:
* expand/rust-derive-default.cc (DeriveDefault::visit_struct): use builder
(DeriveDefault::visit_tuple): likewise
* expand/rust-derive-eq.cc (DeriveEq::visit_tuple): likewise
(DeriveEq::visit_struct): likewise
(DeriveEq::visit_enum): likewise
(DeriveEq::visit_union): likewise
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: these are fixed now
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* ast/rust-path.cc
(TypePath::make_debug_string): Add definition.
* ast/rust-path.h
(TypePath::make_debug_string): Add declaration.
* resolve/rust-default-resolver.cc
(DefaultResolver::visit): Adjust InherentImpl and TraitImpl
visitors to better handle associated item scope.
* resolve/rust-default-resolver.h
(DefaultResolver::maybe_insert_big_self): Add.
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Adjust type path resolution errors.
* resolve/rust-rib.h
(Rib::Kind): Add Generics kind.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove InherentImpl and TraitImpl visitor
overrides.
(TopLevel::maybe_insert_big_self): Add override in order to add
a definition of 'Self'.
* resolve/rust-toplevel-name-resolver-2.0.h
(TopLevel::visit): Remove InherentImpl and TraitImpl visitor
overrides.
(TopLevel::maybe_insert_big_self): Add override.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entries.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Empty loops have no body which means this is a NULL_TREE during const
evaluation which needs a check. Fixes Rust-GCC #3618.
gcc/rust/ChangeLog:
* backend/rust-constexpr.cc (eval_constant_expression): Check if t is a NULL_TREE
gcc/testsuite/ChangeLog:
* rust/compile/issue-3618.rs: Test empty loops error properly.
Signed-off-by: Tom Schollenberger <tss2344@g.rit.edu>
|
|
When using impl traits in argument position (APIT), they are desugared into generics,
and supplying explicit generic arguments is not allowed. This commit adds the error
diagnostic E0632 for attempting to pass generic arguments to impl traits, completing
the implementation of the APIT feature.
gcc/rust/ChangeLog:
* ast/rust-desugar-apit.cc: track if this is a impl-trait generic
* ast/rust-item.h (class TypeParam): add field to track if from impl trait
* hir/rust-ast-lower-type.cc (ASTLowerGenericParam::visit): likewise
* hir/tree/rust-hir-item.cc (TypeParam::TypeParam): upate hir as well
(TypeParam::operator=): likewise
* hir/tree/rust-hir-item.h (class TypeParam): likewise
* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): add error
* typecheck/rust-tyty-subst.h: add const getter for the associated TypeParm
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 cant handle this
* rust/compile/impl_trait_generic_arg.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc
(CompilePatternCheckExpr::visit): Fix GENERIC generation in
light of enum layout changes since this code was written.
(CompilePatternBindings::handle_struct_pattern_ident_pat):
Delegate handling of child patterns to another
CompilePatternBindings::Compile call.
(CompilePatternBindings::make_struct_access): Make field name
parameter const qualified.
* backend/rust-compile-pattern.h
(CompilePatternBindings::make_struct_access): Likewise.
gcc/testsuite/ChangeLog:
* rust/execute/torture/struct-pattern-match.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Argument position impl traits are simply syntatic sugar for generics. This
adds a new desugar pass to do this. So for example:
fn foo(a: impl Value, b: impl Value) -> i32
Is desugared into:
fn foo<T: Value, U: Value> (a: T, b: U) -> i32
So it just works like any normal generic function. There are more complex cases such as:
fn foo(_value: impl Bar<Baz = impl Foo>) -> i32
Which has a generic argument binding which needs to be turned into a where constraint:
fn foo<T, U>(_value: T) -> i32
where
T: Bar<Baz = U>,
U: Foo,
Fixes Rust-GCC#2015
Fixes Rust-GCC#1487
Fixes Rust-GCC#3454
Fixes Rust-GCC#1482
gcc/rust/ChangeLog:
* Make-lang.in: new desugar file
* ast/rust-ast.cc (ImplTraitTypeOneBound::as_string): its a unique_ptr now
(FormatArgs::set_outer_attrs): reformat
* ast/rust-path.h: remove has_generic_args assertion (can be empty because of desugar)
* ast/rust-type.h (class ImplTraitTypeOneBound): add copy ctor and use unique_ptr
* hir/rust-ast-lower-type.cc (ASTLoweringType::visit): update to use unique_ptr
* parse/rust-parse-impl.h (Parser::parse_type): reuse the existing unique_ptr instead
(Parser::parse_type_no_bounds): likewise
(Parser::parse_pattern): likewise
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): its a unique_ptr now
* rust-session-manager.cc (Session::compile_crate): call desugar
* ast/rust-desugar-apit.cc: New file.
* ast/rust-desugar-apit.h: New file.
gcc/testsuite/ChangeLog:
* rust/compile/issue-2015.rs: fully supported now
* rust/compile/nr2/exclude: nr2 cant handle some of these
* rust/compile/issue-1487.rs: New test.
* rust/compile/issue-3454.rs: New test.
* rust/execute/torture/impl_desugar-2.rs: New test.
* rust/execute/torture/impl_desugar.rs: New test.
* rust/execute/torture/impl_trait1.rs: New test.
* rust/execute/torture/impl_trait2.rs: New test.
* rust/execute/torture/impl_trait3.rs: New test.
* rust/execute/torture/impl_trait4.rs: New test.
* rust/execute/torture/issue-1482.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Rust only allows impl traits to be used in the return position of
functions.
Fixes Rust-GCC#1485
gcc/rust/ChangeLog:
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::visit): allow impl type
* hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): likewise
* hir/rust-ast-lower-type.cc (ASTLoweringType::ASTLoweringType): new flag for impl trait
(ASTLoweringType::translate): pass flag
(ASTLoweringType::visit): track impl trait tag
(ASTLoweringType::emit_impl_trait_error): new diagnostic
* hir/rust-ast-lower-type.h: add new field
gcc/testsuite/ChangeLog:
* rust/compile/impl_trait_diag.rs: New test.
* rust/compile/issue-1485.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/execute/torture/derive-partialeq2.rs: Add missing terminating nul char.
Co-authored-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-derive-partial-eq.cc (DerivePartialEq::match_enum_tuple): Remove debug call.
(DerivePartialEq::match_enum_struct): Add proper implementation.
(DerivePartialEq::visit_enum): Call it.
gcc/testsuite/ChangeLog:
* rust/execute/torture/derive-partialeq2.rs: New test.
|
|
Allow matching on a struct instance and rebinding its fields to new names:
match X {
Foo {
field0: new_name0,
field1: new_name1,
} => {
do_something(new_name0, new_name1);
},
}
This will enable us to finish derives for PartialEq and PartialOrd but
isn't a complete implementation of these patterns yet.
gcc/rust/ChangeLog:
* backend/rust-compile-pattern.cc (CompilePatternBindings::make_struct_access):
New function.
(CompilePatternBindings::visit): Properly implement patterns mentioned above
and call make_struct_accesss.
* backend/rust-compile-pattern.h: New declaration.
gcc/testsuite/ChangeLog:
* rust/execute/torture/struct_pattern1.rs: New test.
|
|
Both nodes had the same id, this led to a resolution conflict.
gcc/rust/ChangeLog:
* expand/rust-derive-clone.cc (DeriveClone::clone_enum_struct): Clone
path to avoid using the same nodeid.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove now passing test from exclusion
list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove passing test from exclusion list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/multiple_bindings1.rs: Add missing lang items.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
Name resolution 2.0 message describes the context around the unresolved
items and should therefore be kept.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove test from exclusion list.
* rust/compile/use_1.rs: Change expected output and remove test from
nr1.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/generics9.rs: Change expected error message.
* rust/compile/nr2/exclude: Remove test from exclusion list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change error
message.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove passing test from exclusion list.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc
(Early::build_import_mapping): Avoid outputting an "unresolved
import" error if other errors are outputted during resolution.
* resolve/rust-early-name-resolver-2.0.h
(Early::resolve_path_in_all_ns): Collect path resolution errors
while avoiding duplicate errors for resolutions in each
namespace.
* resolve/rust-forever-stack.h
(ForeverStack::resolve_path): Add parameter for collecting
errors.
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
* resolve/rust-forever-stack.hxx
(check_leading_kw_at_start): Likewise.
(ForeverStack::find_starting_point): Likewise.
(ForeverStack::resolve_segments): Likewise.
(ForeverStack::resolve_path): Likewise.
* resolve/rust-name-resolution-context.h
(NameResolutionContext::resolve_path): Add optional parameter
for collecting errors.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entry.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/derive-debug1.rs: Adjust a path.
* rust/compile/nr2/exclude: Remove derive-debug1.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
..., using the standard idiom. This '*.exp' file doesn't adhere to the
parallel testing protocol as defined in 'gcc/testsuite/lib/gcc-defs.exp'.
This also restores proper behavior for '*.exp' files executing after (!) this
one, which erroneously caused hundreds or even thousands of individual test
cases get duplicated vs. skipped, randomly, depending on the '-jN' level.
PR testsuite/119508
gcc/testsuite/
* rust/compile/nr2/compile.exp: Disable parallel testing.
(cherry picked from commit 79d2c3089f480738613b7d338d86d8be710f8158)
|
|
We have an assertion when accessing generic args if there are any which
is really useful so this adds the missing guards for the case where
they are specified but empty.
Fixes Rust-GCC#3649
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): add guard
* expand/rust-expand-visitor.cc (ExpandVisitor::visit): add guard
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 is missing error for this
* rust/compile/issue-3649.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-ast-resolve-path.cc
(ResolvePath::resolve_path): Adjust error messages.
* resolve/rust-ast-resolve-type.cc
(ResolveRelativeTypePath::go): Likewise.
* resolve/rust-forever-stack.hxx
(check_leading_kw_at_start): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/issue-3568.rs: Adjust expected errors.
* rust/compile/name_resolution9.rs: Likewise.
* rust/compile/self-path2.rs: Likewise.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
We were wrongly adding the assertion that this must not be an enum but
this is a pointless assertion we only care that there are variant in the
ADT and if the field exists in the first variant.
Fixes Rust-GCC#3581
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): fix bad assertion
gcc/testsuite/ChangeLog:
* rust/compile/nonexistent-field.rs: fix bad error message
* rust/compile/issue-3581-1.rs: New test.
* rust/compile/issue-3581-2.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
Fixes Rust-GCC#3652
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: nr2 does not error on the T it should require Self::T
* rust/compile/issue-3652.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
The error handling here was done long ago when we didnt know how to do
any error handling very well. This removed bad fatal_errors and adds in
some nice rich_location error diagnostics instead.
Fixes Rust-GCC#3628
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-struct-field.h: keep reference to parent expression
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::TypeCheckStructExpr):
update ctor
(TypeCheckStructExpr::resolve): remove bad rust_fatal_errors
(TypeCheckStructExpr::visit): cleanup errors
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-issue2983_2984.rs: cleanup error diagnotics
* rust/compile/struct_init1.rs: likewise
* rust/compile/issue-3628.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* resolve/rust-late-name-resolver-2.0.cc
(Late::visit): Handle StructPatternFieldIdent.
* resolve/rust-late-name-resolver-2.0.h
(Late::visit): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/nr2/exclude: Remove entry.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
Fixes Rust-GCC#3662
gcc/testsuite/ChangeLog:
* rust/compile/issue-3662.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
This was already fixed in: bb01719f0e1 but we require fn_once lang item
to be defined as we are working on libcore support still.
Fixes Rust-GCC#3711
gcc/testsuite/ChangeLog:
* rust/compile/issue-3711.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/black_box.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
gcc/testsuite/ChangeLog:
* rust/execute/black_box.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
|
|
It is not allowed to have a declared inference variable in the return
position of a function as this may never get infered you need good points
of truth.
Ideally if we get a student for GSoC 25 we will get the Default Hir Visitor
so that we can grab the HIR::InferredType locus instead of using the ref
location lookups.
Fixes Rust-GCC#402
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): add diagnostic
* typecheck/rust-tyty.cc (BaseType::contains_infer): new helper to grab first infer var
* typecheck/rust-tyty.h: prototype
gcc/testsuite/ChangeLog:
* rust/compile/issue-402.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
I copied a bad form of this check from the c front-end this updates it
to ensure the rhs is an INTEGER_CST and the lhs needs checked in the first
place.
Fixes Rust-GCC#3664
gcc/rust/ChangeLog:
* rust-gcc.cc (arithmetic_or_logical_expression): Ensure this is an integer
gcc/testsuite/ChangeLog:
* rust/compile/issue-3664.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* typecheck/rust-tyty.h: Add new `ReprKind` enum to
`ReprOptions`.
* typecheck/rust-hir-type-check-base.cc: Handle setting of
`repr_kind`.
* typecheck/rust-hir-type-check-item.cc: New check for
zero-variant enums.
Signed-off-by: Yap Zhi Heng <yapzhhg@gmail.com>
|
|
Trait constants were missing type resolution step, this adds that
as if it was a normal constant. The unsafe checker was missing a
null check.
Fixes Rust-GCC#3612
gcc/rust/ChangeLog:
* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): add null check
* hir/tree/rust-hir-item.h: add has_type helper
* typecheck/rust-hir-trait-resolve.cc (TraitItemReference::resolve_item):
add missing type checking
gcc/testsuite/ChangeLog:
* rust/compile/issue-3612.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (MacroBuiltin::builtin_transcribers):
Add entry for track_caller.
* util/rust-attribute-values.h: add `TRACK_CALLER` attribute.
* util/rust-attributes.cc: add `track_caller` attribute definition.
gcc/testsuite/ChangeLog:
* rust/compile/track_caller.rs: New test.
Signed-off-by: Bhavesh Mandalapu <mandalapubhavesh@gmail.com>
|
|
gcc/rust/ChangeLog:
* checks/errors/rust-const-checker.cc
(ConstChecker::visit): Visit the enum items of enums.
* resolve/rust-ast-resolve-item.cc
(ResolveItem::visit): Resolve enum discriminants during nr1.0.
gcc/testsuite/ChangeLog:
* rust/compile/enum_discriminant2.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-format-args.cc (format_args_parse_arguments): Improve safety,
allow extra commas after end of argument list.
gcc/testsuite/ChangeLog:
* rust/compile/format_args_extra_comma.rs: New test.
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Call into
TokenTreeDesugar.
* expand/rust-token-tree-desugar.cc: New file.
* expand/rust-token-tree-desugar.h: New file.
* Make-lang.in: Compile them.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-issue3709-1.rs: New test.
* rust/compile/macros/mbe/macro-issue3709-2.rs: New test.
|
|
gcc/rust/ChangeLog:
* expand/rust-macro-expand.cc (MacroExpander::match_n_matches): Do not
insert fragments and substack fragments if the matcher failed.
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro-issue3708.rs: New test.
|
|
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-expr.cc (is_default_fn): New.
(emit_ambiguous_resolution_error): New.
(handle_multiple_candidates): Properly handle multiple candidates in
the case of specialization.
(TypeCheckExpr::visit): Call `handle_multiple_candidates`.
gcc/testsuite/ChangeLog:
* rust/execute/torture/min_specialization2.rs: New test.
* rust/execute/torture/min_specialization3.rs: New test.
|
|
gcc/testsuite/ChangeLog:
* rust/compile/macros/mbe/macro6.rs: Remove call of undefined
function.
* rust/compile/nr2/exclude: Remove macros/mbe/macro6.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
gcc/testsuite/ChangeLog:
* rust/compile/issue-2812.rs: Avoid multiple definition error.
* rust/compile/nr2/exclude: Remove issue-2812.rs.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
|
|
This patch fixes an issue where an empty feature gate would segfault,
instead of reporting a syntax error to the user.
gcc/rust/ChangeLog:
* ast/rust-ast.h: (AST::Attribute): add empty_input function
* checks/errors/rust-feature-gate.cc: (FeatureGate::visit): check for empty feature gate
gcc/testsuite/ChangeLog:
* rust/compile/feature.rs: add an invalid empty feature to produce an error
Signed-off-by: Matty Kuhn <matty.kuhn.1@gmail.com>
|