aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-item.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-22 12:04:06 +0000
committerGitHub <noreply@github.com>2021-04-22 12:04:06 +0000
commitbb85500ecc4e355d766836d06c98c50688a92ff1 (patch)
tree4ea21cfffc1a6879641cd28f665d02e00976e4a2 /gcc/rust/backend/rust-compile-item.h
parentdd194669e3a43bcfba7183540c77fb1ce56212c0 (diff)
parent393b783549e1247dfed5b86f098fb10d1eaf6659 (diff)
downloadgcc-bb85500ecc4e355d766836d06c98c50688a92ff1.zip
gcc-bb85500ecc4e355d766836d06c98c50688a92ff1.tar.gz
gcc-bb85500ecc4e355d766836d06c98c50688a92ff1.tar.bz2
Merge #383
383: Reuse fold-const.c from GCC to enforce const array capacities r=philberty a=philberty Rust allows for constant eval for cases like array capacity, the initial version of this code forced the programmer to only use literals which was not correct but got the type system off the ground. This now takes advantage of the GCC backend object to offer 3 helprs. 1. check for constant Bexpression* are equal 2. extract a size_t constant value from the Bexpression* 3. to string the Bexpression constant We can get away with the extraction of the value here because we know its going to be a usize for array capacity but some thought is needed if these methods are to be reused in other cases. There is a new ConstFold namespace which should be extensible for const functions later on and const generics. Fixes: #296 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
0 files changed, 0 insertions, 0 deletions