summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:38:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 05:38:31 +0000
commit017a0f00b2f35e8f0d3c5175d558cd4e706c305d (patch)
tree669ae5e120a957271aafa639969279bac10004e4 /build
parentReleasing progress-linux version 1.0.76-1~progress7.99u1. (diff)
downloadrust-proc-macro2-017a0f00b2f35e8f0d3c5175d558cd4e706c305d.tar.xz
rust-proc-macro2-017a0f00b2f35e8f0d3c5175d558cd4e706c305d.zip
Merging upstream version 1.0.81.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--build.rs26
-rw-r--r--build/probe.rs6
2 files changed, 21 insertions, 11 deletions
diff --git a/build.rs b/build.rs
index 3347f87..656c569 100644
--- a/build.rs
+++ b/build.rs
@@ -36,10 +36,10 @@
use std::env;
use std::ffi::OsString;
+use std::iter;
use std::path::Path;
use std::process::{self, Command, Stdio};
use std::str;
-use std::u32;
fn main() {
let rustc = rustc_minor_version().unwrap_or(u32::MAX);
@@ -63,6 +63,11 @@ fn main() {
println!("cargo:rustc-cfg=no_source_text");
}
+ if rustc < 79 {
+ println!("cargo:rustc-cfg=no_literal_byte_character");
+ println!("cargo:rustc-cfg=no_literal_c_string");
+ }
+
if !cfg!(feature = "proc-macro") {
println!("cargo:rerun-if-changed=build.rs");
return;
@@ -138,15 +143,15 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
let out_dir = cargo_env_var("OUT_DIR");
let probefile = Path::new("build").join("probe.rs");
- // Make sure to pick up Cargo rustc configuration.
- let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER") {
- let mut cmd = Command::new(wrapper);
- // The wrapper's first argument is supposed to be the path to rustc.
- cmd.arg(rustc);
- cmd
- } else {
- Command::new(rustc)
- };
+ let rustc_wrapper = env::var_os("RUSTC_WRAPPER").filter(|wrapper| !wrapper.is_empty());
+ let rustc_workspace_wrapper =
+ env::var_os("RUSTC_WORKSPACE_WRAPPER").filter(|wrapper| !wrapper.is_empty());
+ let mut rustc = rustc_wrapper
+ .into_iter()
+ .chain(rustc_workspace_wrapper)
+ .chain(iter::once(rustc));
+ let mut cmd = Command::new(rustc.next().unwrap());
+ cmd.args(rustc);
if !rustc_bootstrap {
cmd.env_remove("RUSTC_BOOTSTRAP");
@@ -156,6 +161,7 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
.arg("--edition=2021")
.arg("--crate-name=proc_macro2")
.arg("--crate-type=lib")
+ .arg("--cap-lints=allow")
.arg("--emit=dep-info,metadata")
.arg("--out-dir")
.arg(out_dir)
diff --git a/build/probe.rs b/build/probe.rs
index 5afa13a..2c4947a 100644
--- a/build/probe.rs
+++ b/build/probe.rs
@@ -6,9 +6,13 @@
extern crate proc_macro;
-use core::ops::RangeBounds;
+use core::ops::{Range, RangeBounds};
use proc_macro::{Literal, Span};
+pub fn byte_range(this: &Span) -> Range<usize> {
+ this.byte_range()
+}
+
pub fn join(this: &Span, other: Span) -> Option<Span> {
this.join(other)
}