Commit Graph

972 Commits

Author SHA1 Message Date
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 crate`s. 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
Guillaume Gomez 6f58b7f0ab Fix linker failure 2017-01-12 14:45:25 +01:00
bors f5cfe83da9 Auto merge of #38840 - kjaleshire:multiple-targets-error-fix, r=nrc
Warn that the link target ignores the given name

Hi, new contributor here. This is my stab at #20130, any feedback welcome!
2017-01-09 04:57:36 +00:00
bors cbf88730e7 Auto merge of #38813 - eddyb:lazy-11, r=nikomatsakis
[11/n] Separate ty::Tables into one per each body.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/38449) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

In order to track the results of type-checking and inference for incremental recompilation, they must be stored separately for each function or constant value, instead of lumped together.

These side-`Tables` also have to be tracked by various passes, as they visit through bodies (all of which have `Tables`, even if closures share the ones from their parent functions). This is usually done by switching a `tables` field in an override of `visit_nested_body` before recursing through `visit_body`, to the relevant one and then restoring it - however, in many cases the nesting is unnecessary and creating the visitor for each body in the crate and then visiting that body, would be a much cleaner solution.

To simplify handling of inlined HIR & its side-tables, their `NodeId` remapping and entries HIR map were fully stripped out, which means that `NodeId`s from inlined HIR must not be used where a local `NodeId` is expected. It might be possible to make the nodes (`Expr`, `Block`, `Pat`, etc.) that only show up within a `Body` have IDs that are scoped to that `Body`, which would also allow `Tables` to use `Vec`s.

That last part also fixes #38790 which was accidentally introduced in a previous refactor.
2017-01-08 11:36:52 +00:00
bors 7ac9d337dc Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrc
Remove not(stage0) from deny(warnings)

Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2017-01-08 08:22:06 +00:00
Kyle Aleshire 4af830a2c8 Error message more like original 2017-01-06 19:13:59 -06:00
Eduard-Mihai Burtescu 85a4a192c7 rustc: keep track of tables everywhere as if they were per-body. 2017-01-06 22:23:29 +02:00
Kyle Aleshire 37829af09d Warn that the name is ignored if a link target is emitted 2017-01-04 19:54:21 -06:00
Alex Crichton 045f8f6929 rustc: Stabilize the `proc_macro` feature
This commit stabilizes the `proc_macro` and `proc_macro_lib` features in the
compiler to stabilize the "Macros 1.1" feature of the language. Many more
details can be found on the tracking issue, #35900.

Closes #35900
2017-01-02 12:13:30 -08:00
Mark Simulacrum 0e43b378c1 Split CtxtArenas into GlobalArenas and CtxtInterners.
CtxtInterners contains a single DroplessArena, while GlobalArenas
contains the TypedArenas still required for the remaining
Drop-containing types.
2016-12-31 11:48:48 -07:00
Alex Crichton 9b0b5b45db Remove not(stage0) from deny(warnings)
Historically this was done to accommodate bugs in lints, but there hasn't been a
bug in a lint since this feature was added which the warnings affected. Let's
completely purge warnings from all our stages by denying warnings in all stages.
This will also assist in tracking down `stage0` code to be removed whenever
we're updating the bootstrap compiler.
2016-12-29 21:07:20 -08:00
Nick Cameron 7720cf02e3 Change --crate-type metadata to --emit=metadata 2016-12-29 13:24:45 +13:00
Eduard-Mihai Burtescu 4aae835803 rustc: always print nested nodes where a HIR map is available. 2016-12-28 11:29:20 +02:00
Eduard-Mihai Burtescu e64f64a2fc rustc: separate bodies for static/(associated)const and embedded constants. 2016-12-28 11:27:57 +02:00
Eduard-Mihai Burtescu 864928297d rustc: separate TraitItem from their parent Item, just like ImplItem. 2016-12-28 11:21:45 +02:00
Jeffrey Seyfried c12fc66a9d Allow legacy custom derive authors to disable warnings in downstream crates. 2016-12-23 05:49:34 +00:00
Simonas Kazlauskas b2cf6df875 Add intrinsics & target features for rd{rand,seed} 2016-12-22 23:53:30 +02:00
Jeffrey Seyfried f705c69bf6 Simplify `TyCtxt::create_and_enter`. 2016-12-19 20:57:03 +00:00
Ariel Ben-Yehuda e1d4b8fc8c Use StableHasher everywhere
The standard implementations of Hasher have architecture-dependent
results when hashing integers. This causes problems when the hashes are
stored within metadata - metadata written by one host architecture can't
be read by another.

To fix that, implement an architecture-independent StableHasher and use
it in all places an architecture-independent hasher is needed.

Fixes #38177.
2016-12-15 20:48:59 +02:00
bors 5e2f37fca9 Auto merge of #38057 - KiChjang:display-formal-type-param, r=nikomatsakis
Display better error messages for E0282

Fixes #36554.
2016-12-12 00:22:30 +00:00
Mark-Simulacrum 296ec5f9b7 Refactor FnSig to contain a Slice for its inputs and outputs. 2016-12-05 22:33:38 -07:00
bors ebeee0e27e Auto merge of #38092 - pnkfelix:mir-stats, r=nikomatsakis
Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.

Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.

Some notes:

* This code attempts to present the breakdown of each variant for
  every enum in the MIR. This is meant to guide decisions about how to
  revise representations e.g. when to box payloads for rare variants
  to shrink the size of the enum overall.

* I left out the "Total:" line that hir-stats presents, because this
  implementation uses the MIR Visitor infrastructure, and the memory
  usage of structures directly embedded in other structures (e.g. the
  `func: Operand` in a `TerminatorKind:Call`) is not distinguished
  from similar structures allocated in a `Vec` (e.g. the `args:
  Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
  summation of all the accumulated sizes is misleading, because it
  will double-count the contribution of the `Operand` of the `func` as
  well as the size of the whole `TerminatorKind`.

  * I did consider abandoning the MIR Visitor and instead hand-coding
    a traversal that distinguished embedded storage from indirect
    storage. But such code would be fragile; better to just require
    people to take care when interpreting the presented results.

