Commit Graph

67298 Commits

Author SHA1 Message Date
Alex Crichton
c6445ba25b Clarify failure condition on tests 2017-09-05 11:55:01 -07:00
Alex Crichton
0cdc58a1bc rustc: Store InternedString in DefPathData
Previously a `Symbol` was stored there, but this ended up causing hash
collisions in situations that otherwise shouldn't have a hash collision. Only
the symbol's string value was hashed, but it was possible for distinct symbols
to have the same string value, fooling various calcuations into thinking that
these paths *didn't* need disambiguating data when in fact they did!

By storing `InternedString` instead we're hopefully triggering all the exising
logic to disambiguate paths with same-name `Symbol` but actually distinct
locations.
2017-09-05 07:47:27 -07:00
Alex Crichton
9a231961d5 rustc: Move stability functionality into queries
This commit primarily removes the `stability` field from `TyCtxt` as well as its
internal mutable state, instead using a query to build the stability index as
well as primarily using queries for other related lookups.

Like previous commits the calculation of the stability index is wrapped in a
`with_ignore` node to avoid regressing the current tests, and otherwise this
commit also introduces #44232 but somewhat intentionally so.
2017-09-05 07:37:58 -07:00
Alex Crichton
0182c8bbda rustc: Rename item_body query to extern_const_body
Should hopefully more accurately reflect what's happening! This commit also
removes the cache in the cstore implementation as it's already cached through
the query infrastructure.
2017-09-05 07:37:58 -07:00
Alex Crichton
7d9c98e475 rustc: Hide maybe_unused_* fields in queries
This commit makes the `maybe_unused_extern_crates` and
`maybe_unused_trait_imports` fields of `TyCtxt` private and ensures that they're
accessed with queries so the values and results can be tracked.
2017-09-05 07:37:58 -07:00
Alex Crichton
bf5550b9b2 rustc: Convert freevars to a query
This removes a public mutable (but not actually used mutably) field from the
`TyCtxt`, moving it over to a query to ensure that it's tracked over time.
2017-09-05 07:37:58 -07:00
Alex Crichton
490f34ac0c rustc: Remove CrateStore::used_crate*
This commit removes the `use_crates` and `used_crate_source` methods in favor of
a mix of queries and helper methods being used now instead.
2017-09-05 07:37:58 -07:00
Alex Crichton
0b7e0aaba5 rustc: Classify two more CrateStore methods untracked
These are only called pre-TyCtxt (e.g. lowering/resolve), so make it explicit in
the name that they're untracked and therefore unsuitable to called elsewhere.
2017-09-05 07:37:58 -07:00
Alex Crichton
88399a985a rustc: Migrate visible_parent_map to a query
Turns out it was basically already a query if you squinted hard enough!
2017-09-05 07:37:58 -07:00
Alex Crichton
84ae4b75be rustc: Migrate CrateStore::item_body to a query
This commit migrates the `item_body` method on `CrateStore` to a query instead
to enable better tracking of dependencies and whatnot.
2017-09-05 07:37:58 -07:00
Alex Crichton
953490ddfa rustc: Remove lang item methods from CrateStore
Given the previous commit, these are now trivially representable as queries!
2017-09-05 07:37:58 -07:00
Alex Crichton
a2e2aba07d rustc: Migrate lang items to a query
This commit moves the calculation of the `LanguageItems` structure into a
query rather than being calculated before the `TyCtxt` exists, with the eventual
end goal of removing some `CrateStore` methods.
2017-09-05 07:37:57 -07:00
Alex Crichton
43ae380191 rustc: Flag some CrateStore methods as "untracked"
The main use of `CrateStore` *before* the `TyCtxt` is created is during
resolution, but we want to be sure that any methods used before resolution are
not used after the `TyCtxt` is created. This commit starts moving the methods
used by resolve to all be named `{name}_untracked` where the rest of the
compiler uses just `{name}` as a query.

