Hi! On 2025-03-17T16:33:34+0100, arthur.co...@embecosm.com wrote: > From: Kushal Pal <kushalpal...@gmail.com> > > 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 <kushalpal...@gmail.com>
This isn't "dead code" on a Debian "bookworm" system where I'm testing with: $ rustc --version rustc 1.63.0 With this commit in place, I get: [...] Making all in libformat_parser make[3]: Entering directory '[...]/build-gcc/libgrust/libformat_parser' cargo \ --config [...]/source-gcc/libgrust/libformat_parser/.cargo/config \ build \ --offline \ --target-dir . \ --manifest-path [...]/source-gcc/libgrust/libformat_parser/Cargo.toml \ # FIXME: Not always '--release', right? Compiling generic_format_parser v0.1.0 ([...]/source-gcc/libgrust/libformat_parser/generic_format_parser) error[E0658]: use of unstable library feature 'is_some_with' --> generic_format_parser/src/lib.rs:615:34 | 615 | ... .is_some_and(is_id_start) | ^^^^^^^^^^^ | = note: see issue #93050 <https://github.com/rust-lang/rust/issues/93050> for more information error[E0631]: type mismatch in function arguments --> generic_format_parser/src/lib.rs:615:46 | 17 | fn is_id_start(c: char) -> bool { | ------------------------------- found signature of `fn(char) -> _` ... 615 | .is_some_and(is_id_start) | ----------- ^^^^^^^^^^^ expected signature of `for<'r> fn(&'r char) -> _` | | | required by a bound introduced by this call | note: required by a bound in `Option::<T>::is_some_and` Some errors have detailed explanations: E0631, E0658. For more information about an error, try `rustc --explain E0631`. error: could not compile `generic_format_parser` due to 2 previous errors make[3]: *** [Makefile:431: debug/liblibformat_parser.a] Error 101 make[3]: Target 'all' not remade because of errors. make[3]: Leaving directory '[...]/build-gcc/libgrust/libformat_parser' [...] With this commit reverted, the build again succeeds, with good test results. May I, therefore, push a (partial, I suppose?) 'git revert' of this commit? Grüße Thomas > --- > libgrust/libformat_parser/Cargo.toml | 2 +- > .../generic_format_parser/src/lib.rs | 16 ---------------- > libgrust/libformat_parser/src/lib.rs | 14 -------------- > 3 files changed, 1 insertion(+), 31 deletions(-) > > diff --git a/libgrust/libformat_parser/Cargo.toml > b/libgrust/libformat_parser/Cargo.toml > index 3c214915d31..39c017d249b 100644 > --- a/libgrust/libformat_parser/Cargo.toml > +++ b/libgrust/libformat_parser/Cargo.toml > @@ -14,7 +14,7 @@ libc = "0.2" > generic_format_parser = { path = "generic_format_parser" } > > [lib] > -crate_type = ["staticlib", "rlib"] > +crate-type = ["staticlib", "rlib"] > > [[bin]] > name = "format_parser_test" > diff --git a/libgrust/libformat_parser/generic_format_parser/src/lib.rs > b/libgrust/libformat_parser/generic_format_parser/src/lib.rs > index e255bf16908..25f6b0ead17 100644 > --- a/libgrust/libformat_parser/generic_format_parser/src/lib.rs > +++ b/libgrust/libformat_parser/generic_format_parser/src/lib.rs > @@ -22,22 +22,6 @@ fn is_id_continue(c: char) -> bool { > unicode_xid::UnicodeXID::is_xid_continue(c) > } > > -// Workaround for Ubuntu 18.04. 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 reimplementation, > -// directly taken from the standard library sources > -trait IsSomeAnd<T> { > - fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool; > -} > - > -impl<T> IsSomeAnd<T> for Option<T> { > - fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool { > - match self { > - None => false, > - Some(x) => f(x), > - } > - } > -} > - > // use rustc_lexer::unescape; > pub use Alignment::*; > pub use Count::*; > diff --git a/libgrust/libformat_parser/src/lib.rs > b/libgrust/libformat_parser/src/lib.rs > index 0769577740f..f4670bf9b1f 100644 > --- a/libgrust/libformat_parser/src/lib.rs > +++ b/libgrust/libformat_parser/src/lib.rs > @@ -5,16 +5,6 @@ > > use std::ffi::CStr; > > -trait StringLeakExt { > - fn leak<'a>(self) -> &'a mut str; > -} > - > -impl StringLeakExt for String { > - fn leak<'a>(self) -> &'a mut str { > - Box::leak(self.into_boxed_str()) > - } > -} > - > trait IntoFFI<T> { > fn into_ffi(self) -> T; > } > @@ -98,10 +88,6 @@ mod ffi { > // InlineAsm, > // } > > - #[derive(Copy, Clone)] > - #[repr(C)] > - struct InnerOffset(usize); > - > /// A piece is a portion of the format string which represents the next > part > /// to emit. These are emitted as a stream by the `Parser` class. > #[derive(Debug, Clone, PartialEq)] > -- > 2.45.2