summary refs log tree commit diff
path: root/compiler/rustc_span/src/source_map.rs
AgeCommit message (Collapse)AuthorLines
2024-01-17Use UnhashMap for a few more mapsMark Rousskov-2/+2
This avoids hashing data that's already hashed.
2024-01-15compiler: Lower fn call arg spans down to MIRMartin Nordholts-1/+1
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-06rustc_span: Optimize syntax context comparisonsVadim Petrochenkov-3/+9
Including comparisons with root context
2023-12-19Unify SourceFile::name_hash and StableSourceFileIdMichael Woerister-48/+7
2023-12-10remove redundant importssurechen-4/+2
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-43/+7
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-10-17[RFC 3127 - Trim Paths]: Condition remapped filepath on remap scopesUrgau-8/+26
2023-09-12Fall back to an unoptimized implementation in read_binary_file if ↵Ben Kimock-2/+31
File::metadata lies
2023-09-07Use `Freeze` for `SourceFile.lines`John Kåre Alsaker-1/+1
2023-09-07Use `Freeze` for `SourceFile.external_src`John Kåre Alsaker-6/+6
2023-09-04Pass StableSourceFileId.Camille GILLOT-4/+4
2023-09-03Compute address space from previous file.Camille GILLOT-29/+9
2023-09-03Register the file while computing its start position.Camille GILLOT-38/+31
2023-09-03Use relative positions inside a SourceFile.Camille GILLOT-52/+20
2023-08-27Load include_bytes! directly into an LrcBen Kimock-4/+17
2023-08-06refactor on span_look_aheadyukang-9/+6
2023-06-29Use `partition_point` in `SourceMap::lookup_source_file_idx`.Nicholas Nethercote-5/+1
This makes it (a) a little simpler, and (b) more similar to `SourceFile::lookup_line`.
2023-06-10reword the message to suggest surrounding with parenthesesyukang-1/+4
2023-06-10take care module name for suggesting surround the struct literal in parenthesesyukang-0/+12
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-3/+3
2023-05-14Simplify find_width_of_character_at_span.Mara Bos-24/+7
2023-05-06correct literals for dyn thread safeSparrowLii-3/+5
2023-05-06introduce `DynSend` and `DynSync` auto traitSparrowLii-3/+3
2023-04-18Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillotbors-3/+3
Encode hashes as bytes, not varint In a few places, we store hashes as `u64` or `u128` and then apply `derive(Decodable, Encodable)` to the enclosing struct/enum. It is more efficient to encode hashes directly than try to apply some varint encoding. This PR adds two new types `Hash64` and `Hash128` which are produced by `StableHasher` and replace every use of storing a `u64` or `u128` that represents a hash. Distribution of the byte lengths of leb128 encodings, from `x build --stage 2` with `incremental = true` Before: ``` ( 1) 373418203 (53.7%, 53.7%): 1 ( 2) 196240113 (28.2%, 81.9%): 3 ( 3) 108157958 (15.6%, 97.5%): 2 ( 4) 17213120 ( 2.5%, 99.9%): 4 ( 5) 223614 ( 0.0%,100.0%): 9 ( 6) 216262 ( 0.0%,100.0%): 10 ( 7) 15447 ( 0.0%,100.0%): 5 ( 8) 3633 ( 0.0%,100.0%): 19 ( 9) 3030 ( 0.0%,100.0%): 8 ( 10) 1167 ( 0.0%,100.0%): 18 ( 11) 1032 ( 0.0%,100.0%): 7 ( 12) 1003 ( 0.0%,100.0%): 6 ( 13) 10 ( 0.0%,100.0%): 16 ( 14) 10 ( 0.0%,100.0%): 17 ( 15) 5 ( 0.0%,100.0%): 12 ( 16) 4 ( 0.0%,100.0%): 14 ``` After: ``` ( 1) 372939136 (53.7%, 53.7%): 1 ( 2) 196240140 (28.3%, 82.0%): 3 ( 3) 108014969 (15.6%, 97.5%): 2 ( 4) 17192375 ( 2.5%,100.0%): 4 ( 5) 435 ( 0.0%,100.0%): 5 ( 6) 83 ( 0.0%,100.0%): 18 ( 7) 79 ( 0.0%,100.0%): 10 ( 8) 50 ( 0.0%,100.0%): 9 ( 9) 6 ( 0.0%,100.0%): 19 ``` The remaining 9 or 10 and 18 or 19 are `u64` and `u128` respectively that have the high bits set. As far as I can tell these are coming primarily from `SwitchTargets`.
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-3/+3
2023-04-17Spelling - compilerJosh Soref-2/+2
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-16fix clippy::toplevel_ref_arg and ::manual_mapMatthias Krüger-3/+1
2023-04-09Box large enum variantsNilstrieb-4/+4
2023-03-15Implementing "<test_binary> --list --format json" #107307 #49359Partha P. Das-10/+21
2023-03-05Allow binary files to go through the `FileLoader`Thom Chiovoloni-3/+8
2023-01-19Auto merge of #106810 - oli-obk:resolver_reverse_plumbing, r=petrochenkovbors-10/+17
Various cleanups around pre-TyCtxt queries and functions part of #105462 based on https://github.com/rust-lang/rust/pull/106776 (everything starting at [0e2b39f](https://github.com/rust-lang/rust/pull/106810/commits/0e2b39fd1ffde51b50d45ccbe41de52b85136b8b) is new in this PR) r? `@petrochenkov` I think this should be most of the uncontroversial part of #105462.
2023-01-16Avoid an unnecessary allocationOli Scherer-10/+17
2023-01-14Heuristically undo path prefix mappings.Tim Neumann-6/+57
Because the compiler produces better diagnostics if it can find the source of (potentially remapped) dependencies.
2022-12-27Improve debug logs of `find_width_of_character_at_span`Nilstrieb-17/+12
2022-12-15Shorten trimmed display of closuresEsteban Küber-4/+11
When `with_forced_trimmed_paths` is used, only print filename and start of the closure's span, to reduce their verbosity.
2022-12-15more clippy::complexity fixesMatthias Krüger-1/+1
2022-12-12minor code cleanupsMatthias Krüger-1/+1
2022-12-10compiler: remove unnecessary imports and qualified pathsKaDiWa-2/+1
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-11/+11
2022-11-17detect () to avoid redundant <> suggestion for typeYiming Lei-4/+21
fix #104379
2022-11-09Rollup merge of #103675 - lyming2007:issue-103271-fix, r=fee1-deadMichael Goulet-0/+44
remove redundent "<>" for ty::Slice with reference type this fix #103271
2022-11-09remove redundent "<>" for ty::Slice with reference typeYiming Lei-0/+44
this fix #103271
2022-10-25Fix #103451, find_width_of_character_at_span return width with 1 when ↵yukang-5/+3
reaching end
2022-10-20fix rust-lang#101880: suggest let for assignment, and some code refactoryukang-0/+20
2022-10-19Add testcase for next_point, fix more trivial issues in ↵yukang-6/+13
find_width_of_character_at_span
2022-10-18Fix the bug of next_point in spanyukang-3/+4
2022-09-01tracing::instrument cleanupOli Scherer-5/+5
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-23Remove generate_fn_name_span and generate_local_type_param_snippet.Camille GILLOT-87/+0
2022-08-22Show absolute line numbers if span is outside relative spanNilstrieb-1/+1
In the MIR pretty printing, it can sometimes happen that the span of the statement is outside the span of the body (for example through inlining). In this case, don't display a relative span but an absolute span. This will make the mir-opt-tests a little more prone to diffs again, but the impact should be small.