Commit graph

1421 commits

Author SHA1 Message Date
Mazdak Farrokhzad
1f93be1bb3
Rollup merge of #65074 - Rantanen:json-byte-pos, r=matklad
Fix the start/end byte positions in the compiler JSON output

Track the changes made during normalization in the `SourceFile` and use this information to correct the `start_byte` and `end_byte` fields in the JSON output.

This should ensure the start/end byte fields can be used to index the original file, even if Rust normalized the source code for parsing purposes. Both CRLF to LF and BOM removal are handled with this one.

The rough plan was discussed with @matklad in rust-lang-nursery/rustfix#176 - although I ended up going with `u32` offset tracking so I wouldn't need to deal with `u32 + i32` arithmetics when applying the offset to the span byte positions.

Fixes #65029
2019-10-25 13:12:45 +02:00
Vadim Petrochenkov
9f5a530b84 rustc_metadata: Minimize use of Lrc in crate store
Crate metadatas are still stored as `Lrc<CrateMetadata>` in `CStore` because crate store has to be cloneable due to `Resolver::clone_outputs`.
2019-10-24 20:54:16 +03:00
Vadim Petrochenkov
c5fee33e7a rustc_metadata: Remove RwLock from CStore 2019-10-24 20:54:16 +03:00
Vadim Petrochenkov
3534ca8f49 Turn crate store into a resolver output 2019-10-24 20:54:16 +03:00
Vadim Petrochenkov
222503a354 rustc: Add a convenience alias for dyn MetadataLoader + Sync 2019-10-24 20:51:33 +03:00
Vadim Petrochenkov
175d325ccb rustc_metadata: Move some code around
Plugin search doesn't need a crate loader, only crate locator
2019-10-24 20:51:33 +03:00
Vadim Petrochenkov
2cda75c48f rustc_metadata: Remove unnecessary use of crate store in plugin loader 2019-10-24 20:51:33 +03:00
Vadim Petrochenkov
2c16f84490 rustc_driver: Remove unnecessary use of crate store 2019-10-24 20:50:11 +03:00
Mazdak Farrokhzad
a649b1666c
Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb
Remove `InternedString`

This PR removes `InternedString` by converting all occurrences to `Symbol`. There are a handful of places that need to use the symbol chars instead of the symbol index, e.g. for stable sorting; local conversions `LocalInternedString` is used in those places.

r? @eddyb
2019-10-23 22:19:19 +02:00
Eduard-Mihai Burtescu
371cc39b25 rustc_metadata: use a table for impl_trait_ref. 2019-10-22 14:21:16 +03:00
Eduard-Mihai Burtescu
7a80a11a83 rustc_metadata: use a table for fn_sig. 2019-10-22 14:21:14 +03:00
Eduard-Mihai Burtescu
74db3e8a9e rustc_metadata: use a table for super_predicates. 2019-10-22 13:42:11 +03:00
Mikko Rantanen
ff1860ad76
Fix the start/end byte positions in the compiler JSON output 2019-10-21 19:28:29 +03:00
Nicholas Nethercote
b8214e9b44 Convert fields within DefPathData from InternedString to Symbol.
It's a full conversion, except in `DefKey::compute_stable_hash()` where
a `Symbol` now is converted to an `InternedString` before being hashed.
This was necessary to avoid test failures.
2019-10-21 17:17:36 +11:00
Yuki Okushi
2518bbd5a3
Rollup merge of #65460 - sinkuu:contains_insert, r=varkor
Clean up `contains()` `insert()` chains on HashSet

