298 Commits

Author SHA1 Message Date
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Camille GILLOT
5fec1ca0ff Use Arena inside hir::ImplItem. 2019-12-21 23:31:47 +01:00
Camille GILLOT
0f7d77363b Use Arena inside hir::TraitItem. 2019-12-21 23:30:52 +01:00
Camille GILLOT
084e6722f9 Use Arena inside hir::Item. 2019-12-21 23:17:29 +01:00
Camille GILLOT
4dc79f1f7d Use Arena inside hir::Crate. 2019-12-21 23:12:44 +01:00
Mazdak Farrokhzad
a0d20935cc introduce 'type AttrVec' 2019-12-20 22:53:40 +01:00
Mazdak Farrokhzad
ec82174fad
Rollup merge of #67131 - Centril:item-merge, r=petrochenkov
Merge `TraitItem` & `ImplItem into `AssocItem`

In this PR we:

- Merge `{Trait,Impl}Item{Kind?}` into `AssocItem{Kind?}` as discussed in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286.

   - This is done by using the cover grammar of both forms.

   - In particular, it requires that we syntactically allow (under `#[cfg(FALSE)]`):

      - `default`ness on `trait` items,

      - `impl` items without a body / definition (`const`, `type`, and `fn`),

      - and associated `type`s in `impl`s with bounds, e.g., `type Foo: Ord;`.

   - The syntactic restrictions are replaced by semantic ones in `ast_validation`.

