diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-12 04:22:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-12 04:22:47 +0200 |
| commit | d78260d7811953b8ff28d378858f96782f95a523 (patch) | |
| tree | 36959e6a04f1f903ef43cf5dab893a224a541735 /src/libsyntax_pos | |
| parent | b5184e56a49652aadb279e42a4e55e7328071b35 (diff) | |
| parent | 45df52f2cca9bee04690f476f4a3f791ea1b04cc (diff) | |
| download | rust-d78260d7811953b8ff28d378858f96782f95a523.tar.gz rust-d78260d7811953b8ff28d378858f96782f95a523.zip | |
Rollup merge of #61568 - Mark-Simulacrum:symbol-fmt-macros, r=estebank
Use Symbol, Span in libfmt_macros I'm not super happy with this, personally, but I think it might be a decent start -- happy to take suggestions as to how to expand this or change things further. r? @estebank Fixes #60795
Diffstat (limited to 'src/libsyntax_pos')
| -rw-r--r-- | src/libsyntax_pos/lib.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax_pos/symbol.rs | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 649ab81198d..e7158372762 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -505,10 +505,10 @@ impl Span { ) } - pub fn from_inner_byte_pos(self, start: usize, end: usize) -> Span { + pub fn from_inner(self, inner: InnerSpan) -> Span { let span = self.data(); - Span::new(span.lo + BytePos::from_usize(start), - span.lo + BytePos::from_usize(end), + Span::new(span.lo + BytePos::from_usize(inner.start), + span.lo + BytePos::from_usize(inner.end), span.ctxt) } @@ -1396,6 +1396,18 @@ pub struct MalformedSourceMapPositions { pub end_pos: BytePos } +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +pub struct InnerSpan { + pub start: usize, + pub end: usize, +} + +impl InnerSpan { + pub fn new(start: usize, end: usize) -> InnerSpan { + InnerSpan { start, end } + } +} + // Given a slice of line start positions and a position, returns the index of // the line the position is on. Returns -1 if the position is located before // the first line. diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 875c286bd8a..029685bcc24 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -203,6 +203,7 @@ symbols! { core_intrinsics, crate_id, crate_in_paths, + crate_local, crate_name, crate_type, crate_visibility_modifier, @@ -221,6 +222,7 @@ symbols! { deref, deref_mut, derive, + direct, doc, doc_alias, doc_cfg, @@ -278,8 +280,10 @@ symbols! { format_args_nl, from, From, + from_desugaring, from_error, from_generator, + from_method, from_ok, from_usize, fundamental, @@ -443,6 +447,7 @@ symbols! { panic_impl, panic_implementation, panic_runtime, + parent_trait, partial_cmp, PartialOrd, passes, @@ -569,6 +574,7 @@ symbols! { __rust_unstable_column, rvalue_static_promotion, sanitizer_runtime, + _Self, self_in_typedefs, self_struct_ctor, Send, |
