Commit Graph

972 Commits

Author SHA1 Message Date
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
Jeffrey Seyfried 641274f907 Resolve imports during expansion. 2016-11-17 08:07:44 +00:00
Niko Matsakis 3fd67eba87 fallout from separating impl-items from impls
Basically adding `visit_impl_item` in various places and so forth.
2016-11-16 13:57:43 -05:00
Niko Matsakis 36fbf8c53c refactor Visitor into ItemLikeVisitor and intravisit::Visitor
There are now three patterns (shallow, deep, and nested visit).  These
are described in detail on the docs in `itemlikevisit::ItemLikeVisitor`.
2016-11-16 13:51:36 -05:00
Alex Crichton 06242ff15d rustc: Implement #[link(cfg(..))] and crt-static
This commit is an implementation of [RFC 1721] which adds a new target feature
to the compiler, `crt-static`, which can be used to select how the C runtime for
a target is linked. Most targets dynamically linke the C runtime by default with
the notable exception of some of the musl targets.

[RFC 1721]: https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md

This commit first adds the new target-feature, `crt-static`. If enabled, then
the `cfg(target_feature = "crt-static")` will be available. Targets like musl
will have this enabled by default. This feature can be controlled through the
standard target-feature interface, `-C target-feature=+crt-static` or
`-C target-feature=-crt-static`.

Next this adds an gated and unstable `#[link(cfg(..))]` feature to enable the
`crt-static` semantics we want with libc. The exact behavior of this attribute
is a little squishy, but it's intended to be a forever-unstable
implementation detail of the liblibc crate.

Specifically the `#[link(cfg(..))]` annotation means that the `#[link]`
directive is only active in a compilation unit if that `cfg` value is satisfied.
For example when compiling an rlib, these directives are just encoded and
ignored for dylibs, and all staticlibs are continued to be put into the rlib as
usual. When placing that rlib into a staticlib, executable, or dylib, however,
the `cfg` is evaluated *as if it were defined in the final artifact* and the
library is decided to be linked or not.

Essentially, what'll happen is:

* On MSVC with `-C target-feature=-crt-static`, the `msvcrt.lib` library will be
  linked to.
* On MSVC with `-C target-feature=+crt-static`, the `libcmt.lib` library will be
  linked to.
* On musl with `-C target-feature=-crt-static`, the object files in liblibc.rlib
  are removed and `-lc` is passed instead.
* On musl with `-C target-feature=+crt-static`, the object files in liblibc.rlib
  are used and `-lc` is not passed.

This commit does **not** include an update to the liblibc module to implement
these changes. I plan to do that just after the 1.14.0 beta release is cut to
ensure we get ample time to test this feature.