During this transition a number of new queries were added to account for
post-resolve usage of these methods.
2017-09-05 07:37:39 -07:00
Alex Crichton
fd61fa5aef rustc: Hide the named_region_map behind queries
This commit makes the `named_region_map` field of `GlobalCtxt` private by
encapsulating the fields behind new queries, and the new queries are also
targeted at particular `HirId` nodes instead of accessing the entire map.
2017-09-05 07:37:39 -07:00
Alex Crichton
64a70342e6 rustc: Remove a number of mutable fields in cstore
This commit started by moving methods from `CrateStore` to queries, but it ended
up necessitating some deeper refactorings to move more items in general to
queries.

Before this commit the *resolver* would walk over the AST and process foreign
modules (`extern { .. }` blocks) and collect `#[link]` annotations. It would
then also process the command line `-l` directives and such. This information
was then stored as precalculated lists in the `CrateStore` object for iterating
over later.

After this, commit, however, this pass no longer happens during resolution but
now instead happens through queries. A query for the linked libraries of a crate
will crawl the crate for `extern` blocks and then process the linkage
annotations at that time.
2017-09-05 07:37:28 -07:00
Alex Crichton
87ea0a19bf Ignore failing tests harder 2017-09-05 07:37:28 -07:00
Alex Crichton
1c7294eb54 rustc: Move implementations_of_trait to a query
While we're at it, make it two separate queries so one's for rustdoc and one's
for the compiler, hopefully being a bit more targeted.
2017-09-05 07:37:28 -07:00
Alex Crichton
4dec2a8f81 rustc: Fix a borrow mut error with debug assertions 2017-09-05 07:37:28 -07:00
Alex Crichton
4af1284053 Ignore failing incremental tests
These should hopefully get fixed with red/green, but until that time alas!
2017-09-05 07:37:27 -07:00
Alex Crichton
52b67f988d rustc: Move original_crate_name to a query 2017-09-05 07:37:27 -07:00
Alex Crichton
d6c88f4936 rustc: Move crate_hash to a query 2017-09-05 07:37:27 -07:00
Alex Crichton
ebc1fd321d rustc: Move crate_disambiguator to queries 2017-09-05 07:37:11 -07:00
Alex Crichton
2d4445f784 rustc: Move {plugin,derive}_registrar_fn to queries 2017-09-05 07:37:11 -07:00
Alex Crichton
205bc9a80a rustc: Migrate CStore::native_libraries to a query 2017-09-05 07:37:11 -07:00
Alex Crichton
98b74c580f rustc: Migrate CStore::expored_symbols to a query 2017-09-05 07:37:11 -07:00
Alex Crichton
ed6f868bf7 rustc: Move impl_defaultness to a query 2017-09-05 07:37:11 -07:00
Alex Crichton
dff0c074e4 rustc: Move a few more cstore methods to queries
This comit applies the following changes:

* Deletes the `is_allocator` query as it's no longer used
* Moves the `is_sanitizer_runtime` method to a query
* Moves the `is_profiler_runtime` method to a query
* Moves the `panic_strategy` method to a query
* Moves the `is_no_builtins` method to a query
* Deletes the cstore method of `is_compiler_builtins`. The query was added in
  #42588 but the `CrateStore` method was not deleted

A good bit of these methods were used late in linking during trans so a new
dedicated structure was created to ship a calculated form of this information
over to the linker rather than having to ship the whole of `TyCtxt` over to
linking.
2017-09-05 07:37:11 -07:00
bors
2f1ef9ef11 Auto merge of #44308 - eddyb:local-index, r=arielb1
[MIR] Restrict ProjectionElem::Index and Storage{Live,Dead} to Local.

