aboutsummaryrefslogtreecommitdiff
path: root/libgrust/libformat_parser/src
AgeCommit message (Collapse)AuthorFilesLines
2025-03-31rust: Lower minimum supported Rust version to 1.49Arthur Cohen1-0/+11
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-17gccrs: Fix ffi and enum conventionsbadumbatish2-21/+24
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-17gccrs: Added options for ParseModebadumbatish2-3/+7
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-17gccrs: Fix nightly rustc warningsKushal Pal1-14/+0
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>
2024-12-09Rust: libformat_parser: Lower minimum Rust version to 1.49Arthur Cohen1-8/+11
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-09Rust: Work around 'error[E0599]: no method named `leak` found for struct ↵Thomas Schwinge1-3/+10
`std::string::String` in the current scope' 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 libformat_parser v0.1.0 ([...]/source-gcc/libgrust/libformat_parser) error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope --> src/lib.rs:396:18 | 396 | ptr: str.leak().as_ptr(), | ^^^^ method not found in `std::string::String` error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope --> src/lib.rs:434:7 | 434 | s.leak(); | ^^^^ method not found in `std::string::String` error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope --> src/lib.rs:439:23 | 439 | ptr: cloned_s.leak().as_ptr(), | ^^^^ method not found in `std::string::String` Locally replace 1.72.0+ method 'leak' for struct 'std::string::String'. libgrust/ * libformat_parser/src/lib.rs: Work around 'error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope'.
2024-08-01gccrs: format-args: Start storing string in Rust memoryArthur Cohen1-25/+80
gcc/rust/ChangeLog: * ast/rust-fmt.cc (ffi::RustHamster::to_string): New. (Pieces::collect): Adapt to use new handle API. (Pieces::~Pieces): Likewise. (Pieces::Pieces): Likewise. (Pieces::operator=): Likewise. * ast/rust-fmt.h (struct RustString): Add members. (struct FormatArgsHandle): New. (clone_pieces): Adapt for new FFI API. (destroy_pieces): Likewise. (struct Pieces): Store new FormatArgsHandle type. * expand/rust-expand-format-args.cc (expand_format_args): Use proper namespace. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): FormatArgs nodes are already resolved, so do nothing. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Use new Handle struct and expose it.
2024-08-01gccrs: format-args: Fix Rust interface and add input parsing.Arthur Cohen2-20/+48
gcc/rust/ChangeLog: * ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr * ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers. * ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function. * ast/rust-fmt.h (collect_pieces): Likewise. (struct Pieces): Add append_newline parameter. * expand/rust-macro-builtins.cc: Add proper parsing of format_args input. * hir/rust-ast-lower-base.cc: Include diagnostics header. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Switch interface to use more parser parameters. * libformat_parser/src/bin.rs: Use new interface.
2024-08-01gccrs: libformat_parser: Fix Rust warnings.Arthur Cohen1-1/+1
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-01gccrs: rust-fmt: Store parsed string in Pieces structArthur Cohen1-0/+1
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership of the given string. * ast/rust-fmt.h (struct Pieces): Store parsed string in the struct. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add debug prompt.
2024-08-01gccrs: libformat_parser: Send boxed values across FFI properlyArthur Cohen1-48/+46
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release function in destructor. * ast/rust-fmt.h (struct PieceSlice): Add capacity. (destroy_pieces): New. (struct Pieces): Add destructor. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Leak Boxes properly for C++ to see them, add memory release function.
2024-08-01gccrs: libformat_parser: Update header and remove old interfaceArthur Cohen1-13/+43
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Use new Pieces API. * ast/rust-fmt.h: Update interface with new FFI bindings. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add IntoFFI trait. * libformat_parser/libformat-parser.h: Removed.
2024-08-01gccrs: libformat_parser: Add FFI safe interfaceArthur Cohen1-4/+297
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-01gccrs: libgrust: Add format_parser libraryArthur Cohen2-0/+48
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.