Skip to content

Commit d9deb19

Browse files
committed
mv proc_macro::SourceFile proc_macro::OriginalSourceFile
1 parent bffeb51 commit d9deb19

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/libproc_macro/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ impl Span {
306306

307307
/// The original source file into which this span points.
308308
#[unstable(feature = "proc_macro_span", issue = "38356")]
309-
pub fn source_file(&self) -> SourceFile {
310-
SourceFile {
309+
pub fn original_source_file(&self) -> OriginalSourceFile {
310+
OriginalSourceFile {
311311
filemap: __internal::lookup_char_pos(self.0.lo()).file,
312312
}
313313
}
@@ -418,20 +418,20 @@ impl !Sync for LineColumn {}
418418
/// The source file of a given `Span`.
419419
#[unstable(feature = "proc_macro_span", issue = "38356")]
420420
#[derive(Clone)]
421-
pub struct SourceFile {
421+
pub struct OriginalSourceFile {
422422
filemap: Lrc<FileMap>,
423423
}
424424

425425
#[unstable(feature = "proc_macro_span", issue = "38356")]
426-
impl !Send for SourceFile {}
426+
impl !Send for OriginalSourceFile {}
427427
#[unstable(feature = "proc_macro_span", issue = "38356")]
428-
impl !Sync for SourceFile {}
428+
impl !Sync for OriginalSourceFile {}
429429

430-
impl SourceFile {
430+
impl OriginalSourceFile {
431431
/// Get the path to this source file.
432432
///
433433
/// ### Note
434-
/// If the code span associated with this `SourceFile` was generated by an external macro, this
434+
/// If the code span associated with this `OriginalSourceFile` was generated by an external macro, this
435435
/// may not be an actual path on the filesystem. Use [`is_real`] to check.
436436
///
437437
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
@@ -459,24 +459,24 @@ impl SourceFile {
459459

460460

461461
#[unstable(feature = "proc_macro_span", issue = "38356")]
462-
impl fmt::Debug for SourceFile {
462+
impl fmt::Debug for OriginalSourceFile {
463463
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
464-
f.debug_struct("SourceFile")
464+
f.debug_struct("OriginalSourceFile")
465465
.field("path", &self.path())
466466
.field("is_real", &self.is_real())
467467
.finish()
468468
}
469469
}
470470

471471
#[unstable(feature = "proc_macro_span", issue = "38356")]
472-
impl PartialEq for SourceFile {
472+
impl PartialEq for OriginalSourceFile {
473473
fn eq(&self, other: &Self) -> bool {
474474
Lrc::ptr_eq(&self.filemap, &other.filemap)
475475
}
476476
}
477477

478478
#[unstable(feature = "proc_macro_span", issue = "38356")]
479-
impl Eq for SourceFile {}
479+
impl Eq for OriginalSourceFile {}
480480

481481
/// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`).
482482
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]

src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn reemit(input: TokenStream) -> TokenStream {
2727
#[proc_macro]
2828
pub fn assert_fake_source_file(input: TokenStream) -> TokenStream {
2929
for tk in input {
30-
let source_file = tk.span().source_file();
30+
let source_file = tk.span().original_source_file();
3131
assert!(!source_file.is_real(), "Source file is real: {:?}", source_file);
3232
}
3333

@@ -37,7 +37,7 @@ pub fn assert_fake_source_file(input: TokenStream) -> TokenStream {
3737
#[proc_macro]
3838
pub fn assert_source_file(input: TokenStream) -> TokenStream {
3939
for tk in input {
40-
let source_file = tk.span().source_file();
40+
let source_file = tk.span().original_source_file();
4141
assert!(source_file.is_real(), "Source file is not real: {:?}", source_file);
4242
}
4343

0 commit comments

Comments
 (0)