|
106 | 106 | clippy::vec_init_then_push |
107 | 107 | )] |
108 | 108 |
|
| 109 | +#[cfg(all(procmacro2_semver_exempt, wrap_proc_macro, not(super_unstable)))] |
| 110 | +compile_error! {"\ |
| 111 | + Something is not right. If you've tried to turn on \ |
| 112 | + procmacro2_semver_exempt, you need to ensure that it \ |
| 113 | + is turned on for the compilation of the proc-macro2 \ |
| 114 | + build script as well. |
| 115 | +"} |
| 116 | + |
109 | 117 | #[cfg(use_proc_macro)] |
110 | 118 | extern crate proc_macro; |
111 | 119 |
|
@@ -295,15 +303,15 @@ impl Error for LexError {} |
295 | 303 | /// The source file of a given `Span`. |
296 | 304 | /// |
297 | 305 | /// This type is semver exempt and not exposed by default. |
298 | | -#[cfg(procmacro2_semver_exempt)] |
| 306 | +#[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))] |
299 | 307 | #[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))] |
300 | 308 | #[derive(Clone, PartialEq, Eq)] |
301 | 309 | pub struct SourceFile { |
302 | 310 | inner: imp::SourceFile, |
303 | 311 | _marker: Marker, |
304 | 312 | } |
305 | 313 |
|
306 | | -#[cfg(procmacro2_semver_exempt)] |
| 314 | +#[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))] |
307 | 315 | impl SourceFile { |
308 | 316 | fn _new(inner: imp::SourceFile) -> Self { |
309 | 317 | SourceFile { |
@@ -336,7 +344,7 @@ impl SourceFile { |
336 | 344 | } |
337 | 345 | } |
338 | 346 |
|
339 | | -#[cfg(procmacro2_semver_exempt)] |
| 347 | +#[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))] |
340 | 348 | impl Debug for SourceFile { |
341 | 349 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
342 | 350 | Debug::fmt(&self.inner, f) |
@@ -461,7 +469,7 @@ impl Span { |
461 | 469 | /// The original source file into which this span points. |
462 | 470 | /// |
463 | 471 | /// This method is semver exempt and not exposed by default. |
464 | | - #[cfg(procmacro2_semver_exempt)] |
| 472 | + #[cfg(all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)))] |
465 | 473 | #[cfg_attr(doc_cfg, doc(cfg(procmacro2_semver_exempt)))] |
466 | 474 | pub fn source_file(&self) -> SourceFile { |
467 | 475 | SourceFile::_new(self.inner.source_file()) |
|
0 commit comments