* This traverses the `mir.promoted` rvalues to capture stats for MIR
  stored there, even though the MIR visitor super_mir method does not
  do so. (I did not observe any promoted mir being newly traversed when
  compiling the rustc crate, however.)

* It might be nice to try to unify this code with hir-stats.  Then
  again, the reporting portion is the only common code (I think), and
  it is small compared to the visitors in hir-stats and mir-stats.
2016-12-04 23:36:50 +00:00
Keith Yeung 3d069e1b38 Add TypeVariableOrigin enum 2016-12-03 17:12:28 -08:00
bors 2cdbd5eb42 Auto merge of #38079 - BurntSushi:attrtarget, r=alexcrichton
Add new #[target_feature = "..."] attribute.

This commit adds a new attribute that instructs the compiler to emit
target specific code for a single function. For example, the following
function is permitted to use instructions that are part of SSE 4.2:

    #[target_feature = "+sse4.2"]
    fn foo() { ... }

In particular, use of this attribute does not require setting the
-C target-feature or -C target-cpu options on rustc.

This attribute does not have any protections built into it. For example,
nothing stops one from calling the above `foo` function on hosts without
SSE 4.2 support. Doing so may result in a SIGILL.

I've also expanded the x86 target feature whitelist.
2016-12-03 17:41:14 +00:00
bors 890085450a Auto merge of #38061 - cardoe:target-spec, r=alexcrichton
print option to dump target spec as JSON

