Commit Graph

53773 Commits

Author SHA1 Message Date
Jeffrey Seyfried
3fc0407fb3 Remove the dep-info-no-analysis test and fix other fallout. 2016-06-01 19:20:42 +00:00
Jeffrey Seyfried
c52968af8c Move name resolution to phase 2 2016-06-01 19:20:39 +00:00
Jeffrey Seyfried
58d7e1bf70 Remove redundant check_for_macros AST pass. 2016-06-01 18:51:35 +00:00
bors
c2cab1fd58 Auto merge of #33794 - petrochenkov:sanity, r=nrc
Add AST validation pass and move some checks to it

The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field.

This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros.

The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed.

I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules.

In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning.
Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change])
cc https://github.com/rust-lang/rfcs/pull/1177

r? @nrc
2016-06-01 06:21:53 -07:00
bors
806a5535da Auto merge of #34004 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests

- Successful merges: #33385, #33606, #33841, #33892, #33896, #33915, #33921, #33967, #33970, #33973, #33977
- Failed merges:
2016-06-01 00:28:44 -07:00
Manish Goregaokar
42e593a540 Rollup merge of #33977 - Ms2ger:create-and-enter, r=nrc
Take the def_map argument to TyCtxt::create_and_enter out of its RefCell.
2016-06-01 12:57:42 +05:30
Manish Goregaokar
86319f7f81 Rollup merge of #33973 - zackmdavis:stable_features_warning_notes_version_stabilized, r=brson
stable features lint warning mentions version stabilized

To accomplish this, we alter the checks in `rustc::middle::stability` to
use the `StabilityLevel` defined in `syntax::attr` (which includes the
version in which the feature was stabilized) rather than the local
`StabilityLevel` in the same module, and make the
`declared_stable_lang_features` field of
`syntax::feature_gate::Features` hold a Vec of feature-name, span
tuples (in analogy to the `declared_lib_features` field) rather than
just spans.

Fixes #33394.