They can be merged to a single `insert()` call, which may avoid double-hashing/lookup of the value.
2019-10-21 03:10:54 +09:00
bors
857a55b8f0 Auto merge of #65497 - choller:master, r=tmiasko
Avoid injecting sanitizer runtimes into staticlibs (#64629).

This fixes the remaining issue in `creader.rs` and also fixes the expected test failure. I have explicitly turned the `$(CC)` call into a negative check with the `!` to ensure that this command is really failing (if it is not, then either the runtime is attached to the lib or the lib has not been instrumented and both would be an error).

I've also borrowed `program.rs` and the additional `rustc` invocation from @tmiasko 's PR since he pointed out that using `-fsanitize=address` with `$(CC)` for linking could fail if the sanitizer runtimes on the system are incompatible.

With this toolchain I was able to compile Firefox locally without any linker errors. I am still seeing races with Rust in TSan but I assume that is because I did not build with `-Z build-std`.
2019-10-20 10:11:10 +00:00
Tyler Mandry
bc85061203
Rollup merge of #65535 - eddyb:sliced-predicates, r=nikomatsakis
rustc: arena-allocate the slice in `ty::GenericsPredicate`, not the whole struct.

While rebasing #59789 I noticed we can do this now. However, it doesn't help much without changing `inferred_outlives_of` to the same type, which I might try next.
2019-10-18 13:48:34 -07:00
Eduard-Mihai Burtescu
cd9e4441eb rustc: arena-allocate the slice in ty::GenericsPredicate, not the whole struct. 2019-10-18 03:14:57 +03:00
bors
fa0f7d0080 Auto merge of #65495 - Centril:rollup-tguwjt5, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #65237 (Move debug_map assertions after check for err)
 - #65316 (make File::try_clone produce non-inheritable handles on Windows)
 - #65319 (InterpCx: make memory field public)
 - #65461 (Don't recommend ONCE_INIT in std::sync::Once)
 - #65465 (Move syntax::ext to a syntax_expand and refactor some attribute logic)
 - #65475 (add example for type_name)
 - #65478 (fmt::Write is about string slices, not byte slices)
 - #65486 (doc: fix typo in OsStrExt and OsStringExt)

Failed merges:

r? @ghost
2019-10-17 18:53:10 +00:00
Christian Holler (:decoder)
a2feb9c6cc Avoid injecting sanitizer runtimes into staticlibs (#64629). 2019-10-17 14:09:49 +02:00
Mazdak Farrokhzad
d420d719c4 move syntax::ext to new crate syntax_expand 2019-10-16 10:59:53 +02:00
Shotaro Yamada
ac2f906a59 Make use of the return value of HashSet::insert 2019-10-16 13:48:20 +09:00
Eduard-Mihai Burtescu
d89dddc920 rustc_metadata: address some review comments. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
34066d60c3 rustc_metadata: don't use more space than needed, for each Table. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
ee747f645f rustc_metadata: replace Entry table with one table for each of its fields (AoS -> SoA). 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
972b93b20e rustc_metadata: use decoder::Metadata instead of &[u8] for Lazy<Table<T>>::get. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
cef4950280 rustc_metadata: generalize Table<T> to hold T, not Lazy<T>, elements. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
677f0df63b rustc_metadata: add a helper macro for recording into PerDefTable's. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
5d52a7e0d0 rustc_metadata: split tables into an usize-keyed Table and a DefIndex-keyed PerDefTable. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
dd1264e90a rustc_metadata: replace Lazy<[Table<T>]> with Lazy<Table<T>>. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
ffd18fc22c rustc_metadata: parametrize Table by element type. 2019-10-15 18:23:51 +03:00
Eduard-Mihai Burtescu
f49274032b rustc_metadata: rename index::Index to table::Table. 2019-10-15 18:23:50 +03:00
Eduard-Mihai Burtescu
83b3c39218 rustc_metadata: use 0 in index::Index to indicate missing entries. 2019-10-15 18:23:50 +03:00
Eduard-Mihai Burtescu
ea134563e7 rustc_metadata: use NonZeroUsize for the position of a Lazy. 2019-10-15 18:23:50 +03:00
Eduard-Mihai Burtescu
e505857914 rustc_metadata: remove now-redundant length from the start of the encoding. 2019-10-15 18:23:50 +03:00
Tyler Mandry
8d1123d808
Rollup merge of #65365 - skinny121:const-args-metadata, r=varkor
Include const generic arguments in metadata

Fixes #64707
Fixes #61624
Fixes #64730

r? @varkor
2019-10-14 17:52:39 -07:00
ben
eb68bbb2b0 Include const generic arguments in metadata. 2019-10-15 07:24:19 +13:00
Vadim Petrochenkov
f5baad2b5e rustc_metadata: Remove resolutions for extern crate items from CStore
Use a more traditional scheme with providing them as a resolver output
2019-10-14 18:05:45 +03:00
Vadim Petrochenkov
e843d867e6 rustc_metadata: Crate loader is immutable 2019-10-14 18:05:45 +03:00
Vadim Petrochenkov
2805553dd8 rustc_metadata: Improve documentation of CrateMetadata 2019-10-14 18:05:45 +03:00
Vadim Petrochenkov
b476f2fa4e rustc_metadata: Use CrateSource where appropriate 2019-10-14 18:05:45 +03:00
Vadim Petrochenkov
e8c28e24b9 rustc_metadata: Privatize private code and remove dead code 2019-10-14 18:05:45 +03:00
bors
d28a9c38fe Auto merge of #65240 - michaelwoerister:sp-review-3, r=Mark-Simulacrum
self-profiling: Add events for metadata loading (plus a small dep-tracking optimization)

This PR
- adds self-profiling events related to loading things from crate metadata
- makes the compiler cache the `DepNodeIndex` of upstream crates, so that they don't have to be looked up over and over.

The commits are best reviewed in isolation.

Self-profiling tracking issue: https://github.com/rust-lang/rust/issues/58967

r? @Mark-Simulacrum
cc @wesleywiser
2019-10-14 01:45:26 +00:00
bors
898f36c83c Auto merge of #65153 - da-x:issue-58017, r=petrochenkov
Improve message when attempting to instantiate tuple structs with private fields

Fixes #58017, fixes #39703.

```
error[E0603]: tuple struct `Error` is private
  --> main.rs:22:16
   |
2  |     pub struct Error(usize, pub usize, usize);
   |                      -----             ----- field is private
   |                      |
   |                      field is private
...
22 |     let x = a::Error(3, 1, 2);
   |                ^^^^^
   |
   = note: a tuple struct constructor is private if any of its fields is private
```
2019-10-10 19:40:48 +00:00
Michael Woerister
a9853fce25 Add 'unlikely' annotation to branch in crate DepNodeIndex caching. 2019-10-10 09:42:06 +02:00
Vadim Petrochenkov
5d8af38329 resolve: Keep field spans for diagnostics 2019-10-09 18:07:22 +03:00
Michael Woerister
0ee6a96eb7 Remove some outdated comments about dependency tracking from cstore_impl. 2019-10-09 16:58:17 +02:00
Michael Woerister
003d5a6367 self-profiling: Add events for tracking crate metadata loading related activities. 2019-10-09 16:58:17 +02:00
Michael Woerister
9dbd7be70f Cache the DepNodeIndex of upstream crates in order to avoid multiple locks and table lookups on each access of crate metadata. 2019-10-09 16:58:10 +02:00
Charles Lew
eb492455f2 Address review comments. 2019-10-07 12:01:56 +08:00