Commit graph

477 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
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
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
Mazdak Farrokhzad
d420d719c4 move syntax::ext to new crate syntax_expand 2019-10-16 10:59:53 +02: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
f49274032b rustc_metadata: rename index::Index to table::Table. 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
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
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
Yechan Bae
d152d48727 Fix lonely backtick 2019-10-04 16:31:38 -04:00
Mazdak Farrokhzad
a16c637374
Rollup merge of #65026 - petrochenkov:ice1, r=eddyb
metadata: Some crate loading cleanup

So, my goal was to fix caching of loaded crates which is broken and causes ICEs like #56935 or #64450.
While investigating I found that the code is pretty messy and likes to confuse various things that look similar but are actually different.
This PR does some initial cleanup in that area, I hope to get to the caching itself a bit later.
2019-10-04 07:24:37 +02:00
Vadim Petrochenkov
0f96ba92b6 metadata: Remove CrateMetadata::name
It duplicates `CrateRoot::name`
2019-10-04 01:12:29 +03:00
Vadim Petrochenkov
f13adc5f9d metadata: Remove CrateMetadata::host_lib
It was only used for retreiving edition, which was a bug.
In case of dual proc macros the edition should be taken from the target crate version, like any other metadata.
2019-10-04 01:12:29 +03:00
Matthew Jasper
455945f24b Remove HIR based const qualification 2019-09-30 19:56:49 +01:00
csmoe
64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
bors
134004f74d Auto merge of #62661 - arielb1:never-reserve, r=nikomatsakis
reserve `impl<T> From<!> for T`

this is necessary for never-type stabilization.

cc #57012 #35121

I think we wanted a crater run for this @nikomatsakis?

r? @nikomatsakis
2019-09-26 08:42:34 +00:00
Mazdak Farrokhzad
34067ee961
Rollup merge of #64599 - csmoe:doc_async_reexport, r=nikomatsakis
Rustdoc render async function re-export

Closes #63710
r? @nikomatsakis
2019-09-25 03:48:27 +02:00
Ariel Ben-Yehuda
1ec7ae14fa resolve the rustc_reservation_impl attribute in 1 place 2019-09-24 21:11:50 +03:00
csmoe
a744fd0432 bug-out asyncness query on non-local funtions 2019-09-24 06:17:54 +00:00
csmoe
a813cc1bf1 rename is_async_fn to asyncness 2019-09-21 03:17:57 +00:00
csmoe
2fd4c27c32 add is_async_fn query 2019-09-19 03:17:34 +00:00
Aaron Hill
3daa8bd2e4
Generate proc macro harness in AST order.
This ensures that we match the order used by proc macro metadata
serialization.

Fixes #64251
2019-09-17 19:10:10 -04:00
Oliver Scherer
26e9990198 Add a "diagnostic item" scheme
This allows lints and other diagnostics to refer to items
by a unique ID instead of relying on whacky path
resolution schemes that may break when items are
relocated.
2019-08-30 01:00:55 +02:00
Mazdak Farrokhzad
e4e6b01ca1
Rollup merge of #63867 - petrochenkov:dhelpers, r=matthewjasper
resolve: Block expansion of a derive container until all its derives are resolved

So, it turns out there's one more reason to block expansion of a `#[derive]` container until all the derives inside it are resolved, beside `Copy` (https://github.com/rust-lang/rust/pull/63248).

The set of derive helper attributes registered by derives in the container also has to be known before the derives themselves are expanded, otherwise it may be too late (see https://github.com/rust-lang/rust/pull/63468#issuecomment-524550872 and the `#[stable_hasher]`-related test failures in https://github.com/rust-lang/rust/pull/63468).

So, we stop our attempts to unblock the container earlier, as soon as the `Copy` status is known, and just block until all its derives are resolved.
After all the derives are resolved we immediately go and process their helper attributes in the item, without delaying it until expansion of the individual derives.

Unblocks https://github.com/rust-lang/rust/pull/63468
r? @matthewjasper (as a reviewer of https://github.com/rust-lang/rust/pull/63248)
cc @c410-f3r
2019-08-29 13:17:52 +02:00
Mazdak Farrokhzad
b6df8276f8
Rollup merge of #63933 - wesleywiser:cleanup_from_move_promoted, r=oli-obk
Resolve some small issues related to #63580

This resolves some feedback left on #63580 after it was merged:

- Adds documentation to `mir::Static` and `mir::StaticKind`
- Simplifies `maybe_get_optimized_mir()` and `maybe_get_promoted_mir()`

cc @bjorn3 @RalfJung
2019-08-29 05:32:45 +02:00
Wesley Wiser
009cce88eb Extract Decoder::entry_unless_proc_macro() 2019-08-28 07:00:27 -04:00
Wesley Wiser
30b29ab0f7 Simplify maybe_get_optimized_mir and maybe_get_promoted_mir
Since both functions are always unwrapped, don't wrap the return value
in an `Option`.
2019-08-28 07:00:27 -04:00
bors
bbd48e6f16 Auto merge of #63127 - kper:pr, r=nikomatsakis
Cleanup: Consistently use `Param` instead of `Arg` #62426

Fixes #62426
2019-08-28 03:42:00 +00:00
Kevin Per
e0ce9f8c0a Cleanup: Consistently use Param instead of Arg #62426 2019-08-27 14:07:41 +02:00
Vadim Petrochenkov
2065ee9acc metadata: Eliminate FullProcMacro
Fix caching of loaded proc macros
2019-08-27 01:34:07 +03:00
Vadim Petrochenkov
52c62eaae4 Respect attributes on proc macro definitions 2019-08-27 01:33:13 +03:00
Vadim Petrochenkov
ec45b87957 resolve: Block expansion of a derive container until all its derives are resolved
Also mark derive helpers as known as a part of the derive container's expansion instead of expansion of the derives themselves which may happen too late.
2019-08-27 00:31:55 +03:00
Wesley Wiser
e63b992030 Resolve PR comments 2019-08-22 06:36:31 -04:00
Wesley Wiser
34fe28bc67 Fix tidy 2019-08-22 06:36:31 -04:00
Wesley Wiser
73814654b2 Move promoted out of mir::Body 2019-08-22 06:36:30 -04:00
Eduard-Mihai Burtescu
e7ceaa9748 rustc_metadata: replace LazySeq<T> with Lazy<[T]>. 2019-08-20 18:36:05 +03:00