![stable_features_version_lint_before_and_after](https://cloud.githubusercontent.com/assets/1076988/15659237/5d952a3a-267c-11e6-9181-c9e612eefd7d.png)

r? @brson (tagging Brian because he [wrote](https://github.com/rust-lang/rust/pull/21958) the lint)
2016-06-01 12:57:42 +05:30
Manish Goregaokar
e214c3e2da Rollup merge of #33970 - arielb1:normal-type-check, r=eddyb
normalize types in MIR typeck after erasing regions

this fixes the MIR bug @frankmcsherry encountered.

r? @eddyb
2016-06-01 12:57:42 +05:30
Manish Goregaokar
eba82bb569 Rollup merge of #33967 - dsprenkels:enum_pattern_resolve_ice, r=petrochenkov
resolve: record pattern def when `resolve_pattern` returns `Err(true)`

I propose a fix for issue #33293.

In 1a374b8, (pr #33046) fixed the error reporting of a specific case, but the change that was introduced did not make sure that `record_def` was called in all cases, which lead to an ICE in [1].
This change restores the original `else` case, but keeps the changes that were committed in 1a374b8.

[1] `rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_`
2016-06-01 12:57:42 +05:30
Manish Goregaokar
0e65b75b39 Rollup merge of #33921 - jameysharp:patch-1, r=alexcrichton
Inline simple Cursor write calls

Implementing the Write trait for Cursors over slices is so light-weight that under some circumstances multiple writes can be fused into a single instruction. In general I think inlining these functions is a good idea because most of the code can be constant-folded and copy-propagated away.

Closes issue #33916.

r? @alexcrichton
2016-06-01 12:57:42 +05:30
Manish Goregaokar
d9cd460f6c Rollup merge of #33915 - GuillaumeGomez:err-codes, r=steveklabnik
Add new error code tests

r? @steveklabnik
2016-06-01 12:57:41 +05:30
Manish Goregaokar
67e158fc4c Rollup merge of #33896 - strake:next_code_point, r=aturon
make core::str::next_code_point work on arbitrary iterator
2016-06-01 12:57:41 +05:30
Manish Goregaokar
7694e18d43 Rollup merge of #33892 - seanmonstar:slice-eq-ptr, r=alexcrichton
core: check pointer equality when comparing byte slices

If pointer address and length are the same, it should be the same slice.

In experiments, I've seen that this doesn't happen as often in debug builds, but release builds seem to optimize to using a single pointer more often.
2016-06-01 12:57:41 +05:30
Manish Goregaokar
4721f3a543 Rollup merge of #33841 - LeoTestard:macro-sequence-lhs, r=pnkfelix
Reject a LHS formed of a single sequence TT during `macro_rules!` checking.

This was already rejected during expansion. Encountering malformed LHS or RHS during expansion is now considered a bug.

Follow up to #33689.

r? @pnkfelix

Note: this can break code that defines such macros but does not use them.
2016-06-01 12:57:41 +05:30
Manish Goregaokar
cbfe74c3c8 Rollup merge of #33606 - tshepang:future-talk, r=brson
doc: format! may or may not handle streams in future

No need to talk about that here
2016-06-01 12:57:41 +05:30
Manish Goregaokar
b0e88279c7 Rollup merge of #33385 - cheercroaker:doc-correction, r=brson
Mention initial year of publication only for the documentation copyright

I have corrected the "copyright expiration year" that was still 2015 in the documentation copyright notice.

According to #31007 it seems that we could go one step further and simplify the copyright notice to only mention the year of original publication ("Copyright © 2011" in this case).

Let me know if you would prefer this copyright notice to only mention the year of original publication (please make sure that it is really 2011 as stated in the current version of the documentation, and not 2010 like Rust's code) and I'll make the simplification.
2016-06-01 12:57:40 +05:30
bors
433d70cda2 Auto merge of #33141 - tshepang:python-love, r=brson
some Python nits and fixes
2016-05-31 21:37:42 -07:00
bors
ad5fbaf57c Auto merge of #33979 - retep998:why-the-long-face, r=alexcrichton
Attempt to diagnose #33844

https://github.com/rust-lang/rust/issues/33844 is a spurious failure that causes builds to fail due to the linker command sometimes failing with error 206, which means that the command is too long. This PR makes rustc print out the linker arguments in that case so the reason for it being so long can be diagnosed and hopefully fixed.

r? @alexcrichton
2016-05-31 18:49:48 -07:00
bors
601eb13dc4 Auto merge of #33857 - alexcrichton:new-stage0, r=nikomatsakis
mk: Prepare for a new stage0 compiler

This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-31 16:12:16 -07:00
Alex Crichton
fa45670ce4 mk: Prepare for a new stage0 compiler
This commit prepares the source for a new stage0 compiler, the 1.10.0 beta
compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-31 16:11:49 -07:00
Peter Atashian
d34ad3c3b2
Print linker arguments if calling the linker fails
Needed to diagnose https://github.com/rust-lang/rust/issues/33844

Signed-off-by: Peter Atashian <retep998@gmail.com>
2016-05-31 16:29:12 -04:00
Ariel Ben-Yehuda
e3cff797a7 normalize types in MIR typeck after erasing regions 2016-05-31 18:42:47 +03:00
Ms2ger
7463c95183 Take the def_map argument to TyCtxt::create_and_enter out of its RefCell. 2016-05-31 09:21:49 +02:00
bors
298730e703 Auto merge of #33960 - tbu-:pr_ref_clone_overflow, r=Aatch
Prevent the borrow counter from overflowing in `Ref::clone`

Fixes #33880.
2016-05-30 23:09:00 -07:00
bors
a967611d8f Auto merge of #33968 - srinivasreddy:slice.rs, r=Manishearth
Correct grammar; and remove redundant comment
2016-05-30 16:34:34 -07:00
Zack M. Davis
06c9e0f5f8 stable features lint warning mentions version stabilized
To accomplish this, we alter the checks in `rustc::middle::stability` to
use the `StabilityLevel` defined in `syntax::attr` (which includes the
version in which the feature was stabilized) rather than the local
`StabilityLevel` in the same module, and make the
`declared_stable_lang_features` field of
`syntax::feature_gate::Features` hold a Vec of feature-name, span
tuples (in analogy to the `declared_lib_features` field) rather than
just spans.

This is in the matter of issue #33394.
2016-05-30 15:17:13 -07:00
bors
b522b25a41 Auto merge of #33909 - michaelwoerister:frame-pointer-fix, r=nikomatsakis
Emit "no-frame-pointer-elim" attribute for closures, shims, and glue.

This will hopefully let `perf` give better backtraces.
r? @nikomatsakis
2016-05-30 11:01:55 -07:00
Srinivas Reddy Thatiparthy
87bc04f45c Correct grammar; and remove redundant comment 2016-05-30 22:38:07 +05:30
Daan Sprenkels
cde0f94a52 librustc_resolve: make sure pattern def gets recorded if resolve_path returns Err(true)
In 1a374b8, (pr #33046) fixed the error reporting of a specific
case, but the change that was introduced did not make sure that
`record_def` was called in all cases, which lead to an ICE in [1].
This change restores the original `else` case, but keeps the changes
that were committed in 1a374b8.

This commit fixes issue #33293.

[1] `rustc::middle::mem_categorization::MemCategorizationContext::cat_pattern_`
2016-05-30 18:31:01 +02:00
bors
f3bfa313ec Auto merge of #33965 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests

- Successful merges: #33867, #33926, #33942, #33958, #33964
- Failed merges:
2016-05-30 08:13:08 -07:00
Manish Goregaokar
26c209897f Rollup merge of #33964 - Ms2ger:refcell-resolutions, r=Manishearth
Move driver::Resolutions::def_map out of its RefCell.
2016-05-30 20:35:47 +05:30
Manish Goregaokar
5ef7c43a76 Rollup merge of #33958 - kennytm:patch-1, r=GuillaumeGomez
Use Path::is_dir() in fs::read_dir()'s example.

Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2016-05-30 20:35:47 +05:30
Manish Goregaokar
066fc8d9a6 Rollup merge of #33942 - srinivasreddy:rustfmt_llvm_folder, r=nrc
run rustfmt on librustc_llvm folder
2016-05-30 20:35:46 +05:30
Manish Goregaokar
2b5724f0c4 Rollup merge of #33926 - jseyfried:fix_derive_span, r=nrc
Fix the span of generated `#[derive_*]` attributes

Fixes #33571.
r? @nrc
2016-05-30 20:35:46 +05:30
Manish Goregaokar
653ce3e525 Rollup merge of #33867 - oli-obk:rustdoc_variant_types, r=GuillaumeGomez
print enum variant fields in docs

Right now we are repeating enum variants at the top, because the fields aren't shown with the actual docs. It's very annoying to have to scroll up and down to have both docs and field info. For struct variants we already list the fields.

enum docs look like this after this PR:

![screenshot from 2016-05-25 14-02-42](https://cloud.githubusercontent.com/assets/332036/15539231/84b018cc-2281-11e6-9666-1063655931f4.png)

There are degenerate cases for enum tuple variants with lots of fields:

![screenshot from 2016-05-25 14-01-00](https://cloud.githubusercontent.com/assets/332036/15539260/91e537ca-2281-11e6-8bf1-a3d6b2e78f65.png)

I was thinking that we could move the docs below the variant (slightly indented) or list the variant fields vertically instead of horizontally

r? @steveklabnik
2016-05-30 20:35:46 +05:30
Oliver Schneider
b0c7033042
print enum variant fields in docs 2016-05-30 16:11:53 +02:00
Ms2ger
989a3034db Move driver::Resolutions::def_map out of its RefCell. 2016-05-30 15:17:16 +02:00
bors
5da602bda3 Auto merge of #33959 - Manishearth:rollup, r=Manishearth
Rollup of 8 pull requests

- Successful merges: #33793, #33893, #33912, #33913, #33914, #33917, #33937, #33938
- Failed merges:
2016-05-30 02:54:00 -07:00
Manish Goregaokar
9d2ec40b74 Rollup merge of #33938 - srinivasreddy:rustfmt_libunwind, r=Manishearth
run rustfmt on libunwind
2016-05-30 15:19:01 +05:30
Manish Goregaokar
21dc6c2678 Rollup merge of #33937 - srinivasreddy:rustfmt_librand, r=GuillaumeGomez
run rustfmt on librand folder
2016-05-30 15:19:01 +05:30
Manish Goregaokar
0072e6b9e3 Rollup merge of #33917 - srinivasreddy:rustfmt_liballoc, r=GuillaumeGomez
rustfmt liballoc folder
2016-05-30 15:19:00 +05:30
Manish Goregaokar
c41e9d9f40 Rollup merge of #33914 - GuillaumeGomez:improve_err_expl, r=GuillaumeGomez
Improve err expl

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
6c6dcc9539 Rollup merge of #33913 - GuillaumeGomez:improve_e0133, r=GuillaumeGomez
Improve E0133 error explanation

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
11549f0206 Rollup merge of #33912 - GuillaumeGomez:improve_E0132, r=steveklabnik
Improve E0132 error explanation

r? @steveklabnik
2016-05-30 15:19:00 +05:30
Manish Goregaokar
400b9b3242 Rollup merge of #33893 - Ophirr33:docs_string_split_fix, r=GuillaumeGomez
Added examples/docs to split in str.rs

Added documentation clarifying the behavior of split when used with the empty string and contiguous separators. Addresses issue [33882](https://github.com/rust-lang/rust/issues/33882). This is my first time contributing to rust, so forgive me if I'm skipping any of the contribution steps.
Fixes #33882
2016-05-30 15:19:00 +05:30
Manish Goregaokar
10e1e6a7a2 Rollup merge of #33793 - GuillaumeGomez:compile_fail, r=GuillaumeGomez
Fix compile_fail tag

Fixes #33780

r? @steveklabnik
2016-05-30 15:18:59 +05:30
kennytm
048f37254c Use Path::is_dir() in fs::read_dir()'s example.
Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2016-05-30 17:12:01 +08:00
Tobias Bucher
ef60c7cd49 Prevent the borrow counter from overflowing in Ref::clone
Fixes #33880.
2016-05-30 09:53:09 +02:00
bors
bf9c60c9a6 Auto merge of #33929 - petrochenkov:pathir, r=eddyb
Separate bindings from other patterns in HIR

Now when name resolution is done on AST, we can avoid dumping everything that looks like an identifier into `PatKind::Ident` in HIR.
`hir::PatKind::Ident` is removed, fresh bindings are now called `hir::PatKind::Binding`, everything else goes to `hir::PatKind::Path`.

I intend to do something with `PatKind::Path`/`PatKind::QPath` as well using resolution results, but it requires some audit and maybe some deeper refactoring of relevant resolution/type checking code to do it properly.
I'm submitting this part of the patch earlier to notify interested parties that I'm working on this.

cc @jseyfried
r? @eddyb
2016-05-29 21:28:50 -07:00
bors
6e00b55568 Auto merge of #33860 - doomrobo:fix-grammar-verification, r=nagisa
antlr grammar verification script now compiles under latest nightly

This is kind of a moving target, since none of libsyntax is stable, but at least this compiles for the time being.
2016-05-29 16:43:09 -07:00