Commit Graph

10 Commits

Author SHA1 Message Date
Arthur Cohen d560f3f959 rust: Lower minimum supported Rust version to 1.49
gcc/rust/ChangeLog:

	* checks/errors/borrowck/ffi-polonius/Cargo.lock: Regenerate.
	* checks/errors/borrowck/ffi-polonius/Cargo.toml: Update to use source patching instead of
	vendoring, lower edition to 2018.
	* checks/errors/borrowck/ffi-polonius/vendor/log/Cargo.toml: Change edition to 2018.
	* checks/errors/borrowck/ffi-polonius/vendor/log/src/lib.rs: Remove uses of unstable
	feature.
	* checks/errors/borrowck/ffi-polonius/.cargo/config.toml: Removed.

libgrust/ChangeLog:

	* libformat_parser/Makefile.am: Avoid using --config as it is unsupported by cargo 1.49.
	* libformat_parser/Makefile.in: Regenerate.
	* libformat_parser/generic_format_parser/src/lib.rs: Use extension trait for missing
	features.
	* libformat_parser/src/lib.rs: Likewise.
	* libformat_parser/.cargo/config: Moved to...
	* libformat_parser/.cargo/config.toml: ...here.
2025-03-31 21:07:15 +02:00
badumbatish 9afadf56ca gccrs: Fix ffi and enum conventions
gcc/rust/ChangeLog:

	* ast/rust-fmt.h (enum ParseMode):
	Drop typedef in Cpp

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs:
	Remove repr(C)
	* libformat_parser/src/bin.rs: Use ffi
	* libformat_parser/src/lib.rs: pub ffi, create ParseMode and match
	rustc's parse mode
2025-03-17 16:35:53 +01:00
badumbatish 29873023ed gccrs: Added options for ParseMode
gcc/rust/ChangeLog:

	* ast/rust-fmt.cc (Pieces::collect):
	Added options for ParseMode
	* ast/rust-fmt.h (collect_pieces): Likewise.
	(struct Pieces): Likewise.
	* expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler):
	Likewise.

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Likewise.
	* libformat_parser/src/bin.rs: Likewise.
	* libformat_parser/src/lib.rs: Likewise.
2025-03-17 16:35:53 +01:00
Kushal Pal d9167a76f4 gccrs: Fix nightly rustc warnings
libgrust/ChangeLog:

	* libformat_parser/Cargo.toml:
	Used crate-type instead of depricated crate_type.
	* libformat_parser/generic_format_parser/src/lib.rs:
	Remove dead code.
	* libformat_parser/src/lib.rs: Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2025-03-17 16:35:52 +01:00
Arthur Cohen be38c37fdc Rust: libformat_parser: Lower minimum Rust version to 1.49
libgrust/ChangeLog:

	* libformat_parser/Cargo.toml: Change Rust edition from 2021 to 2018.
	* libformat_parser/generic_format_parser/Cargo.toml: Likewise.
	* libformat_parser/generic_format_parser/src/lib.rs: Remove usage of
	then-unstable std features and language constructs.
	* libformat_parser/src/lib.rs: Likewise, plus provide extension trait
	for String::leak.
2024-12-09 10:48:40 +01:00
Thomas Schwinge 85f81ba60e Rust: Work around 'error[E0658]: `let...else` statements are unstable'
Compiling with Debian GNU/Linux 12 (bookworm) packages:

    $ apt-cache madison cargo rustc
         cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main ppc64el Packages
         cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main Sources
         rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main ppc64el Packages
         rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main Sources

..., we run into:

       Compiling generic_format_parser v0.1.0 ([...]/source-gcc/libgrust/libformat_parser/generic_format_parser)
    error[E0658]: `let...else` statements are unstable
       --> generic_format_parser/src/lib.rs:994:5
        |
    994 | /     let Some(unescaped) = unescape_string(snippet) else {
    995 | |         return InputStringKind::NotALiteral;
    996 | |     };
        | |______^
        |
        = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information

Rewrite backwards, per <https://rust-lang.github.io/rfcs/3137-let-else.html>.

	libgrust/
	* libformat_parser/generic_format_parser/src/lib.rs: Work around
	'error[E0658]: `let...else` statements are unstable'.
2024-12-09 10:48:40 +01:00
Arthur Cohen 433fbb1568 gccrs: format-parser: Add `is_some_and` method for Option<T>
Workaround for Ubuntu 18.04, since we still use it for the GCC 4.8 CI.
The default Rust package is 1.65 (and unlikely to change I assume?),
but the generic format parser library uses `is_some_and` which was
introduced in 1.70. So this is a simple reimplementation, directly taken
from the standard library sources.

libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Add IsSomeAnd<T>
	trait, impl it for Option<T>.
2024-08-01 13:11:29 +02:00
Arthur Cohen f7dafa7d4b gccrs: libformat_parser: Fix Rust warnings.
libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Remove
	unused deprecated attribute and unused import.
	* libformat_parser/src/lib.rs: Remove unused import.
2024-08-01 13:11:29 +02:00
Arthur Cohen 8647682e5a gccrs: libformat_parser: Add FFI safe interface
libgrust/ChangeLog:

	* libformat_parser/generic_format_parser/src/lib.rs: Add generic
	library.
	* libformat_parser/src/lib.rs: Add base for FFI interface.
2024-08-01 13:11:28 +02:00
Arthur Cohen 6fef4d6ffc gccrs: libgrust: Add format_parser library
Compile libformat_parser and link to it.

gcc/rust/ChangeLog:

	* Make-lang.in: Compile libformat_parser.
	* ast/rust-fmt.cc: New FFI definitions.
	* ast/rust-fmt.h: Likewise.
	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
	into libformat_parser.
	* expand/rust-macro-builtins.h: Define format_args!() handler proper.

libgrust/ChangeLog:

	* libformat_parser/Cargo.lock: New file.
	* libformat_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/Cargo.toml: New file.
	* libformat_parser/generic_format_parser/src/lib.rs: New file.
	* libformat_parser/src/bin.rs: New file.
	* libformat_parser/src/lib.rs: New file.
2024-08-01 12:47:19 +02:00