cc #37406
2016-11-16 07:00:09 -08:00
Niko Matsakis 19c1a47713 remove TypeOrigin and use ObligationCause instead
In general having all these different structs for "origins" is not
great, since equating types can cause obligations and vice-versa.  I
think we should gradually collapse these things. We almost certainly
also need to invest a big more energy into the `error_reporting` code to
rationalize it: this PR does kind of the minimal effort in that
direction.
2016-11-15 16:12:41 -05:00
Jorge Aparicio 80ca1e1251 don't build an object file for emit=asm,llvm-ir 2016-11-14 03:37:46 -05:00
Jorge Aparicio a6a2477986 use write::run_assembler 2016-11-12 17:45:15 -05:00
Eduard Burtescu 6b3cc0b8c8 rustc_typeck: correctly track "always-diverges" and "has-type-errors". 2016-11-10 01:44:53 +02:00
Eduard Burtescu ff0830d749 rustc: use an Expr instead of a Block for function bodies. 2016-11-10 01:44:45 +02:00
Eduard-Mihai Burtescu 3292f407e7 Rollup merge of #37636 - karpinski:issue-34915, r=nikomatsakis
Marking the 'no-stack-check' codegen option as deprecated (Issue #34915)

Attempts to finish resolving issue #34915. Based on pull request #35156, which was closed due to inactivity.
2016-11-09 20:51:19 +02:00
karpinski c670293630 Adding a deprecation warning for no-stack-check codegen option. 2016-11-08 13:45:07 +01:00
bors 38a959a543 Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis
Stabilize `..` in tuple (struct) patterns

I'd like to nominate `..` in tuple and tuple struct patterns for stabilization.
This feature is a relatively small extension to existing stable functionality and doesn't have known blockers.
The feature first appeared in Rust 1.10 6 months ago.
An example of use: https://github.com/rust-lang/rust/pull/36203

Closes https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis
2016-11-08 02:06:45 -08:00
Alex Crichton 0670d4b7f3 Rollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichton
Add `-Z hir-stats` for collecting statistics on HIR and AST

The data collected will be printed to the commandline and looks like the following:

```
// stats for libcore

PRE EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
TypeBinding                    2_280            57            40
Mod                            3_560            89            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
LifetimeDef                   21_280           380            56
StructField                   22_880           260            88
Lifetime                      23_800         1_190            20
Local                         30_192           629            48
ForeignItem                   31_504           179           176
Arm                           42_880           670            64
Mac                           46_960           587            80
FnDecl                        57_792         1_204            48
TraitItem                     69_504           362           192
TyParamBound                  98_280           945           104
Block                        108_384         2_258            48
Stmt                         144_720         3_618            40
ImplItem                     230_272         1_028           224
Item                         467_456         1_826           256
Pat                          517_776         4_623           112
Attribute                    745_680        15_535            48
Ty                         1_114_848         9_954           112
PathSegment                1_218_528        16_924            72
Expr                       3_082_408        20_279           152
----------------------------------------------------------------
Total                      8_095_372

POST EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                       1_056            12            88
Mod                            3_400            85            40
TypeBinding                    4_280           107            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
StructField                   24_904           283            88
ForeignItem                   31_504           179           176
TraitItem                     69_504           362           192
Local                         85_008         1_771            48
Arm                          100_288         1_567            64
Lifetime                     123_980         6_199            20
LifetimeDef                  126_728         2_263            56
TyParamBound                 297_128         2_857           104
FnDecl                       305_856         6_372            48
Block                        481_104        10_023            48
Stmt                         535_120        13_378            40
Item                       1_469_952         5_742           256
Attribute                  1_629_840        33_955            48
ImplItem                   1_732_864         7_736           224
Pat                        2_360_176        21_073           112
PathSegment                5_888_448        81_784            72
Ty                         6_237_168        55_689           112
Expr                      12_013_320        79_035           152
----------------------------------------------------------------
Total                     33_536_016

HIR STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                         864            12            72
Mod                            2_720            85            32
TypeBinding                    3_424           107            32
PathListItem                   5_068           181            28
Variant                        6_560            82            80
StructField                   20_376           283            72
ForeignItem                   27_208           179           152
WherePredicate                43_776           684            64
TraitItem                     52_128           362           144
Decl                          68_992         2_156            32
Local                         89_184         1_858            48
Arm                           94_368         1_966            48
LifetimeDef                  108_624         2_263            48
Lifetime                     123_980         6_199            20
Stmt                         168_000         4_200            40
TyParamBound                 251_416         2_857            88
FnDecl                       254_880         6_372            40
Block                        583_968        12_166            48
Item                       1_240_272         5_742           216
ImplItem                   1_361_536         7_736           176
Attribute                  1_620_480        33_760            48
Pat                        2_073_120        21_595            96
Path                       2_385_856        74_558            32
Ty                         4_455_040        55_688            80
PathSegment                5_587_904        87_311            64
Expr                       7_588_992        79_052            96
----------------------------------------------------------------
Total                     28_218_736
```
2016-11-05 10:50:25 -07:00
Alex Crichton 1a0963292a Rollup merge of #37408 - eddyb:lazy-5, r=nikomatsakis
[5/n] rustc: record the target type of every adjustment.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37404) | [next](https://github.com/rust-lang/rust/pull/37412)) 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>

The first commit rearranges `tcx.tables` so that all users go through `tcx.tables()`. This in preparation for per-body `Tables` where they will be requested for a specific `DefId`. Included to minimize churn.

The rest of the changes focus on adjustments, there are some renamings, but the main addition is the target type, always available in all cases (as opposed to just for unsizing where it was previously needed).

Possibly the most significant effect of this change is that figuring out the final type of an expression is now _always_ just one successful `HashMap` lookup (either the adjustment or, if that doesn't exist, the node type).
2016-11-04 16:49:28 -07:00
Michael Woerister 94e655eca6 Add -Zhir-stats for collecting statistics on HIR and AST 2016-11-04 11:37:39 -04:00
bors 49c36bf16f Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb
A way to remove otherwise unused locals from MIR

There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts.

PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort.

@nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation.

r? @eddyb or @nikomatsakis
2016-11-03 22:58:55 -07:00
Simonas Kazlauskas 475236770f A way to remove otherwise unused locals from MIR
Replaces the hack where a similar thing is done within trans.
2016-11-03 06:17:01 +02:00
Vadim Petrochenkov 74bb594563 Stabilize `..` in tuple (struct) patterns 2016-11-03 01:38:15 +03:00
Eduard Burtescu 6a8d131e5d rustc: make all read access to tcx.tables go through a method. 2016-11-02 03:50:32 +02:00
Guillaume Gomez ed96e4fd2e Rollup merge of #37296 - srinivasreddy:librustc_driver, r=nikomatsakis
run rustfmt on librustc_driver folder
2016-11-01 16:15:51 +01:00
Michael Woerister 9ef9194528 Make the crate disambiguator 128 bits instead of 256 bits. 2016-10-30 19:14:18 -04:00
Michael Woerister bd1ce91249 Add rustc_data_structures to rustc_driver dependencies. 2016-10-30 19:14:18 -04:00
Michael Woerister a2a2763e6d Replace all uses of SHA-256 with BLAKE2b. 2016-10-30 19:14:18 -04:00
bors 6062e7ed3d Auto merge of #37431 - jseyfried:refactor_crate_config, r=eddyb
Move `CrateConfig` from `Crate` to `ParseSess`

This is a syntax-[breaking-change]. Most breakage can be fixed by removing a `CrateConfig` argument.
r? @eddyb
2016-10-30 06:51:30 -07:00
Srinivas Reddy Thatiparthy f32ce9c142
run rustfmt on librustc_driver folder 2016-10-30 18:26:51 +05:30
Jeffrey Seyfried cbd24757eb Move `CrateConfig` from `Crate` to `ParseSess`. 2016-10-29 07:52:58 +00:00
Eduard Burtescu e34792b181 rustc: move the MIR map into TyCtxt. 2016-10-28 13:55:49 +03:00
bors a6b3b01b5f Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddyb
Add ArrayVec and AccumulateVec to reduce heap allocations during interning of slices

Updates `mk_tup`, `mk_type_list`, and `mk_substs` to allow interning directly from iterators. The previous PR, #37220, changed some of the calls to pass a borrowed slice from `Vec` instead of directly passing the iterator, and these changes further optimize that to avoid the allocation entirely.

This change yields 50% less malloc calls in [some cases](https://pastebin.mozilla.org/8921686). It also yields decent, though not amazing, performance improvements:
```
futures-rs-test  4.091s vs  4.021s --> 1.017x faster (variance: 1.004x, 1.004x)
helloworld       0.219s vs  0.220s --> 0.993x faster (variance: 1.010x, 1.018x)
html5ever-2016-  3.805s vs  3.736s --> 1.018x faster (variance: 1.003x, 1.009x)
hyper.0.5.0      4.609s vs  4.571s --> 1.008x faster (variance: 1.015x, 1.017x)
inflate-0.1.0    3.864s vs  3.883s --> 0.995x faster (variance: 1.232x, 1.005x)
issue-32062-equ  0.309s vs  0.299s --> 1.033x faster (variance: 1.014x, 1.003x)
issue-32278-big  1.614s vs  1.594s --> 1.013x faster (variance: 1.007x, 1.004x)
jld-day15-parse  1.390s vs  1.326s --> 1.049x faster (variance: 1.006x, 1.009x)
piston-image-0. 10.930s vs 10.675s --> 1.024x faster (variance: 1.006x, 1.010x)
reddit-stress    2.302s vs  2.261s --> 1.019x faster (variance: 1.010x, 1.026x)
regex.0.1.30     2.250s vs  2.240s --> 1.005x faster (variance: 1.087x, 1.011x)
rust-encoding-0  1.895s vs  1.887s --> 1.005x faster (variance: 1.005x, 1.018x)
syntex-0.42.2   29.045s vs 28.663s --> 1.013x faster (variance: 1.004x, 1.006x)
syntex-0.42.2-i 13.925s vs 13.868s --> 1.004x faster (variance: 1.022x, 1.007x)
```

We implement a small-size optimized vector, intended to be used primarily for collection of presumed to be short iterators. This vector cannot be "upsized/reallocated" into a heap-allocated vector, since that would require (slow) branching logic, but during the initial collection from an iterator heap-allocation is possible.

We make the new `AccumulateVec` and `ArrayVec` generic over implementors of the `Array` trait, of which there is currently one, `[T; 8]`. In the future, this is likely to expand to other values of N.

Huge thanks to @nnethercote for collecting the performance and other statistics mentioned above.
2016-10-26 03:47:55 -07:00
Mark-Simulacrum 982a48575b Utilize AccumulateVec to avoid heap allocations in mk_{substs, type_list, tup} calls. 2016-10-25 20:06:17 -06:00
Jeffrey Seyfried f3993d1a7f Rename `loader.rs` -> `locator.rs`. 2016-10-22 20:01:50 +00:00
Jeffrey Seyfried 2b43fac2b9 Remove `CrateReader`, use `CrateLoader` instead. 2016-10-22 20:01:38 +00:00
Mark-Simulacrum 83b198249f Use TypedArena::alloc_slice in rustc. 2016-10-19 07:53:56 -06:00
Zack M. Davis 06123d3afe include LLVM version in `--version --verbose`
This is in the matter of #28405.
2016-10-15 15:57:28 -07:00
Alex Crichton 20991829e2 Rollup merge of #37084 - jseyfried:cleanup_expanded_macro_use_scopes, r=nrc
macros: clean up scopes of expanded `#[macro_use]` imports

This PR changes the scope of macro-expanded `#[macro_use]` imports to match that of unexpanded `#[macro_use]` imports. For example, this would be allowed:
```rust
example!();
macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } }
m!();
```

This PR also enforces the full shadowing restrictions from RFC 1560 on `#[macro_use]` imports (currently, we only enforce the weakened restrictions from #36767).

This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice.
r? @nrc
2016-10-12 14:07:56 -07:00
Alex Crichton 920f10950a Rollup merge of #37066 - nrc:stderr, r=alexcrichton
Error monitor should emit error to stderr instead of stdout

We are pretty consistent about emitting to stderr, except for when there is actually an error, in which case we emit to stdout. This seems a bit backwards. This PR just changes that exception to emit to stderr. This is useful for the RLS since the LS protocol uses stdout (grrr).

r? @alexcrichton
2016-10-12 14:07:56 -07:00
Nick Cameron 9bc6d26092 Stabilise `?`
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-12 08:40:22 +13:00
Jeffrey Seyfried d5281ef681 Merge branch 'persistent_macro_scopes' into cleanup_expanded_macro_use_scopes 2016-10-11 03:41:18 +00:00
Nick Cameron 4df0f3f6a6 Error monitor should emit error to stderr instead of stdout 2016-10-10 18:14:45 +13:00
Jeffrey Seyfried 21b4369322 Refactor away `ext::expand::{expand_crate, expand_crate_with_expander}`. 2016-10-07 21:54:04 +00:00
Jeffrey Seyfried 09e41b6784 Add macros from plugins in `libsyntax_ext::register_builtins`. 2016-10-07 21:54:03 +00:00
Alex Crichton 2148bdfcc7 rustc: Rename rustc_macro to proc_macro
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`,
which reflects the general consensus of #35900. A follow up PR to Cargo will be
required to purge the `rustc-macro` name as well.
2016-10-06 11:07:23 -07:00
bors ff713464e6 Auto merge of #36847 - alexcrichton:rustc-macro-doc, r=nrc
rustdoc: Fix documenting rustc-macro crates

This commit adds a "hack" to the session to track whether we're a rustdoc
session or not. If we're rustdoc then we skip the expansion to add the
rustc-macro infrastructure.

Closes #36820
2016-10-03 07:40:22 -07:00
Brian Anderson a4c3288129 Change the sigs of set_print/set_panic to allow restoring the default objects 2016-09-30 14:02:53 -07:00
Alex Crichton 7724a04b0f rustdoc: Fix documenting rustc-macro crates
This commit adds a "hack" to the session to track whether we're a rustdoc
session or not. If we're rustdoc then we skip the expansion to add the
rustc-macro infrastructure.

Closes #36820
2016-09-30 10:49:30 -07:00
Jonathan Turner 45fd0626a4 Rollup merge of #36760 - nrc:input2, r=alexcrichton
Allow supplying an error destination via the compiler driver

Allows replacing stderr with a buffer from the client.

Also, some refactoring around run_compiler.
2016-09-28 20:21:51 -07:00
Nick Cameron e8a4db25ac Allow supplying an error destination via the compiler driver
Allows replacing stderr with a buffer from the client.

Also, some refactoring around run_compiler.
2016-09-28 16:20:30 +13:00
Jeffrey Seyfried b3a81ee844 Build the reduced graph during expansion. 2016-09-27 06:42:10 +00:00
Jeffrey Seyfried ebaaafcd5d Peform def id assignment during expansion. 2016-09-27 06:42:09 +00:00
Tim Neumann cf1fc2ce13 appease tidy 2016-09-26 07:07:41 +02:00
Tim Neumann ad81f11b01 deduplicate inline is_nightly_build implementations 2016-09-26 07:07:41 +02:00
Tim Neumann 3f287efc82 refactor away get_unstable_features_setting 2016-09-26 07:07:41 +02:00
Jeffrey Seyfried b4906a93a0 Load macros from `#[macro_use]` extern crates in `resolve`. 2016-09-24 20:22:25 +00:00
Jeffrey Seyfried 7b5c59ea65 Load extern crates in `resolve`. 2016-09-23 06:35:33 +00:00
Jeffrey Seyfried 272cf4e61d Refactor `no_implicit_prelude: Cell<bool>` -> `no_implicit_prelude: bool`. 2016-09-22 07:45:11 +00:00
bors 1cf592fa40 Auto merge of #36551 - eddyb:meta-games, r=nikomatsakis
Refactor away RBML from rustc_metadata.

RBML and `ty{en,de}code` have had their long-overdue purge. Summary of changes:
* Metadata is now a tree encoded in post-order and with relative backward references pointing to children nodes. With auto-deriving and type safety, this makes maintenance and adding new information to metadata painless and bug-free by default. It's also more compact and cache-friendly (cache misses should be proportional to the depth of the node being accessed, not the number of siblings as in EBML/RBML).
* Metadata sizes have been reduced, for `libcore` it went down 16% (`8.38MB` -> `7.05MB`) and for `libstd` 14% (`3.53MB` -> `3.03MB`), while encoding more or less the same information
* Specialization is used in the bundled `libserialize` (crates.io `rustc_serialize` remains unaffected) to customize the encoding (and more importantly, decoding) of various types, most notably those interned in the `TyCtxt`. Some of this abuses a soundness hole pending a fix (cc @aturon), but when that fix arrives, we'll move to macros 1.1 `#[derive]` and custom `TyCtxt`-aware serialization traits.
* Enumerating children of modules from other crates is now orthogonal to describing those items via `Def` - this is a step towards bridging crate-local HIR and cross-crate metadata
* `CrateNum` has been moved to `rustc` and both it and `NodeId` are now newtypes instead of `u32` aliases, for specializing their decoding. This is `[syntax-breaking]` (cc @Manishearth ).

cc @rust-lang/compiler
2016-09-21 19:17:24 -07:00
Eduard Burtescu fc363cb482 rustc_metadata: go only through rustc_serialize in astencode. 2016-09-20 20:07:54 +03:00
bors c772948b68 Auto merge of #36388 - pcwalton:copy-propagation, r=nikomatsakis
librustc_mir: Implement def-use chains and trivial copy propagation on MIR.

This only supports trivial cases in which there is exactly one def and
one use.

Currently, some random unrelated MIR tests are failing, probably just because they haven't been updated.

r? @eddyb
2016-09-20 08:01:01 -07:00
Patrick Walton 480287ec3b librustc: Implement def-use chains and trivial copy propagation on MIR.
This only supports trivial cases in which there is exactly one def and
one use.
2016-09-19 19:18:38 -07:00
bors e0547019eb Auto merge of #36102 - GuillaumeGomez:rustc_metadata_diagnostics, r=jonathandturner
Rustc metadata diagnostics

r? @jonathandturner
2016-09-19 13:23:12 -07:00
bors d37e54b419 Auto merge of #36504 - pcwalton:and-star, r=eddyb
librustc_mir: Remove `&*x` when `x` has a reference type.

This introduces a new `InstCombine` pass for us to place such peephole
optimizations.

r? @eddyb
2016-09-17 17:30:22 -07:00
bors d4037fc476 Auto merge of #36444 - jseyfried:macro_rules_ext, r=nrc
Remove variant `MacroRulesTT` of `SyntaxExtension`

r? @nrc
2016-09-16 14:15:13 -07:00
Patrick Walton e8a44d29b6 librustc_mir: Remove `&*x` when `x` has a reference type.
This introduces a new `InstCombine` pass for us to place such peephole
optimizations.
2016-09-16 09:30:51 -07:00
Jeffrey Seyfried 21ba8160f2 Move fields `single_step` and `keep_macs` from `MacroExpander` to `ExpansionConfig`. 2016-09-15 20:57:38 +00:00
Simonas Kazlauskas ffaebadc99 Default RUST_MIN_STACK to 16MiB for now 2016-09-15 23:40:48 +03:00
Jeffrey Seyfried 78c0039878 Expand generated test harnesses and macro registries. 2016-09-13 09:40:28 +00:00
Jeffrey Seyfried c86c8d41a2 Perform node id assignment and `macros_at_scope` construction during
the `InvocationCollector` and `PlaceholderExpander` folds.
2016-09-13 09:40:28 +00:00
Jeffrey Seyfried 72a636975f Move macro resolution into `librustc_resolve`. 2016-09-13 09:40:26 +00:00
Jeffrey Seyfried a9821e1658 Refactor `ExtCtxt` to use a `Resolver` instead of a `MacroLoader`. 2016-09-13 05:31:16 +00:00
bors 4a26286216 Auto merge of #36214 - jseyfried:stackless_expansion, r=nrc
macros: stackless expansion

After this PR, macro expansion cannot overflow the stack unless the expanded crate is too deep to fold.
Everything but the stackless placeholder expansion commit is also groundwork for macro modularization.

r? @nrc or @eddyb
2016-09-07 19:02:51 -07:00
bors 923bac4596 Auto merge of #36025 - michaelwoerister:incr-comp-hash-spans, r=nikomatsakis
incr. comp.: Take spans into account for ICH

This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled.

A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem.

Fixes #33888.
Fixes #32753.
2016-09-06 13:22:35 -07:00
Jeffrey Seyfried 9b3bc7a9e9 Remove `syntax::config::strip_unconfigured`, add `syntax::config::features`. 2016-09-05 04:53:16 +00:00
bors 86995dc8c5 Auto merge of #36240 - leeopop:master, r=jseyfried
Allow CompilerControllers to access rustc_plugin::registry::Registry

fixes #36064

I chose to put ructc_plugin::registry::Registry structure
into CompilerState structure, instead of Session structure.
This will preserve dependencies among librustc, libructc_driver, and libructc_plugin.

@jseyfried @sanxiyn
2016-09-04 18:36:42 -07:00
bors 91f057de35 Auto merge of #36203 - petrochenkov:uvsdot, r=nrc
Replace `_, _` with `..` in patterns

This is how https://github.com/rust-lang/rust/issues/33627 looks in action.

Looks especially nice in leftmost/rightmost positions `(first, ..)`/`(.., last)`.
I haven't touched libsyntax intentionally because the feature is still unstable.
2016-09-04 14:03:01 -07:00
bors e77d86c142 Auto merge of #36132 - nrc:save-std, r=@eddyb
Add --Zsave-analysis-api

This is a save-analysis variation which can be used with libraries distributed without their source (e.g., libstd). It will allow IDEs and other tools to get info about types and create URLs to docs and source, without the unnecessary clutter of internal-only save-analysis info. I'm sure we'll iterate somewhat on the design, but this is a first draft.
2016-09-04 02:40:31 -07:00
Vadim Petrochenkov e05e74ac83 Replace `_, _` with `..` 2016-09-04 12:30:33 +03:00
Keunhong Lee ca5dfd0c97 Allow CompilerControllers to access rustc_plugin::registry::Registry structure. 2016-09-04 03:22:56 +00:00
ggomez 7c53eb97df Add librustc metadata error codes to global check 2016-09-04 01:32:30 +02:00
Vadim Petrochenkov 641d8e9e4c Some better support for unions through the compiler 2016-09-03 13:39:34 +03:00
Alex Crichton ecc6c39e87 rustc: Implement custom derive (macros 1.1)
This commit is an implementation of [RFC 1681] which adds support to the
compiler for first-class user-define custom `#[derive]` modes with a far more
stable API than plugins have today.

[RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md

The main features added by this commit are:

* A new `rustc-macro` crate-type. This crate type represents one which will
  provide custom `derive` implementations and perhaps eventually flower into the
  implementation of macros 2.0 as well.

* A new `rustc_macro` crate in the standard distribution. This crate will
  provide the runtime interface between macro crates and the compiler. The API
  here is particularly conservative right now but has quite a bit of room to
  expand into any manner of APIs required by macro authors.

* The ability to load new derive modes through the `#[macro_use]` annotations on
  other crates.

All support added here is gated behind the `rustc_macro` feature gate, both for
the library support (the `rustc_macro` crate) as well as the language features.

There are a few minor differences from the implementation outlined in the RFC,
such as the `rustc_macro` crate being available as a dylib and all symbols are
`dlsym`'d directly instead of having a shim compiled. These should only affect
the implementation, however, not the public interface.

This commit also ended up touching a lot of code related to `#[derive]`, making
a few notable changes:

* Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't
  sure how to keep this behavior and *not* expose it to custom derive.

* Derive attributes no longer have access to unstable features by default, they
  have to opt in on a granular level.

* The `derive(Copy,Clone)` optimization is now done through another "obscure
  attribute" which is just intended to ferry along in the compiler that such an
  optimization is possible. The `derive(PartialEq,Eq)` optimization was also
  updated to do something similar.

---

One part of this PR which needs to be improved before stabilizing are the errors
and exact interfaces here. The error messages are relatively poor quality and
there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]`
not working by default. The custom attributes added by the compiler end up
becoming unstable again when going through a custom impl.

Hopefully though this is enough to start allowing experimentation on crates.io!

syntax-[breaking-change]
2016-09-02 12:52:56 -07:00
Michael Woerister dd65cb223a Add some infrastructure for timing things where time_passes can't be used. 2016-09-01 09:43:18 -04:00
Nick Cameron 4dc7b585a2 save-analysis: add parent info to api dumps
The parent id is used for constructing rustdoc URLs by clients
2016-09-01 14:55:27 +12:00
Nick Cameron cbafc5758b save-analsysis: add save-analysis-api CLI flag 2016-09-01 14:55:27 +12:00
bors 2c01bb8851 Auto merge of #35718 - michaelwoerister:incr-comp-dir-locking, r=alexcrichton
Implement synchronization scheme for incr. comp. directory

This PR implements a copy-on-write-based synchronization scheme for the incremental compilation cache directory. For technical details, see the documentation at the beginning of `rustc_incremental/persist/fs.rs`.

The PR contains unit tests for some functions but for testing whether the scheme properly handles races, a more elaborate test setup would be needed. It would probably involve a small tool that allows to manipulate the incremental compilation directory in a controlled way and then letting a compiler instance run against directories in different states. I don't know if it's worth the trouble of adding another test category to `compiletest`, but I'd be happy to do so.

Fixes #32754
Fixes #34957
2016-08-31 12:56:15 -07:00
Michael Woerister 3e9bed92da Implement copy-on-write scheme for managing the incremental compilation cache. 2016-08-29 14:27:40 -04:00
Jeffrey Seyfried c14ff2884d Rollup merge of #35917 - jseyfried:remove_attr_ext_traits, r=nrc
syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
2016-08-28 10:40:04 +00:00
Jeffrey Seyfried 6303640e85 Rollup merge of #35850 - SergioBenitez:master, r=nrc
Implement RFC#1559: allow all literals in attributes

Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-28 10:38:19 +00:00
Eduard Burtescu 7a8d4822d8 rustc: use Vec<Kind> in Substs, where Kind is a &TyS | &Region tagged pointer. 2016-08-27 01:15:07 +03:00
Eduard Burtescu dffd238f8b rustc: pass ty::Region behind an interned 'tcx reference. 2016-08-27 01:15:06 +03:00
Jeffrey Seyfried bfb01bbb26 Refactor away `AttrMetaMethods`. 2016-08-25 20:41:40 +00:00
Sergio Benitez 8250a26b5b Implement RFC#1559: allow all literals in attributes. 2016-08-25 13:25:22 -07:00
Manish Goregaokar cf597ab2ba Rollup merge of #35955 - frewsxcv:idiomatic-methods, r=eddyb
Use idiomatic names for string-related methods names.

None
2016-08-25 17:08:01 +05:30
Corey Farwell 2655c89549 Use idiomatic names for string-related methods names. 2016-08-23 21:28:26 -04:00
Niko Matsakis c21fa64dbb pacify the mercilous tidy 2016-08-23 13:28:55 -04:00
Niko Matsakis 484da37845 rename HashesMap to IncrementalHashesMap 2016-08-23 07:47:14 -04:00
Niko Matsakis 6bd80d1116 compute and cache HIR hashes at beginning
This avoids the compile-time overhead of computing them twice.  It also fixes
an issue where the hash computed after typeck is differen than the hash before,
because typeck mutates the def-map in place.

Fixes #35549.
Fixes #35593.
2016-08-20 07:26:14 -04:00
Eduard Burtescu 9453d9b8ad rustc: remove ParamSpace from Substs. 2016-08-17 06:32:00 +03:00
Eduard Burtescu 4158673ad7 rustc: reduce Substs and Generics to a simple immutable API. 2016-08-17 05:50:57 +03:00
bors 1bf5fa3269 Auto merge of #35538 - cgswords:libproc_macro, r=nrc
Kicking off libproc_macro

This PR introduces `libproc_macro`, which is currently quite bare-bones (just a few macro construction tools and an initial `quote!` macro).

This PR also introduces a few test cases for it, and an additional `shim` file (at `src/libsyntax/ext/proc_macro_shim.rs` to allow a facsimile usage of Macros 2.0 *today*!
2016-08-16 16:35:10 -07:00
cgswords 98c8e0a05d Proc_macro is alive 2016-08-16 13:17:36 -07:00
bors e25542cb02 Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis
Implement the `!` type

This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-16 00:12:12 -07:00