Skip to content
Myr

Remove support for compilers without Arguments::as_str

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 7e533c7 · Browse files · 2 files+1 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+1 added−11 removed

  • other:+1 added−11 removed

2 files+1 added−11 removed

modified:src/lib.rs+1 added-6 removed
683 unmodified lines
684 #[doc(hidden)]685 #[inline]686 #[cold]687 pub fn format_err(args: Arguments) -> Error {688 #[cfg(anyhow_no_fmt_arguments_as_str)]689 let fmt_arguments_as_str = None::<&str>;690 #[cfg(not(anyhow_no_fmt_arguments_as_str))]691 let fmt_arguments_as_str = args.as_str();692693 if let Some(message) = fmt_arguments_as_str {688 if let Some(message) = args.as_str() {689 // anyhow!("literal"), can downcast to &'static str690 Error::msg(message)691 } else {692 // anyhow!("interpolate {var}"), can downcast to String
39 unmodified lines
modified:build.rs-5 removed
71 unmodified lines
72 println!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)");73 println!("cargo:rustc-check-cfg=cfg(anyhow_no_clippy_format_args)");74 println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_error)");75 println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_unwind_safe)");76 println!("cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)");76 println!("cargo:rustc-check-cfg=cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)");77 println!("cargo:rustc-check-cfg=cfg(error_generic_member_access)");78 println!("cargo:rustc-check-cfg=cfg(std_backtrace)");79 }8081 if rustc < 52 {83 // core::fmt::Arguments::as_str84 // https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html#stabilized-apis85 println!("cargo:rustc-cfg=anyhow_no_fmt_arguments_as_str");8682 // #![deny(unsafe_op_in_unsafe_fn)]83 // https://github.com/rust-lang/rust/issues/7166884 println!("cargo:rustc-cfg=anyhow_no_unsafe_op_in_unsafe_fn_lint");85 }
135 unmodified lines