summaryrefslogtreecommitdiffstats
path: root/vendor/thiserror/build.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/thiserror/build.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/thiserror/build.rs')
-rw-r--r--vendor/thiserror/build.rs45
1 files changed, 37 insertions, 8 deletions
diff --git a/vendor/thiserror/build.rs b/vendor/thiserror/build.rs
index 004dfb015..7983a2b07 100644
--- a/vendor/thiserror/build.rs
+++ b/vendor/thiserror/build.rs
@@ -4,27 +4,56 @@ use std::path::Path;
use std::process::{Command, ExitStatus, Stdio};
use std::str;
-// This code exercises the surface area that we expect of the Provider API. If
-// the current toolchain is able to compile it, then thiserror is able to use
-// providers for backtrace support.
+// This code exercises the surface area that we expect of the Error generic
+// member access API. If the current toolchain is able to compile it, then
+// thiserror is able to provide backtrace support.
const PROBE: &str = r#"
- #![feature(provide_any)]
+ #![feature(error_generic_member_access)]
- use std::any::{Demand, Provider};
+ use std::error::{Error, Request};
+ use std::fmt::{self, Debug, Display};
- fn _f<'a, P: Provider>(p: &'a P, demand: &mut Demand<'a>) {
- p.provide(demand);
+ struct MyError(Thing);
+ struct Thing;
+
+ impl Debug for MyError {
+ fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result {
+ unimplemented!()
+ }
+ }
+
+ impl Display for MyError {
+ fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result {
+ unimplemented!()
+ }
+ }
+
+ impl Error for MyError {
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ request.provide_ref(&self.0);
+ }
}
"#;
fn main() {
match compile_probe() {
- Some(status) if status.success() => println!("cargo:rustc-cfg=provide_any"),
+ Some(status) if status.success() => println!("cargo:rustc-cfg=error_generic_member_access"),
_ => {}
}
}
fn compile_probe() -> Option<ExitStatus> {
+ if env::var_os("RUSTC_STAGE").is_some() {
+ // We are running inside rustc bootstrap. This is a highly non-standard
+ // environment with issues such as:
+ //
+ // https://github.com/rust-lang/cargo/issues/11138
+ // https://github.com/rust-lang/rust/issues/114839
+ //
+ // Let's just not use nightly features here.
+ return None;
+ }
+
let rustc = env::var_os("RUSTC")?;
let out_dir = env::var_os("OUT_DIR")?;
let probefile = Path::new(&out_dir).join("probe.rs");