Jakub Dupak [Wed, 24 Apr 2024 11:47:20 +0000 (13:47 +0200)]
borrowck: Testsuite
gcc/testsuite/ChangeLog:
* rust/borrowck/borrowck.exp: New test.
* rust/borrowck/position_dependant_outlives.rs: New test.
* rust/borrowck/reference.rs: New test.
* rust/borrowck/return_ref_to_local.rs: New test.
* rust/borrowck/subset.rs: New test.
* rust/borrowck/test_move.rs: New test.
* rust/borrowck/test_move_behind_reference.rs: New test.
* rust/borrowck/test_move_conditional.rs: New test.
* rust/borrowck/tmp.rs: New test.
* rust/borrowck/use_while_mut.rs: New test.
* rust/borrowck/use_while_mut_fr.rs: New test.
* rust/borrowck/well_formed_function_inputs.rs: New test.
A previous bug with name resolution 2.0 was caused by an incorrectly
resolved inherent impl name. This test shall highlight the behavior
and prevent regression.
Thomas Schwinge [Wed, 28 Feb 2024 22:26:39 +0000 (23:26 +0100)]
Rust: Move 'libformat_parser' build into the GCC build directory
Fixes #2883.
* .gitignore: Remove 'libgrust/*/target/'.
gcc/rust/
* Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build
directory.
* ($(LIBFORMAT_PARSER)): Build in the GCC build directory.
Arthur Cohen [Tue, 9 Apr 2024 11:32:31 +0000 (13:32 +0200)]
libgrust: Vendor Rust dependencies
This commits vendors and locks our dependencies so that our Rust components
do not need internet access to be built anymore. Tested in a docker container
with no network access.
We can think about merging the vendor directory once we have more than one
Rust component, e.g. when we add polonius to the mix.
libgrust/ChangeLog:
* libformat_parser/.cargo/config: New file.
* libformat_parser/vendor.NOTES: New file.
* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
* libformat_parser/vendor/libc/Cargo.toml: New file.
* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
* libformat_parser/vendor/libc/LICENSE-MIT: New file.
* libformat_parser/vendor/libc/README.md: New file.
* libformat_parser/vendor/libc/build.rs: New file.
* libformat_parser/vendor/libc/rustfmt.toml: New file.
* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/lib.rs: New file.
* libformat_parser/vendor/libc/src/macros.rs: New file.
* libformat_parser/vendor/libc/src/psp.rs: New file.
* libformat_parser/vendor/libc/src/sgx.rs: New file.
* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
* libformat_parser/vendor/libc/src/switch.rs: New file.
* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
* libformat_parser/vendor/libc/src/wasi.rs: New file.
* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
* libformat_parser/vendor/libc/src/xous.rs: New file.
* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
* libformat_parser/vendor/unicode-xid/README.md: New file.
* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.
Jakub Dupak [Tue, 27 Feb 2024 22:19:41 +0000 (23:19 +0100)]
borrowck: Fact collector
This is the main Polonius based logic which creates the information
Polonius needs from BIR. It is largly guessed and rever engineered, so
some aspects are probably wrong.
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-fact-collector.h: New file.
* checks/errors/borrowck/rust-borrow-checker.cc (BorrowChecker::go):
Enable fact collection.
Jakub Dupak [Tue, 27 Feb 2024 22:01:14 +0000 (23:01 +0100)]
borrowck: Regions in BIR
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-place.h (struct Lifetime):
Extended regions and loans.
(struct Loan): Representation of loan (result of borrowing)
* checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit):
Fix let stmt handling.
* checks/errors/borrowck/rust-bir-builder-pattern.h: improved
pattern translation
* checks/errors/borrowck/rust-bir-builder-internal.h: region binding
* checks/errors/borrowck/rust-bir-builder-expr-stmt.h (class ExprStmtBuilder):
Region support.
(class RenumberCtx): Region support.
* checks/errors/borrowck/rust-bir-builder.h (class Builder): Region support.
* checks/errors/borrowck/rust-bir-dump.cc (get_lifetime_name): Region support.
(renumber_places): Region support.
(Dump::go): Region support.
(Dump::visit): Region support.
(Dump::visit_lifetime): Region support.
(Dump::visit_scope): Region support.
* checks/errors/borrowck/rust-bir.h (class AbstractExpr): Region support.
(struct Function): Region support.
(class BorrowExpr): Region support.
(class CallExpr): Region support.
Jakub Dupak [Tue, 27 Feb 2024 20:31:07 +0000 (21:31 +0100)]
borrowck: extract regions from types using VA
Biggybag on variance analysis to extract regions of fields from ADT
regions.
gcc/rust/ChangeLog:
* typecheck/rust-tyty-variance-analysis-private.h (class FieldVisitorCtx):
Region extraction.
* typecheck/rust-tyty-variance-analysis.cc (query_field_regions): Region extraction.
(FieldVisitorCtx::collect_regions): Region extraction.
(FieldVisitorCtx::add_constraints_from_ty): Region extraction.
(FieldVisitorCtx::add_constraints_from_region): Region
extraction.
(FieldVisitorCtx::add_constrints_from_param): Region extraction.
* typecheck/rust-tyty-variance-analysis.h (query_field_regions):
Region extraction.
Jakub Dupak [Tue, 27 Feb 2024 19:59:58 +0000 (20:59 +0100)]
borrowck: Polonius FFI
Rust part is not build and not invoked at this point.
gcc/rust/ChangeLog:
* checks/errors/borrowck/ffi-polonius/Cargo.toml: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/gccrs_ffi_generated.rs: New file.
* checks/errors/borrowck/ffi-polonius/src/lib.rs: New file.
* checks/errors/borrowck/polonius/rust-polonius-ffi.h: New file.
* checks/errors/borrowck/polonius/rust-polonius.h: New file.
Jakub Dupak [Fri, 22 Mar 2024 15:24:30 +0000 (16:24 +0100)]
borrowck: Use rust-system.h
Replace direct usage of system headers.
gcc/rust/ChangeLog:
* checks/errors/borrowck/rust-bir-dump.cc: Use rust-system.h
* checks/errors/borrowck/rust-bir-dump.h (RUST_BIR_DUMP_H): Use rust-system.h
* checks/errors/borrowck/rust-bir-place.h (RUST_BIR_PLACE_H): Use rust-system.h
* checks/errors/borrowck/rust-function-collector.h: Use rust-system.h
* rust-system.h: Use rust-system.h
* typecheck/rust-hir-type-check.h: Use rust-system.h
* typecheck/rust-tyty-subst.cc: Use rust-system.h
* typecheck/rust-tyty-subst.h: Use rust-system.h
* typecheck/rust-tyty.h: Use rust-system.h
Arthur Cohen [Wed, 6 Mar 2024 15:19:46 +0000 (16:19 +0100)]
unify: Always coerce `!` to the target type.
Never can... never... exist, so it should always be coerced to the type
it is being matched against. This is useful for breaking off of a loop
from inside a match, or an if condition, for example.
gcc/rust/ChangeLog:
* typecheck/rust-unify.cc (UnifyRules::go): Always unify to `ltype` if
we are matching against a `Never` in `rtype`.
(UnifyRules::expect_never): Always unify to the expected type.
gcc/testsuite/ChangeLog:
* rust/compile/match-never-ltype.rs: New test.
* rust/compile/match-never-rtype.rs: New test.
Change dfs function return type to support gcc 4.8
GCC 4.8 does not handle pair with references correctly. We need to use a
properly typed struct instead.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h: Change dfs function prototype and
declare dfs return type structure.
* resolve/rust-forever-stack.hxx: Adapt dfs function to the new return
type.
Arthur Cohen [Wed, 23 Aug 2023 15:19:28 +0000 (17:19 +0200)]
nr2.0: Add new test cases.
gcc/testsuite/ChangeLog:
* rust/compile/name_resolution13.rs: Add new module and remove compile
step.
* rust/compile/name_resolution14.rs: New test.
* rust/compile/name_resolution15.rs: New test.
* rust/compile/name_resolution16.rs: New test.
* rust/compile/name_resolution17.rs: New test.
* rust/compile/name_resolution18.rs: New test.
* rust/compile/name_resolution19.rs: New test.
* rust/compile/name_resolution20.rs: New test.
* rust/compile/name_resolution21.rs: New test.
Arthur Cohen [Fri, 22 Mar 2024 13:31:24 +0000 (14:31 +0100)]
compile: resolve-path-ref: properly resolve nodeId with nr2.0
gcc/rust/ChangeLog:
* backend/rust-compile-resolve-path.cc: Attempt to resolve names
also using new name resolution context.
* backend/rust-compile-resolve-path.h: Add new declaration.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Change function prototype to use a reference instead.
(TopLevel::handle_use_dec): Likewise.
(TopLevel::handle_rebind): Add name resolution on rebind use
declarations.
(flatten_rebind): Change prototype to accept a pair of path/alias.
(flatten_list): Adapt call to flatten_rebind.
(flatten): Adapt call to flatten_rebind.
(flatten_glob): Remove unused part.
(TopLevel::visit): Add rebind resolution.
* resolve/rust-toplevel-name-resolver-2.0.h: Adapt function prototypes.
Immutable name resolution context is not initialized when the classic
name resolution is in use. It can therefore not be used, the getter would
error out.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_root_path):
Only get immutable name resolution context when name resolution 2.0 is
used.
* typecheck/rust-hir-type-check-type.cc (TypeCheckType::resolve_root_path):
Likewise.
The old resolver injected a Self generic parameter in order to help the
trait solver. This is clearly sketchy at best and should be fixed in
the future.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Add
Self generic parameter injection and a warning.
* resolve/rust-toplevel-name-resolver-2.0.h: Add function prototype.
Constant items were handled only by the old resolver, this lead to an
ICE when using the new resolver on some rust code containing a constant
item as the new and the old resolver cannot be used at the same time.
gcc/rust/ChangeLog:
* backend/rust-compile-item.cc (CompileItem::visit): Check the resolver
flag and use the new one when required.
Remove extern block scoping visit function, use the default visitor visit
function instead. We do not need scoping for extern block as their
element shall be visible from the extern block scope.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
visitor implementation and scoping.
* resolve/rust-default-resolver.h: Remove function prototype.
Unit struct have a special constructor that should be added to the struct
namespace in order to be resolved later when called. As it is a function
it should be added in the value namespace.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Add the struct constructor when the struct is a unit.
This overload did not dispatch the visitor to sub members of a raw
pointer like the default one. It is therefore useless as pointed type
shall be visited to be resolved correctly.
gcc/rust/ChangeLog:
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Remove
function implementation.
* resolve/rust-default-resolver.h: Remove function prototype.
Glob use declarations may lead to ambiguous situation where two
definitions with the same name are imported in a given scope. The
compiler now handles shadowable items inserted after non shadowable
items. An error is now thrown when multiple shadowable items are imported
and used in the same rib.
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Adapt
resolved type to the new API.
(Early::visit_attributes): Retrieve the node id from the definition.
* resolve/rust-forever-stack.h: Change the return type of getter
functions. Those functions now return a definition type instead of a
node id.
* resolve/rust-forever-stack.hxx: Change member function implementation
in the forever stack to accomodate it's API changes.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use internal
node id. Emit an error when resolving multiple ambiguous values.
* resolve/rust-rib.cc (Rib::Definition::Definition): Add a default
constructor.
(Rib::Definition::is_ambiguous): Add a new function to determine
whether a function definition is ambiguous or not.
(Rib::Definition::to_string): Add a member function to convert a given
definition to a string.
(Rib::insert): Add new rules for value insertion in a rib. Insertion
order does not impact the result anymore: inserting a shadowable value
after a non shadowable one does not trigger an error anymore. All
shadowable values inserted in a rib are kepts until being replaced by a
non shadowable one.
(Rib::get): Return a definition instead of a node id.
* resolve/rust-rib.h: Update function prototypes.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob):
Update return value container to match the new function's prototype.
(TopLevel::handle_use_dec): Likewise.
(flatten_glob): Likewise.
Elements from glob use declaration shall be shadowable by default.
gcc/rust/ChangeLog:
* resolve/rust-forever-stack.h: Add a new function prototype to insert
a shadowable definition.
* resolve/rust-forever-stack.hxx: Add the new insert_shadowable
function to insert shadowable definition into the forever stack.
* resolve/rust-name-resolution-context.cc (NameResolutionContext::insert_shadowable):
Likewise with the name resolution context.
* resolve/rust-name-resolution-context.h: Add name resolution context
insert_shadowable member function prototype.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert shadowable definition into the forever stack for glob use
declaration.
* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add a check
for missing item.
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::go):
Add a new function in the visitor to dispatch the visitor to items in
the given module.
(TopLevel::handle_use_glob): Change call to visitor to use the pointer.
* resolve/rust-toplevel-name-resolver-2.0.h: Add prototype for new
member function.
This is the first part of the code required to enable globbing on use
declarations.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit):
Insert names into their namespace.
(TopLevel::visit): Insert ast module.
(TopLevel::handle_use_dec): Resolve use declaration.
(TopLevel::handle_use_glob): Use globbing visitor.
(flatten_list): Use globbing path vector.
(flatten_glob): Likewise.
(flatten): Likewise.
(prefix_subpaths): Add a function to prefix subpath.
* resolve/rust-toplevel-name-resolver-2.0.h (class GlobbingVisitor):
Add globbing visitor.
* util/rust-hir-map.cc (Mappings::insert_ast_module): Add function to
insert module in module hashmap.
(Mappings::lookup_ast_module): Add function to retrieve ast module.
* util/rust-hir-map.h: Add module map and getter/setter prototypes.
The resolver was emitting an error when meeting the same symbol twice.
What is important here is the origin of the resolved symbol, we should
emit an error when the name is similar but the symbol isn't be not when
the resolver is simply meeting the exact same symbol.
gcc/rust/ChangeLog:
* resolve/rust-toplevel-name-resolver-2.0.cc (insert_macros): Add
constraint over the ast node id.
(TopLevel::visit): Likewise.