mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-19 03:03:21 +00:00
Update rental
hack to work with remapped paths.
This commit is contained in:
parent
5ca6f7d2c3
commit
496edf97c5
@ -31,11 +31,11 @@ use rustc_span::edition::Edition;
|
||||
use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId};
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, FileName, RealFileName, Span, DUMMY_SP};
|
||||
use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
use std::iter;
|
||||
use std::path::PathBuf;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::rc::Rc;
|
||||
|
||||
pub(crate) use rustc_span::hygiene::MacroKind;
|
||||
@ -1423,8 +1423,10 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &ParseSess) -> bool {
|
||||
if let [variant] = &*enum_def.variants {
|
||||
if variant.ident.name == sym::Input {
|
||||
let filename = sess.source_map().span_to_filename(item.ident.span);
|
||||
if let FileName::Real(RealFileName::LocalPath(path)) = filename {
|
||||
if let Some(c) = path
|
||||
if let FileName::Real(real) = filename {
|
||||
if let Some(c) = real
|
||||
.local_path()
|
||||
.unwrap_or(Path::new(""))
|
||||
.components()
|
||||
.flat_map(|c| c.as_os_str().to_str())
|
||||
.find(|c| c.starts_with("rental") || c.starts_with("allsorts-rental"))
|
||||
|
179
tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
Normal file
179
tests/ui/proc-macro/pretty-print-hack-show.remapped.stderr
Normal file
@ -0,0 +1,179 @@
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: using an old version of `rental`
|
||||
--> remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6
|
||||
|
|
||||
LL | enum ProceduralMasqueradeDummyType {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #83125 <https://github.com/rust-lang/rust/issues/83125>
|
||||
= note: older versions of the `rental` crate will stop compiling in future versions of Rust; please update to `rental` v0.5.6, or switch to one of the `rental` alternatives
|
||||
= note: `#[deny(proc_macro_back_compat)]` on by default
|
||||
|
44
tests/ui/proc-macro/pretty-print-hack-show.remapped.stdout
Normal file
44
tests/ui/proc-macro/pretty-print-hack-show.remapped.stdout
Normal file
@ -0,0 +1,44 @@
|
||||
PRINT-DERIVE INPUT (DISPLAY): enum ProceduralMasqueradeDummyType { Input, }
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): enum ProceduralMasqueradeDummyType { Input }
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "enum",
|
||||
span: remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:1: 4:5 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "ProceduralMasqueradeDummyType",
|
||||
span: remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:6: 4:35 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "Input",
|
||||
span: remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:13:5: 13:10 (#0),
|
||||
},
|
||||
],
|
||||
span: remapped/proc-macro/pretty-print-hack/allsorts-rental-0.5.6/src/lib.rs:4:36: 14:2 (#0),
|
||||
},
|
||||
]
|
||||
PRINT-DERIVE INPUT (DISPLAY): enum ProceduralMasqueradeDummyType { Input, }
|
||||
PRINT-DERIVE RE-COLLECTED (DISPLAY): enum ProceduralMasqueradeDummyType { Input }
|
||||
PRINT-DERIVE INPUT (DEBUG): TokenStream [
|
||||
Ident {
|
||||
ident: "enum",
|
||||
span: remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:1: 4:5 (#0),
|
||||
},
|
||||
Ident {
|
||||
ident: "ProceduralMasqueradeDummyType",
|
||||
span: remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:6: 4:35 (#0),
|
||||
},
|
||||
Group {
|
||||
delimiter: Brace,
|
||||
stream: TokenStream [
|
||||
Ident {
|
||||
ident: "Input",
|
||||
span: remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:13:5: 13:10 (#0),
|
||||
},
|
||||
],
|
||||
span: remapped/proc-macro/pretty-print-hack/rental-0.5.5/src/lib.rs:4:36: 14:2 (#0),
|
||||
},
|
||||
]
|
@ -1,5 +1,11 @@
|
||||
// aux-build:test-macros.rs
|
||||
// compile-flags: -Z span-debug
|
||||
// revisions: local remapped
|
||||
// [remapped]compile-flags: --remap-path-prefix={{src-base}}=remapped
|
||||
|
||||
// The remapped paths are not normalized by compiletest.
|
||||
// normalize-stdout-test: "\\(proc-macro|pretty-print-hack)" -> "/$1"
|
||||
// normalize-stderr-test: "\\(proc-macro|pretty-print-hack)" -> "/$1"
|
||||
|
||||
#![no_std] // Don't load unnecessary hygiene information from std
|
||||
extern crate std;
|
||||
|
Loading…
Reference in New Issue
Block a user