Commit Graph

929 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
2b9fea1300 move the drop expansion code to rustc_mir 2017-03-18 02:53:07 +02:00
Tobias Schottdorf
7bfc64ab0f Improve wording in the -{W,A,F,D} options
Fixes #28708.
2017-03-12 06:12:05 -04:00
bors
744e69663e Auto merge of #40446 - arielb1:rollup, r=alexcrichton
Rollup of 12 pull requests

- Successful merges: #40146, #40299, #40315, #40319, #40344, #40345, #40372, #40373, #40400, #40404, #40419, #40431
- Failed merges:
2017-03-12 02:50:17 +00:00
bors
1b19284ad9 Auto merge of #40220 - jseyfried:ast_macro_def, r=nrc
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info

This PR
 - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items,
 - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today),
 - removes `ast::MacroDef`, and
 - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions.
   - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter.

r? @nrc
2017-03-11 22:48:14 +00:00
Ariel Ben-Yehuda
b1e03fe4bb Rollup merge of #40431 - fsasm:master, r=BurntSushi
rustc: Whitelist the FMA target feature

This commit adds the entry `"fma\0"` to the whitelist for the x86
target. LLVM already supports fma but rustc did not directly. Previously
rustc permitted `+fma` in the target-feature argument and enabled the use
of FMA instructions, but it did not list it in the configuration and
attributes.

fixes #40406
2017-03-11 21:57:50 +02:00
bors
8c72b7651f Auto merge of #39648 - Aatch:mir-inlining-2, r=eddyb
[MIR] Implement Inlining

Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.

Doesn't handle a number of cases, but can be extended later. This is basically the same as the previous inlining PR, but without the span-related changes (as the bugs it was dealing with have since been fixed).

/cc @rust-lang/compiler
2017-03-11 08:25:44 +00:00
Alex Crichton
2b1d1bbf2a Rollup merge of #40336 - alexcrichton:fast-dep-info, r=nrc
rustc: Exit quickly on only `--emit dep-info`

This commit alters the compiler to exit quickly if the only output being emitted
is `dep-info`, which doesn't need a lot of other information to generate.

Closes #40328
2017-03-10 16:18:28 -08:00
Fabjan Sukalia
4d23ca4b5f rustc: Whitelist the FMA target feature
This commit adds the entry `"fma\0"` to the whitelist for the x86
target. LLVM already supports fma but rustc did not directly. Previously
rustc permitted `+fma` in the target-feature argument and enabled the use
of FMA instructions, but it did not list it in the configuration and
attributes.

fixes #40406
2017-03-10 23:57:58 +01:00
Alex Crichton
5c8aa74d26 rustc: Exit quickly on only --emit dep-info
This commit alters the compiler to exit quickly if the only output being emitted
is `dep-info`, which doesn't need a lot of other information to generate.

Closes #40328
2017-03-10 08:18:24 -08:00
Simonas Kazlauskas
4ca9c97ace Remove ability for plugins to register a MIR pass
In recent months there have been a few different people investigating how to make a plugin that
registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper.

