diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-26 15:49:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-26 15:49:23 +0000 |
commit | 51d86210d3dcbbf4dea14149f90ad9087b006f6a (patch) | |
tree | f07e17d6a5e8d8c1867ce3837652f8a921b46a4e /gcc/rust/backend/rust-compile-context.h | |
parent | 387d69cdf385f6979499ea7e0162ecd929ffbe01 (diff) | |
parent | 60cb8cc43b91ff8a00be45be1106f95f161e9c8d (diff) | |
download | gcc-51d86210d3dcbbf4dea14149f90ad9087b006f6a.zip gcc-51d86210d3dcbbf4dea14149f90ad9087b006f6a.tar.gz gcc-51d86210d3dcbbf4dea14149f90ad9087b006f6a.tar.bz2 |
Merge #527
527: Reject non-pure decimal tuple indexes. r=philberty a=dkm
Tuple indexes should be pure decimal integer literals. But the parser just sees an
integer literal. Fix this by introducing a new type hint CORETYPE_PURE_DECIMAL. This
doesn't conflict with any existing type hints since a pure decimal doesn't have a
type suffix.
Introduce a new method is_pure_decimal that the parser can use in parse_tuple_index_expr.
get_type_hint will return CORETYPE_UNKNOWN for pure decimals.
parse_decimal_int_or_float will check whether there are no execissive leading zeros.
parse_in_decimal checks the literal doesn't contain any underscores.
Add two testcases. bad_tuple_index.rs with all variants of integer literals which aren't
pure decimals. And tuple_index.rs with various correct tuple indexes.
Resolves: https://github.com/Rust-GCC/gccrs/issues/511
Co-authored-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
0 files changed, 0 insertions, 0 deletions