@@ -20,6 +20,7 @@ fn main() {
2020 println ! ( "cargo:rustc-check-cfg=cfg(no_literal_c_string)" ) ;
2121 println ! ( "cargo:rustc-check-cfg=cfg(no_source_text)" ) ;
2222 println ! ( "cargo:rustc-check-cfg=cfg(proc_macro_span)" ) ;
23+ println ! ( "cargo:rustc-check-cfg=cfg(proc_macro_span_location)" ) ;
2324 println ! ( "cargo:rustc-check-cfg=cfg(procmacro2_backtrace)" ) ;
2425 println ! ( "cargo:rustc-check-cfg=cfg(procmacro2_nightly_testing)" ) ;
2526 println ! ( "cargo:rustc-check-cfg=cfg(procmacro2_semver_exempt)" ) ;
@@ -70,37 +71,43 @@ fn main() {
7071 println ! ( "cargo:rerun-if-changed=build/probe.rs" ) ;
7172
7273 let proc_macro_span;
74+ let proc_macro_span_location;
7375 let consider_rustc_bootstrap;
7476 if compile_probe ( false ) {
7577 // This is a nightly or dev compiler, so it supports unstable features
7678 // regardless of RUSTC_BOOTSTRAP. No need to rerun build script if
7779 // RUSTC_BOOTSTRAP is changed.
7880 proc_macro_span = true ;
81+ proc_macro_span_location = true ;
7982 consider_rustc_bootstrap = false ;
8083 } else if let Some ( rustc_bootstrap) = env:: var_os ( "RUSTC_BOOTSTRAP" ) {
8184 if compile_probe ( true ) {
8285 // This is a stable or beta compiler for which the user has set
8386 // RUSTC_BOOTSTRAP to turn on unstable features. Rerun build script
8487 // if they change it.
8588 proc_macro_span = true ;
89+ proc_macro_span_location = true ;
8690 consider_rustc_bootstrap = true ;
8791 } else if rustc_bootstrap == "1" {
8892 // This compiler does not support the proc macro Span API in the
8993 // form that proc-macro2 expects. No need to pay attention to
9094 // RUSTC_BOOTSTRAP.
9195 proc_macro_span = false ;
96+ proc_macro_span_location = rustc >= 88 ;
9297 consider_rustc_bootstrap = false ;
9398 } else {
9499 // This is a stable or beta compiler for which RUSTC_BOOTSTRAP is
95100 // set to restrict the use of unstable features by this crate.
96101 proc_macro_span = false ;
102+ proc_macro_span_location = rustc >= 88 ;
97103 consider_rustc_bootstrap = true ;
98104 }
99105 } else {
100106 // Without RUSTC_BOOTSTRAP, this compiler does not support the proc
101107 // macro Span API in the form that proc-macro2 expects, but try again if
102108 // the user turns on unstable features.
103109 proc_macro_span = false ;
110+ proc_macro_span_location = rustc >= 88 ;
104111 consider_rustc_bootstrap = true ;
105112 }
106113
@@ -115,13 +122,19 @@ fn main() {
115122 }
116123
117124 if proc_macro_span {
118- // Enable non-dummy behavior of Span::start and Span::end methods which
119- // requires an unstable compiler feature. Enabled when building with
120- // nightly, unless `-Z allow-feature` in RUSTFLAGS disallows unstable
121- // features.
125+ // Enable non-dummy behavior of Span::byte_range and Span::join methods
126+ // which requires an unstable compiler feature. Enabled when building
127+ // with nightly, unless `-Z allow-feature` in RUSTFLAGS disallows
128+ // unstable features.
122129 println ! ( "cargo:rustc-cfg=proc_macro_span" ) ;
123130 }
124131
132+ if proc_macro_span_location {
133+ // Enable non-dummy behavior of Span::start and Span::end methods which
134+ // requires Rust 1.88.
135+ println ! ( "cargo:rustc-cfg=proc_macro_span_location" ) ;
136+ }
137+
125138 if semver_exempt && proc_macro_span {
126139 // Implement the semver exempt API in terms of the nightly-only
127140 // proc_macro API.
0 commit comments