The interface to register MIR passes was added primarily for miri (& later was
found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use
this interface anymore it seems like a good time to remove this "feature".

For prototyping purposes a similar interface can be added by developers themselves in their custom
rustc build.
2017-03-10 08:09:29 -08:00
Jeffrey Seyfried
212b6c2550 Refactor out ast::ItemKind::MacroDef. 2017-03-10 08:08:32 -08:00
James Miller
71d0d921c2 Initial implementation of inlining for MIR
Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.
2017-03-10 03:54:26 +02:00
bors
06c63f6e9e Auto merge of #39927 - nikomatsakis:incr-comp-skip-borrowck-2, r=eddyb
transition borrowck to visit all **bodies** and not item-likes

This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes #38520 as a drive-by fix.

r? @eddyb
2017-03-03 00:14:10 +00:00
Jeffrey Seyfried
61a9a14d29 Add warning cycle. 2017-02-28 22:15:12 +00:00
Niko Matsakis
085d71c3ef remove special-case code for statics and just use borrowck_fn
Fixes #38520
2017-02-28 08:43:47 -05:00
Eduard-Mihai Burtescu
d9f0a949fd rustc_const_eval: demand that the MIR qualify_consts ran on each evaluated body. 2017-02-25 18:35:26 +02:00
Eduard-Mihai Burtescu
c832e6f327 rustc_typeck: rework coherence to be almost completely on-demand. 2017-02-25 18:35:26 +02:00
Eduard-Mihai Burtescu
9c3c306800 rustc_typeck: move the leaves (generics, trait_def, adt_def) to on-demand. 2017-02-25 18:35:25 +02:00
Eduard-Mihai Burtescu
91374f8fe4 rustc: combine BareFnTy and ClosureTy into FnSig. 2017-02-25 17:47:15 +02:00
Eduard Burtescu
4649f7387e rustc_typeck: lift CrateCtxt to TyCtxt. 2017-02-25 17:07:59 +02:00
Eduard-Mihai Burtescu
374ea14412 rustc_mir: expose MIR building through ty::maps::Provider. 2017-02-25 17:07:59 +02:00
Eduard Burtescu
b5c4244c6c rustc: introduce a query system for type information in ty::maps. 2017-02-25 17:07:59 +02:00
Eduard-Mihai Burtescu
cc8a3a93b7 rustc: consolidate dep-tracked hashmaps in tcx.maps. 2017-02-25 17:07:59 +02:00
bors
16c94cd673 Auto merge of #39752 - keeperofdakeys:macro-error, r=keeperofdakeys
Refactor macro resolution errors + add derive macro suggestions

Move legacy macro resolution error reporting to `finalize_current_module_macro_resolutions`, and provide suggestions for derive macros.

Fixes #39323

cc https://github.com/rust-lang/rust/issues/30197

r? @jseyfried
2017-02-17 04:02:18 +00:00
Josh Driver
2d91e7aab8 Refactor macro resolution errors + add derive macro suggestions 2017-02-16 22:03:15 +10:30
bors
61b93bd811 Auto merge of #38561 - nagisa:rdrandseed, r=alexcrichton
Add intrinsics & target features for rd{rand,seed}

One question is whether or not we want to map feature name `rdrnd` to `rdrand` instead.

EDIT: as for use case, I would like to port my rdrand crate from inline assembly to these intrinsics.
2017-02-14 01:26:10 +00:00
Alex Burka
ca9c7ae61b driver: restore partially deleted comment 2017-02-09 12:07:58 -05:00
Corey Farwell
388db666f4 Rollup merge of #39439 - king6cong:move, r=alexcrichton
rename other than copy/remove
2017-02-05 12:45:02 -05:00
Andrew Cann
7444d07154 Fix test 2017-02-04 14:03:28 +08:00
Andrew Cann
2cc84df44c Add warning for () to ! switch 2017-02-03 18:48:15 +08:00
king6cong
768f6a9b57 add and use rename_or_copy_remove fn that fallback to copy & remove 2017-02-03 17:54:34 +08:00
king6cong
5e41ec2ccc rename other than copy/remove 2017-02-03 16:13:58 +08:00
bors
1a2428fc88 Auto merge of #39402 - king6cong:master, r=nrc
comment rewording and argument unifying
2017-02-02 15:41:19 +00:00
Vadim Petrochenkov
ffba0cea62 Merge ty::TyBox into ty::TyAdt 2017-01-30 23:14:15 +03:00
king6cong
701c32ed4a unify time_passes argument passing 2017-01-30 10:22:26 +08:00
king6cong
986dd077ea doc comment reword 2017-01-30 10:12:10 +08:00
Eduard-Mihai Burtescu
1ff3641623 rustc: don't call the HIR AST. 2017-01-26 13:41:28 +02:00
Eduard-Mihai Burtescu
45c8c5678a rustc: rename TyCtxt's map field to hir. 2017-01-26 13:41:28 +02:00
Niko Matsakis
282f7a3c44 rename Tables to TypeckTables 2017-01-25 16:24:00 -05:00
king6cong
d59a2afe58 better comment wording 2017-01-22 15:45:06 +08:00
Jeffrey Seyfried
191abc4264 Remove unused extern crates. 2017-01-22 01:31:02 +00:00
Jeffrey Seyfried
356fa2c5db Warn on unused #[macro_use] imports. 2017-01-22 01:31:00 +00:00
Alex Crichton
e1129b75f8 Rollup merge of #39142 - nikomatsakis:issue-38973, r=brson
run rustdoc tests in the same sort of thread rustc runs in

Not sure yet if this is the problem in #38973 but seems like an improvement regardless.

r? @brson
2017-01-20 08:35:48 -08:00
Alex Crichton
17294d98b9 Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrc
Refactor the parser to consume token trees

This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers.

This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates.

r? @nrc
2017-01-20 08:35:47 -08:00
Alex Crichton
d4d276faaf Rollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfried
Implement `#[proc_macro_attribute]`

This implements `#[proc_macro_attribute]` as described in https://github.com/rust-lang/rfcs/pull/1566

The following major (hopefully non-breaking) changes are included:

* Refactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`.
    * `proc_macro::tokenstream::TokenStream` no longer emits newlines between items, this can be trivially restored if desired
    * `proc_macro::TokenStream::from_str` does not try to parse an item anymore, moved to `impl MultiItemModifier for CustomDerive` with more informative error message

* Implement `#[proc_macro_attribute]`, which expects functions of the kind `fn(TokenStream, TokenStream) -> TokenStream`
    * Reactivated `#![feature(proc_macro)]` and gated `#[proc_macro_attribute]` under it
    * `#![feature(proc_macro)]` and `#![feature(custom_attribute)]` are mutually exclusive
    * adding `#![feature(proc_macro)]` makes the expansion pass assume that any attributes that are not built-in, or introduced by existing syntax extensions, are proc-macro attributes

* Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`

    * This change wasn't necessary for this PR, but it helped debugging a problem where I was using the wrong feature string.

* Move "completed feature gate checking" pass to after "name resolution" pass

    * This was necessary for proper feature-gating of `#[proc_macro_attribute]` invocations when the `proc_macro` feature flag isn't set.

Prototype/Litmus Test: [Implementation](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/src/lib.rs#L13) -- [Usage](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/examples/post_service.rs#L35)
2017-01-20 08:34:30 -08:00
Niko Matsakis
d25f066c07 run rustdoc tests in the same sort of thread rustc runs in 2017-01-17 18:15:08 -05:00
Esteban Küber
fc774e629f Teach Diagnostics to highlight text 2017-01-17 14:28:53 -08:00
Jeffrey Seyfried
6466f55ebc Give the StringReader a sess: &ParseSess. 2017-01-17 08:16:47 +00:00
Austin Bonander
04ecee158c Move "completed feature gate checking" pass to after "name resolution" pass so proc-macro-attribute feature gate check can use resolve 2017-01-16 22:41:23 -08:00
Austin Bonander
375cbd20cf Implement #[proc_macro_attribute]
* Add support for `#[proc_macro]`

* Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it

* Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`,
error on legacy import of proc macros via `#[macro_use]`
2017-01-16 22:41:22 -08:00