diff options
author | David Tolnay <dtolnay@gmail.com> | 2018-11-11 13:33:18 -0800 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2018-11-11 15:57:04 -0800 |
commit | 7e654a8bad9a9e07df568e582610f8a91b5ccffe (patch) | |
tree | 49f13481258b6365d895e1cb08703343224f4969 /src/lib.rs | |
parent | 102ee29e36c15ca68a6f6ec7d37b04571997a8f4 (diff) | |
download | proc-macro2-7e654a8bad9a9e07df568e582610f8a91b5ccffe.tar.gz |
Remove Send and Sync from SourceFile
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -220,10 +220,20 @@ pub use imp::FileName; /// This type is semver exempt and not exposed by default. #[cfg(procmacro2_semver_exempt)] #[derive(Clone, PartialEq, Eq)] -pub struct SourceFile(imp::SourceFile); +pub struct SourceFile { + inner: imp::SourceFile, + _marker: marker::PhantomData<Rc<()>>, +} #[cfg(procmacro2_semver_exempt)] impl SourceFile { + fn _new(inner: imp::SourceFile) -> Self { + SourceFile { + inner: inner, + _marker: marker::PhantomData, + } + } + /// Get the path to this source file. /// /// ### Note @@ -238,27 +248,27 @@ impl SourceFile { /// /// [`is_real`]: #method.is_real pub fn path(&self) -> &FileName { - self.0.path() + self.inner.path() } /// Returns `true` if this source file is a real source file, and not /// generated by an external macro's expansion. pub fn is_real(&self) -> bool { - self.0.is_real() + self.inner.is_real() } } #[cfg(procmacro2_semver_exempt)] impl AsRef<FileName> for SourceFile { fn as_ref(&self) -> &FileName { - self.0.path() + self.inner.path() } } #[cfg(procmacro2_semver_exempt)] impl fmt::Debug for SourceFile { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.fmt(f) + self.inner.fmt(f) } } @@ -344,7 +354,7 @@ impl Span { /// This method is semver exempt and not exposed by default. #[cfg(procmacro2_semver_exempt)] pub fn source_file(&self) -> SourceFile { - SourceFile(self.inner.source_file()) + SourceFile::_new(self.inner.source_file()) } /// Get the starting line/column in the source file for this span. |