tamer: span (DUMMY_SPAN): New constant
Rather than having to use lazy_static! in all these tests, we can derive an unlimited number of dummy spans from this one using e.g. `offset_add`.main
parent
cf239531e0
commit
cde08b125c
|
@ -372,6 +372,16 @@ impl From<Span> for (Span, Span) {
|
|||
}
|
||||
}
|
||||
|
||||
/// A dummy span that can be used in contexts where a span is expected but
|
||||
/// is not important.
|
||||
///
|
||||
/// This is intended primarily for tests;
|
||||
/// you should always use an appropriate span to permit sensible error
|
||||
/// messages and source analysis.
|
||||
///
|
||||
/// Additional dummy spans can be derived from this one.
|
||||
pub const DUMMY_SPAN: Span = Span::st_ctx(crate::sym::st16::CTX_DUMMY);
|
||||
|
||||
/// Context for byte offsets (e.g. a source file).
|
||||
///
|
||||
/// A context is lifetime-free and [`Copy`]-able,
|
||||
|
|
|
@ -461,6 +461,7 @@ pub mod st16 {
|
|||
<u16>;
|
||||
|
||||
// Special contexts.
|
||||
CTX_DUMMY: ctx "#!DUMMY",
|
||||
CTX_LINKER: ctx "#!LINKER",
|
||||
|
||||
// [Symbols will be added here as they are needed.]
|
||||
|
|
Loading…
Reference in New Issue