Skip to content

Commit a01ca8e

Browse files
committed
Mark types and methods that are semver exempt
1 parent 9ecce0d commit a01ca8e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ impl fmt::Debug for LexError {
193193
pub use imp::FileName;
194194

195195
/// The source file of a given `Span`.
196+
///
197+
/// This type is semver exempt and not exposed by default.
196198
#[cfg(procmacro2_semver_exempt)]
197199
#[derive(Clone, PartialEq, Eq)]
198200
pub struct SourceFile(imp::SourceFile);
@@ -238,6 +240,8 @@ impl fmt::Debug for SourceFile {
238240
}
239241

240242
/// A line-column pair representing the start or end of a `Span`.
243+
///
244+
/// This type is semver exempt and not exposed by default.
241245
#[cfg(procmacro2_semver_exempt)]
242246
pub struct LineColumn {
243247
/// The 1-indexed line in the source file on which the span starts or ends
@@ -280,20 +284,26 @@ impl Span {
280284
}
281285

282286
/// A span that resolves at the macro definition site.
287+
///
288+
/// This method is semver exempt and not exposed by default.
283289
#[cfg(procmacro2_semver_exempt)]
284290
pub fn def_site() -> Span {
285291
Span::_new(imp::Span::def_site())
286292
}
287293

288294
/// Creates a new span with the same line/column information as `self` but
289295
/// that resolves symbols as though it were at `other`.
296+
///
297+
/// This method is semver exempt and not exposed by default.
290298
#[cfg(procmacro2_semver_exempt)]
291299
pub fn resolved_at(&self, other: Span) -> Span {
292300
Span::_new(self.inner.resolved_at(other.inner))
293301
}
294302

295303
/// Creates a new span with the same name resolution behavior as `self` but
296304
/// with the line/column information of `other`.
305+
///
306+
/// This method is semver exempt and not exposed by default.
297307
#[cfg(procmacro2_semver_exempt)]
298308
pub fn located_at(&self, other: Span) -> Span {
299309
Span::_new(self.inner.located_at(other.inner))
@@ -306,12 +316,16 @@ impl Span {
306316
}
307317

308318
/// The original source file into which this span points.
319+
///
320+
/// This method is semver exempt and not exposed by default.
309321
#[cfg(procmacro2_semver_exempt)]
310322
pub fn source_file(&self) -> SourceFile {
311323
SourceFile(self.inner.source_file())
312324
}
313325

314326
/// Get the starting line/column in the source file for this span.
327+
///
328+
/// This method is semver exempt and not exposed by default.
315329
#[cfg(procmacro2_semver_exempt)]
316330
pub fn start(&self) -> LineColumn {
317331
let imp::LineColumn { line, column } = self.inner.start();
@@ -322,6 +336,8 @@ impl Span {
322336
}
323337

324338
/// Get the ending line/column in the source file for this span.
339+
///
340+
/// This method is semver exempt and not exposed by default.
325341
#[cfg(procmacro2_semver_exempt)]
326342
pub fn end(&self) -> LineColumn {
327343
let imp::LineColumn { line, column } = self.inner.end();
@@ -334,12 +350,16 @@ impl Span {
334350
/// Create a new span encompassing `self` and `other`.
335351
///
336352
/// Returns `None` if `self` and `other` are from different files.
353+
///
354+
/// This method is semver exempt and not exposed by default.
337355
#[cfg(procmacro2_semver_exempt)]
338356
pub fn join(&self, other: Span) -> Option<Span> {
339357
self.inner.join(other.inner).map(Span::_new)
340358
}
341359

342360
/// Compares to spans to see if they're equal.
361+
///
362+
/// This method is semver exempt and not exposed by default.
343363
#[cfg(procmacro2_semver_exempt)]
344364
pub fn eq(&self, other: &Span) -> bool {
345365
self.inner.eq(&other.inner)
@@ -758,6 +778,8 @@ impl Ident {
758778
}
759779

760780
/// Same as `Ident::new`, but creates a raw identifier (`r#ident`).
781+
///
782+
/// This method is semver exempt and not exposed by default.
761783
#[cfg(procmacro2_semver_exempt)]
762784
pub fn new_raw(string: &str, span: Span) -> Ident {
763785
Ident::_new_raw(string, span)

0 commit comments

Comments
 (0)