rust/src/tools
bors 1151ea6006 Auto merge of #109002 - michaelvanstraten:master, r=petrochenkov
Added byte position range for `proc_macro::Span`

Currently, the [`Debug`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#impl-Debug-for-Span) implementation for [`proc_macro::Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) calls the debug function implemented in the trait implementation of `server::Span` for the type `Rustc` in the `rustc-expand` crate.

The current implementation, of the referenced function, looks something like this:
```rust
fn debug(&mut self, span: Self::Span) -> String {
    if self.ecx.ecfg.span_debug {
        format!("{:?}", span)
    } else {
        format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0)
    }
}
```

It returns the byte position of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#) as an interpolated string.

Because this is currently the only way to get a spans position in the file, I might lead someone, who is interested in this information, to parsing this interpolated string back into a range of bytes, which I think is a very non-rusty way.

The proposed `position()`, method implemented in this PR, gives the ability to directly get this info.
It returns a [`std::ops::Range`](https://doc.rust-lang.org/std/ops/struct.Range.html#) wrapping the lowest and highest byte of the [`Span`](https://doc.rust-lang.org/beta/proc_macro/struct.Span.html#).

I put it behind the `proc_macro_span` feature flag because many of the other functions that have a similar footprint also are annotated with it, I don't actually know if this is right.

It would be great if somebody could take a look at this, thank you very much in advanced.
2023-04-21 10:47:27 +00:00
..
build-manifest Add vendor to Fuchsia's target triple 2023-01-05 09:34:22 -05:00
build_helper add only modified for compiletest 2023-02-10 16:25:01 +00:00
bump-stage0 remove some unneeded imports 2023-04-12 19:27:18 +02:00
cargo@d0a4cbcee6 chore: allow cargo to have its own workspace 2023-04-16 19:32:12 +01:00
cargotest Override linker in cargotest on windows 2022-10-23 19:33:03 -05:00
clippy Auto merge of #96840 - cjgillot:query-feed, r=oli-obk 2023-04-21 08:04:58 +00:00
collect-license-metadata Fix remaining typos 2023-04-10 21:02:49 +02:00
compiletest Auto merge of #110444 - ferrocene:comptest-lines, r=Mark-Simulacrum 2023-04-20 15:15:17 +00:00
error_index_generator refactor: improve error-index-generator dependency 2023-02-26 20:13:06 +13:00
expand-yaml-anchors Run expand-yaml-anchors in x test tidy 2023-02-05 14:46:52 -06:00
generate-copyright Fix remaining typos 2023-04-10 21:02:49 +02:00
html-checker parallelize HTML checking tool 2022-07-29 23:26:38 -04:00
jsondocck Fix remaining typos 2023-04-10 21:02:49 +02:00
jsondoclint Fix remaining typos 2023-04-10 21:02:49 +02:00
linkchecker linkchecker: running from a directory separate from the book 2023-04-20 09:27:52 +01:00
lint-docs Fix x test lint-docs when download-rustc is enabled 2023-04-18 23:08:48 -05:00
lld-wrapper fix lld-wrapper lld flavor detection 2022-09-07 14:51:54 +02:00
miri Improve doc comment of AllocExtra's backtrace 2023-04-16 10:00:02 -04:00
miropt-test-tools couple of clippy::perf fixes 2022-11-18 10:30:47 +01:00
remote-test-client tools/remote-test-{server,client}: Use /data/local/tmp on Android 2022-10-06 13:42:32 -07:00
remote-test-server Use u32 methods instead of manual shifting 2022-12-23 16:08:23 +05:30
replace-version-placeholder Don't skip all directories when tidy-checking 2023-03-27 18:52:47 +00:00
rls chore: remove rustc-workspace-hack 2023-04-16 19:32:20 +01:00
rust-analyzer Auto merge of #109002 - michaelvanstraten:master, r=petrochenkov 2023-04-21 10:47:27 +00:00
rust-demangler
rust-installer Rollup merge of #110188 - Nilstrieb:remove-remove-dir-all, r=jyn514 2023-04-12 17:04:32 +02:00
rustbook bump few deps 2023-04-06 18:21:37 +03:00
rustdoc rustdoc: Use unix_sigpipe instead of rustc_driver::set_sigpipe_handler 2022-10-24 20:40:46 +02:00
rustdoc-gui Spelling librustdoc 2023-04-16 21:44:12 -04:00
rustdoc-js rustdoc: add support for type filters in arguments and generics 2023-03-20 22:41:57 -07:00
rustdoc-themes
rustfmt box a bunch of large types 2023-04-04 13:58:50 +00:00
suggest-tests feat: implement basic suggest-tests tool 2023-04-09 19:59:14 +12:00
tidy Move test files 2023-04-20 15:06:17 -03:00
tier-check Encourage developers not to use periods in target names 2022-11-17 10:41:41 +01:00
unicode-table-generator remove some unneeded imports 2023-04-12 19:27:18 +02:00
unstable-book-gen unstable-book-gen: use std::fs::write 2022-08-28 00:40:58 +02:00
x make x look for x.py if shell script does not exist 2023-02-15 15:19:49 +08:00
cherry-pick.sh
publish_toolstate.py rename maybe_delink to maybe_remove_mention 2023-04-11 14:04:50 +02:00