- Move syntactic restrictions around C-variadic parameters from the parser into `ast_validation`:

    - `fn`s in all contexts now syntactically allow `...`,

    - `...` can occur anywhere in the list syntactically (`fn foo(..., x: usize) {}`),

    - and `...` can be the sole parameter (`fn foo(...) {}`.

r? @petrochenkov
2019-12-20 17:22:19 +01:00
LeSeulArtichaut
bfc02bdd3c
Fix documentation typo 2019-12-19 12:58:42 +01:00
Mazdak Farrokhzad
e52f902a8a AssocImplKind::{Method -> Fn}. 2019-12-12 18:05:05 +01:00
Mazdak Farrokhzad
abf2e7aa95 Remove ast::{Impl,Trait}{Item,ItemKind}. 2019-12-12 18:05:05 +01:00
Mazdak Farrokhzad
76576d401c Unify associated item mut visitors. 2019-12-12 17:54:49 +01:00
Mazdak Farrokhzad
34d91709b6 parse: refactor fun ret ty & param ty 2019-12-12 17:54:49 +01:00
Alex Crichton
7f23e6e8d7
rustc: Link LLVM directly into rustc again
This commit builds on #65501 continue to simplify the build system and
compiler now that we no longer have multiple LLVM backends to ship by
default. Here this switches the compiler back to what it once was long
long ago, which is linking LLVM directly to the compiler rather than
dynamically loading it at runtime. The `codegen-backends` directory of
the sysroot no longer exists and all relevant support in the build
system is removed. Note that `rustc` still supports a dynamically loaded
codegen backend as it did previously, it just no longer supports
dynamically loaded codegen backends in its own sysroot.

Additionally as part of this the `librustc_codegen_llvm` crate now once
again explicitly depends on all of its crates instead of implicitly
loading them through the sysroot. This involved filling out its
`Cargo.toml` and deleting all the now-unnecessary `extern crate`
annotations in the header of the crate. (this in turn required adding a
number of imports for names of macros too).

The end results of this change are:

* Rustbuild's build process for the compiler as all the "oh don't forget
  the codegen backend" checks can be easily removed.
* Building `rustc_codegen_llvm` is much simpler since it's simply
  another compiler crate.
* Managing the dependencies of `rustc_codegen_llvm` is much simpler since
  it's "just another `Cargo.toml` to edit"
* The build process should be a smidge faster because there's more
  parallelism in the main rustc build step rather than splitting
  `librustc_codegen_llvm` out to its own step.
* The compiler is expected to be slightly faster by default because the
  codegen backend does not need to be dynamically loaded.
* Disabling LLVM as part of rustbuild is still supported, supporting
  multiple codegen backends is still supported, and dynamic loading of a
  codegen backend is still supported.
2019-12-11 09:50:11 -05:00
Mazdak Farrokhzad
4c3e95e84b
Rollup merge of #67074 - ehuss:extern-options, r=petrochenkov
Add options to --extern flag.

This changes the `--extern` flag so that it can take a series of options that changes its behavior. The general syntax is `[opts ':'] name ['=' path]` where `opts` is a comma separated list of options. Two options are supported, `priv` which replaces `--extern-private` and `noprelude` which avoids adding the crate to the extern prelude.

```text
--extern priv:mylib=/path/to/libmylib.rlib
--extern noprelude:alloc=/path/to/liballoc.rlib
```

`noprelude` is to be used by Cargo's build-std feature in order to use `--extern` to reference standard library crates.

This also includes a second commit which adds the `aux-crate` directive to compiletest. I can split this off into a separate PR if desired, but it helps with defining these kinds of tests. It is based on #54020, and can be used in the future to replace and simplify some of the Makefile tests.
2019-12-11 10:10:44 +01:00
Eric Huss
590dd7dfef Add options to --extern flag. 2019-12-09 08:08:13 -08:00
bors
ae1b871cca Auto merge of #65195 - varkor:to_option, r=Centril
Rename `bool::then_*` to `bool::to_option_*` and use where appropriate

Name change following https://github.com/rust-lang/rfcs/pull/2757. Also try it out throughout the compiler in places I think makes the code more readable.
2019-12-06 19:14:51 +00:00
varkor
9f1269f23c Rename to then_some and then 2019-12-06 12:24:54 +00:00
varkor
50985b012a Use to_option_with in several places 2019-12-06 12:23:23 +00:00
varkor
e3a8ea4e18 Use to_option in various places 2019-12-06 12:23:23 +00:00
Ömer Sinan Ağacan
5ddfbc2e2b Fix Query type docs
`give` no longer exists, `compute` is used to generate query results
now.
2019-12-06 10:41:51 +03:00
Mark Rousskov
f03d8f305a Move early lint declarations to librustc_session 2019-12-03 12:19:14 -05:00
Vadim Petrochenkov
e5944a5a69 rustc_plugin: Some further cleanup
Remove a useless test
2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
279937812a rustc_plugin: Remove support for plugins adding LLVM passes 2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
db357a6e3b rustc_plugin: Remove support for adding plugins from command line 2019-12-01 20:53:25 +03:00
Vadim Petrochenkov
55ba05bd0d rustc_plugin: Remove support for plugin arguments 2019-12-01 20:53:25 +03:00
Ralf Jung
7f20198632 pass Queries to compiler callbacks 2019-11-30 10:16:19 +01:00
Ralf Jung
6ea1df2340
Rollup merge of #66791 - cjgillot:arena, r=Mark-Simulacrum
Handle GlobalCtxt directly from librustc_interface query system

This PR constructs the `GlobalCtxt` as a member of the `Queries` in librustc_interface.
This simplifies the code to construct it, at the expense of added complexity in the query control flow.
This allows to handle the arenas directly from librustc_interface.

Based on #66707

r? @Zoxc
2019-11-29 22:57:34 +01:00
Vadim Petrochenkov
753ce4518e rustc_metadata: Merge cstore.rs into creader.rs 2019-11-28 20:59:56 +03:00
Camille GILLOT
1e12f39d83 Allocate HIR Forest on arena. 2019-11-27 13:32:28 +01:00
Camille GILLOT
e321ba989c Misc renames. 2019-11-27 13:24:19 +01:00
Camille GILLOT
77a4c85e54 Simplify handling of AllArenas. 2019-11-27 13:19:33 +01:00
Camille GILLOT
e5ed101098 Rename BoxedGlobalCtxt. 2019-11-27 13:17:58 +01:00
Camille GILLOT
79e232401e Rename lifetimes. 2019-11-27 13:13:57 +01:00
Camille GILLOT
7e72b36299 Move local Arena to Queries. 2019-11-26 23:16:48 +01:00
Camille GILLOT
7b71e9a9df Formatting. 2019-11-26 22:57:02 +01:00
Camille GILLOT
b99513be57 Have Queries own the GlobalCtxt.
The construction of the GlobalCtxt is moved from a generator's stack to
the Queries struct.  Since the GlobalCtxt requires the HIR Forest and the
arenas to live longer, those are moved into Queries the same way.

The resulting handling of objects is more brittle, because consumers of
the Once objects need to be careful of their initialisation.
2019-11-26 22:51:02 +01:00
Camille GILLOT
58a9c73bbd Make the HIR map own the Definitions. 2019-11-26 22:48:41 +01:00
Camille GILLOT
144d1c2171 Review nits. 2019-11-26 17:20:32 +01:00
Camille GILLOT
9d5f721406 Superfluous lifetime. 2019-11-25 18:36:18 +01:00
Camille GILLOT
ea1b8039ad Pass Queries by reference. 2019-11-25 18:13:29 +01:00
Camille GILLOT
18bb912984 Remove wrong comment. 2019-11-25 17:54:01 +01:00
Camille GILLOT
27513a21c4 Tidy. 2019-11-24 23:21:44 +01:00
Camille GILLOT
5098ba6a93 Move linking ouside the interface queries. 2019-11-24 23:21:43 +01:00
Camille GILLOT
266ede1bb3 Isolate compiler queries inside the Queries type. 2019-11-24 23:21:43 +01:00
Vadim Petrochenkov
f89e6c8811 rustc_plugin: Remove support for syntactic plugins 2019-11-24 12:05:10 +03:00
Mazdak Farrokhzad
c66b508137
Rollup merge of #66575 - Mark-Simulacrum:no-uii, r=petrochenkov
Remove pretty printing of specific nodes in AST

The ability to print a specific item as identified by NodeId or path
seems not particularly useful, and certainly carries quite a bit of
complexity with it.

This is intended to simplify our CLI parsing a bit and remove a
non-uncomplicated piece of it; I largely did this to remove the
dependency on NodeId from librustc/session but it's not really
necessary to do so in this invasive a way. The alternative is
moving it to librustc_interface or driver, probably.
2019-11-22 19:57:48 +01:00
bors
eaac45a9a9 Auto merge of #66565 - Mark-Simulacrum:syntax-cfg-mod, r=petrochenkov
Move process_configure_mod to rustc_parse

This removes the hack in favor of perhaps a less principled, but less painful, approach.

This also supports my work to decouple `Session` from librustc, as `ParseSess` currently has `Attribute` as "part" of it but after this PR will no longer do so.
2019-11-22 10:33:29 +00:00
Mark Rousskov
70805e6444 Delete ProcessCfgMod
The previous commit removes the use of this, and now we cleanup.
2019-11-20 14:07:57 -05:00
Mark Rousskov
7ec20dd31d Remove pretty printing of specific nodes in AST
The ability to print a specific item as identified by NodeId or path
seems not particularly useful, and certainly carries quite a bit of
complexity with it.
2019-11-20 12:10:23 -05:00
Vadim Petrochenkov
7f49f7bcc2 Rename directory rustc_plugin -> rustc_plugin_impl 2019-11-17 11:04:49 +03:00