(see #44285)

r? @nikomatsakis
2017-09-05 04:56:03 +00:00
bors
2f681bf602 Auto merge of #44248 - oli-obk:spans, r=jseyfried
Produce expansion info for more builtin macros

r? @jseyfried

fixes #43268
2017-09-05 02:21:02 +00:00
bors
22d65983b9 Auto merge of #43067 - pornel:libdeps, r=nrc
Compact display of static lib dependencies

Fixes #33173

Instead of displaying one dependency per line, I've changed the format to display them all in one line.

As a bonus they're in format of linker flags (`-lfoo`), so the output can be copy&pasted if one is actually going to link as suggested.
2017-09-04 23:06:59 +00:00
bors
088216fb99 Auto merge of #44194 - QuietMisdreavus:hey-how-do-i-use-this-new-fangled-thing, r=aturon
expand on using rustup custom toolchains in CONTRIBUTING.md

fixes #42484

Should i include more notes about how to use a local build *without* rustup? It can kinda feel like a cop-out otherwise. Other means that come to mind are setting `$RUSTC` directly and fully installing it.

cc @rust-lang/docs
2017-09-04 10:33:53 +00:00
Oliver Schneider
c4d5a1e17b
Produce expansion info for more builtin macros 2017-09-04 11:03:19 +02:00
bors
a36d93d383 Auto merge of #44300 - Manishearth:clippyup, r=oli-obk
Resync clippy to v0.0.156

None
2017-09-04 07:12:42 +00:00
Eduard-Mihai Burtescu
e74f96e43f rustc_mir: use Local instead of Lvalue in Storage{Live,Dead}. 2017-09-04 08:01:46 +03:00
bors
e22a3cf7e1 Auto merge of #44268 - kennytm:fix-python-bootstrap-test, r=Mark-Simulacrum
rustbuild: Remove invalid doctest from bootstrap.py
2017-09-04 04:30:12 +00:00
bors
a3beb8fe61 Auto merge of #44272 - Dushistov:master, r=alexcrichton
add test for not optimized `pow` with constant power

Closes #34947
2017-09-04 00:03:44 +00:00
Manish Goregaokar
9e644e2da6
Resync clippy to v0.0.156 2017-09-03 14:33:28 -07:00
bors
0006d3e01c Auto merge of #44263 - durka:stabilize-discriminant, r=dtolnay
stabilize mem::discriminant (closes #24263)
2017-09-03 21:32:29 +00:00
bors
981ce7d8dd Auto merge of #44261 - alexcrichton:u128-ffi-unsafe, r=eddyb
rustc: Flag {i,u}128 as unsafe for FFI

These don't appear to have a stable ABI as noted in #41799 and the work in
compiler-builtins definitely seems to be confirming it!
2017-09-03 18:57:21 +00:00
Eduard-Mihai Burtescu
2f42cd8489 rustc_mir: use Local in ProjectionElem::Index. 2017-09-03 21:55:41 +03:00
bors
c8642daf93 Auto merge of #44191 - arielb1:on-unimplemented-label, r=nikomatsakis
More general `on_unimplemented`, with uses in `Try`

Allow `on_unimplemented` directives to specify both the label and the primary message of the trait error, and allow them to be controlled by flags - currently only to be desugaring-sensitive.

e.g.
```Rust
#[rustc_on_unimplemented(
    on(all(direct, from_desugaring="?"),
        message="the `?` operator can only be used in a \
        function that returns `Result` \
        (or another type that implements `{Try}`)",
        label="cannot use the `?` operator in a function that returns `{Self}`"),
)]
```

r? @nikomatsakis
2017-09-03 16:25:46 +00:00
Eduard-Mihai Burtescu
c911925243 rustc_mir: implement visit_local instead/along visit_lvalue where possible. 2017-09-03 19:14:31 +03:00
bors
2f2b8b34c2 Auto merge of #44253 - eddyb:nice-scope, r=nikomatsakis
rustc: rename CodeExtent to Scope and RegionMaps to ScopeTree.

r? @nikomatsakis
2017-09-03 12:46:14 +00:00
Ariel Ben-Yehuda
291b4eddce add error message for the other case too 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
efa09ea554 on_unimplemented: add method-name checks and use them in Try 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
6dec953c5a address review comments 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
02b3ae63e2 enable desugaring-sensitive error messages and use them in Try
Maybe I should allow error messages to check the *specific* desugaring?
Thanks @huntiep for the idea!
2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
6866aea5af implement improved on_unimplemented directives 2017-09-03 13:10:54 +03:00
Ariel Ben-Yehuda
cf07ebd2a2 move the on_unimplemented logic to its own file 2017-09-03 13:10:53 +03:00
Ariel Ben-Yehuda
243aa12d6e refactor and centralize on_unimplemented parsing 2017-09-03 13:10:53 +03:00