This lets the user dump out the target spec that the compiler is using. This is useful to people defining their own target.json to compare it against existing targets or understand how different targets change internal settings. It is also potentially useful for Cargo to determine if something has changed with a target and it needs to rebuild things.
2016-12-03 14:21:51 +00:00
Doug Goldstein ff112644de
rustc: add --print target-spec option
This option provides the user the ability to dump the configuration that
is in use by rustc for the target they are building for.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
2016-12-02 10:07:38 -06:00
Ariel Ben-Yehuda 242cd7ebe2 limit the length of types in monomorphization
This adds the new insta-stable `#![type_size_limit]` crate attribute to control
the limit, and is obviously a [breaking-change] fixable by that.
2016-12-02 00:54:22 +02:00
Felix S. Klock II ff1ba6a505 Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.
Some notes:

* This code attempts to present the breakdown of each variant for
  every enum in the MIR. This is meant to guide decisions about how to
  revise representations e.g. when to box payloads for rare variants
  to shrink the size of the enum overall.

* I left out the "Total:" line that hir-stats presents, because this
  implementation uses the MIR Visitor infrastructure, and the memory
  usage of structures directly embedded in other structures (e.g. the
  `func: Operand` in a `TerminatorKind:Call`) is not distinguished
  from similar structures allocated in a `Vec` (e.g. the `args:
  Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
  summation of all the accumulated sizes is misleading, because it
  will double-count the contribution of the `Operand` of the `func` as
  well as the size of the whole `TerminatorKind`.

  * I did consider abandoning the MIR Visitor and instead hand-coding
    a traversal that distinguished embedded storage from indirect
    storage. But such code would be fragile; better to just require
    people to take care when interpreting the presented results.

* This traverses the `mir.promoted` rvalues to capture stats for MIR
  stored there, even though the MIR visitor super_mir method does not
  do so. (I did not observe any new mir being traversed when compiling
  the rustc crate, however.)

* It might be nice to try to unify this code with hir-stats.  Then
  again, the reporting portion is the only common code (I think), and
  it is small compared to the visitors in hir-stats and mir-stats.
2016-11-30 21:33:18 +01:00
bors ecff71a45c Auto merge of #37800 - alexcrichton:new-bootstrap, r=eddyb
Update the bootstrap compiler

Now that we've got a beta build, let's use it!
2016-11-30 19:17:24 +00:00
Alex Crichton 2186660b51 Update the bootstrap compiler
Now that we've got a beta build, let's use it!
2016-11-30 10:38:08 -08:00
bors 5a0248068c Auto merge of #38014 - jseyfried:refactor_path_resolution, r=nrc
resolve: refactor path resolution

This is a pure refactoring, modulo minor diagnostics improvements.
r? @nrc
2016-11-30 16:02:18 +00:00
Eduard-Mihai Burtescu 177913b49c rustc: track the Span's of definitions across crates. 2016-11-30 04:48:56 +02:00
Andrew Gallant 80ef1dbf2d Add new #[target_feature = "..."] attribute.
This commit adds a new attribute that instructs the compiler to emit
target specific code for a single function. For example, the following
function is permitted to use instructions that are part of SSE 4.2:

    #[target_feature = "+sse4.2"]
    fn foo() { ... }

In particular, use of this attribute does not require setting the
-C target-feature or -C target-cpu options on rustc.

This attribute does not have any protections built into it. For example,
nothing stops one from calling the above `foo` function on hosts without
SSE 4.2 support. Doing so may result in a SIGILL.

This commit also expands the target feature whitelist to include lzcnt,
popcnt and sse4a. Namely, lzcnt and popcnt have their own CPUID bits,
but were introduced with SSE4.
2016-11-29 20:32:14 -05:00
Florian Diebold 1ac338c2a7 rustc_driver: fix compilation 2016-11-29 13:04:27 +01:00
Jeffrey Seyfried c871637e43 Remove `resolver.record_resolution()`. 2016-11-29 04:47:47 +00:00
Eduard Burtescu 9aaf26e7aa rustc: rework stability to be on-demand for type-directed lookup. 2016-11-28 04:18:11 +02:00
Eduard Burtescu da47c2e2ac rustc_typeck: save the type cache for rustdoc and save-analysis. 2016-11-28 04:18:10 +02:00
Eduard-Mihai Burtescu 962633cdbb rustc: embed path resolutions into the HIR instead of keeping DefMap. 2016-11-28 04:18:10 +02:00
Felix S. Klock II 70e5ca2ab4 Revisions from review comments, squashed.
Biggest change: Revised print-type-sizes output to include breakdown
of layout.

Includes info about field sizes (and alignment + padding when padding
is injected; the injected padding is derived from the offsets computed
by layout module).

Output format is illustrated in commit that has the ui tests.

Note: there exists (at least) one case of variant w/o name: empty
enums.  Namely, empty enums use anonymous univariant repr. So for such
cases, print the number of the variant instead of the name.

----

Also, eddyb suggested of reading from `layout_cache` post-trans.

(For casual readers: the compiler source often uses the word "cache"
for tables that are in fact not periodically purged, and thus are
useful as the basis for data like this.)

Some types that were previously not printed are now included in the
output. (See e.g. the tests `print_type_sizes/generics.rs` and
`print_type_sizes/variants.rs`)

----

Other review feedback:

switch to an exhaustive match when filtering in just structural types.
switch to hashset for layout info and move sort into print method.

----

Driveby change: Factored session::code_stats into its own module

----

incorporate njn feedback re output formatting.
2016-11-24 10:30:18 +01:00
Felix S. Klock II 9383fcf07f Add `-Z print-type-sizes`, a tool for digging into how variants are laid out. 2016-11-24 10:30:18 +01:00
bors 5196ca8518 Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichton
add --crate-type metadata

r? @alexcrichton
2016-11-22 21:54:10 -06:00
Geoffry Song 9d42549df4
Implement the `loop_break_value` feature.
This implements RFC 1624, tracking issue #37339.

- `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the
  currently deduced type of that loop, the desired type, and a list of
  break expressions currently seen. `loop` loops get a fresh type
  variable as their initial type (this logic is stolen from that for
  arrays). `while` loops get `()`.
- `break {expr}` looks up the broken loop, and unifies the type of
  `expr` with the type of the loop.
- `break` with no expr unifies the loop's type with `()`.
- When building MIR, `loop` loops no longer construct a `()` value at
  termination of the loop; rather, the `break` expression assigns the
  result of the loop. `while` loops are unchanged.
- `break` respects contexts in which expressions may not end with braced
  blocks. That is, `while break { break-value } { while-body }` is
  illegal; this preserves backwards compatibility.
- The RFC did not make it clear, but I chose to make `break ()` inside
  of a `while` loop illegal, just in case we wanted to do anything with
  that design space in the future.

This is my first time dealing with this part of rustc so I'm sure
there's plenty of problems to pick on here ^_^
2016-11-21 20:20:42 -08:00
Jeffrey Seyfried a8e86f0f81 Fix fallout in `rustdoc` and tests. 2016-11-21 12:16:46 +00:00
Jeffrey Seyfried cc74068642 Remove `Rc` from the interner. 2016-11-21 09:00:56 +00:00
Jeffrey Seyfried e85a0d70b8 Use `Symbol` instead of `InternedString` in the AST, HIR, and various other places. 2016-11-21 09:00:55 +00:00
Jeffrey Seyfried d2f8fb0a0a Move `syntax::util::interner` -> `syntax::symbol`, cleanup. 2016-11-20 23:40:20 +00:00
Nick Cameron baedc3b70f Tests 2016-11-21 07:10:12 +13:00
Nick Cameron 534556a445 Read in rmeta crates 2016-11-21 07:10:12 +13:00
Nick Cameron b286a2f081 Add --crate-type metadata
With the same semantics as -Zno-trans
2016-11-21 07:08:35 +13:00
Jeffrey Seyfried e97686d048 Move `MetaItemKind`'s `Name` to a field of `MetaItem`. 2016-11-20 12:36:30 +00:00
Jeffrey Seyfried 4b9b0d3474 Refactor `CrateConfig`. 2016-11-20 12:35:57 +00:00
Jeffrey Seyfried a2626410d7 Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s. 2016-11-20 11:46:06 +00:00
Jeffrey Seyfried ff4994235a Avoid clearing the string interner. 2016-11-20 11:46:01 +00:00
bors bfa709a38a Auto merge of #37826 - keeperofdakeys:proc-macro-test, r=alexcrichton
Show a better error when using --test with #[proc_macro_derive]

Fixes https://github.com/rust-lang/rust/issues/37480

Currently using `--test` with a crate that contains a `#[proc_macro_derive]` attribute causes an error. This PR doesn't attempt to fix the issue itself, or determine what tesing of a proc_macro_derive crate should be - just to provide a better error message.
2016-11-19 13:28:50 -06:00
bors 35e8924dc5 Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb
Separate impl items from the parent impl

This change separates impl item bodies out of the impl itself. This gives incremental more resolution. In so doing, it refactors how the visitors work, and cleans up a bit of the collect/check logic (mostly by moving things out of collect that didn't really belong there, because they were just checking conditions).

However, this is not as effective as I expected, for a kind of frustrating reason. In particular, when invoking `foo.bar()` you still wind up with dependencies on private items. The problem is that the method resolution code scans that list for methods with the name `bar` -- and this winds up touching *all* the methods, even private ones.

I can imagine two obvious ways to fix this:

- separating fn bodies from fn sigs (#35078, currently being pursued by @flodiebold)
- a more aggressive model of incremental that @michaelwoerister has been advocating, in which we hash the intermediate results (e.g., the outputs of collect) so that we can see that the intermediate result hasn't changed, even if a particular impl item has changed.

So all in all I'm not quite sure whether to land this or not. =) It still seems like it has to be a win in some cases, but not with the test cases we have just now. I can try to gin up some test cases, but I'm not sure if they will be totally realistic. On the other hand, some of the early refactorings to the visitor trait seem worthwhile to me regardless.

cc #36349 -- well, this is basically a fix for that issue, I guess

r? @michaelwoerister

NB: Based atop of @eddyb's PR https://github.com/rust-lang/rust/pull/37402; don't land until that lands.
2016-11-17 17:31:01 -08:00
bors c57b826149 Auto merge of #37732 - jseyfried:use_extern_macros, r=nrc
Support `use`ing externally defined macros behind `#![feature(use_extern_macros)]`

With `#![feature(use_extern_macros)]`,
 - A name collision between macros from different upstream crates is much less of an issue since we can `use` the macros in different submodules or rename with `as`.
 - We can reexport macros with `pub use`, so `#![feature(macro_reexport)]` is no longer needed.
 - These reexports are allowed in any module, so crates can expose a macro-modular interface.

If a macro invocation can resolve to both a `use` import and a `macro_rules!` or `#[macro_use]`, it is an ambiguity error.

r? @nrc
2016-11-17 07:43:50 -08:00
Josh Driver b9ed51c8f1 Show a better error when using --test with #[proc_macro_derive] 2016-11-17 22:06:36 +10:30
bors 29181b3f0c Auto merge of #37717 - nikomatsakis:region-obligations-pre, r=eddyb
Refactoring towards region obligation

Two refactorings towards the intermediate goal of propagating region obligations through the `InferOk` structure (which in turn leads to the possibility of lazy normalization).

1. Remove `TypeOrigin` and add `ObligationCause`
    - as we converge subtyping and obligations and so forth, the ability to keep these types distinct gets harder
2. Propagate obligations from `InferOk` into the surrounding fulfillment context

After these land, I have a separate branch (which still needs a bit of work) that can make the actual change to stop directly adding subregion edges and instead propagate obligations. (This should also make it easier to fix the unsoundness in specialization around lifetimes.)

r? @eddyb
2016-11-17 01:18:51 -08:00