Commit Graph

2543 Commits

Author SHA1 Message Date
cgswords
98c8e0a05d Proc_macro is alive 2016-08-16 13:17:36 -07:00
bors
eec30ea657 Auto merge of #35453 - jseyfried:hygienize_metavariables, r=nrc
macros: Make metavariables hygienic

This PR makes metavariables hygienic. For example, consider:
```rust
macro_rules! foo {
    ($x:tt) => { // Suppose that this token tree argument is always a metavariable.
        macro_rules! bar { ($x:expr, $y:expr) => { ($x, $y) } }
    }
}

fn main() {
    foo!($z); // This currently compiles.
    foo!($y); // This is an error today but compiles after this PR.
}
```
Today, the `macro_rules! bar { ... }` definition is only valid when the metavariable passed to `foo` is not `$y` (since it unhygienically conflicts with the `$y` in the definition of `bar`) or `$x` (c.f. #35450).

After this PR, the definition of `bar` is always valid (and `bar!(a, b)` always expands to `(a, b)` as expected).

This can break code that was allowed in #34925 (landed two weeks ago). For example,
```rust
macro_rules! outer {
    ($t:tt) => {
        macro_rules! inner { ($i:item) => { $t } }
    }
}

outer!($i); // This `$i` should not interact with the `$i` in the definition of `inner!`.
inner!(fn main() {}); // After this PR, this is an error ("unknown macro variable `i`").
```

Due to the severe limitations on nested `macro_rules!` before #34925, this is not a breaking change for stable/beta.

Fixes #35450.

r? @nrc
2016-08-13 23:37:11 -07:00
bors
68d9284a9b Auto merge of #34811 - DanielJCampbell:Expander, r=jseyfried
Extended expand.rs to support alternate expansion behaviours (eg. stepwise expansion)

r? nrc
2016-08-11 22:10:16 -07:00
Daniel Campbell
61c7569d4a Extended expand.rs to support alternate expansion behaviours
Added single_step & keep_macs flags and functionality to expander
2016-08-10 18:35:15 +12:00
Jeffrey Seyfried
f9f99c5a9c Make metavariables hygienic. 2016-08-07 06:01:01 +00:00
bors
f164cf5d64 Auto merge of #34842 - cgswords:attr_enc, r=nrc
Better attribute and metaitem encapsulation throughout the compiler

This PR refactors most (hopefully all?) of the `MetaItem` interactions outside of `libsyntax` (and a few inside) to interact with MetaItems through the provided traits instead of directly creating / destruct / matching against them. This is a necessary first step to eventually converting `MetaItem`s to internally use `TokenStream` representations (which will make `MetaItem` interactions much nicer for macro writers once the new macro system is in place).

r? @nrc
2016-07-29 16:26:38 -07:00
cgswords
a5e5ea1646 General MetaItem encapsulation rewrites. 2016-07-25 14:27:10 -07:00
Jeffrey Seyfried
41745f30f7 macros: Improve tt fragments 2016-07-23 12:49:01 -07:00
cgswords
536c315795 Introduced NoDelim and modified the compiler to support it. 2016-07-19 16:05:44 -07:00
bors
6cc49e51de Auto merge of #34860 - jseyfried:encapsulate_hygiene, r=nrc
Clean up and encapsulate `syntax::ext::mtwt`, rename `mtwt` to `hygiene`

r? @nrc
2016-07-17 22:12:59 -07:00
Jeffrey Seyfried
275d321ab0 Remove some unit tests and that are redundant with run-pass/hygiene.rs
and that would be painful to rewrite.
2016-07-17 17:12:35 +00:00
Jeffrey Seyfried
44575f708a Rename mtwt to hygiene 2016-07-17 17:12:35 +00:00
Jeffrey Seyfried
76ed445622 Clean up and encapsulate syntax::ext::mtwt 2016-07-17 17:12:32 +00:00
bors
eb196dc2ff Auto merge of #34816 - jseyfried:fix_include_path, r=nrc
Fix `include!()`s inside `asm!()` invocations

Fixes #34812, a regression caused by #33749 that was not fixed in #34450.
r? @nrc
2016-07-16 06:34:01 -07:00
bors
4db1874f4c Auto merge of #34570 - jseyfried:no_rename, r=nrc
Simplify the macro hygiene algorithm

This PR removes renaming from the hygiene algorithm and treats differently marked identifiers as unequal.

This change makes the scope of identifiers in `macro_rules!` items empty. That is, identifiers in `macro_rules!` definitions do not inherit any semantics from the `macro_rules!`'s scope.

Since `macro_rules!` macros are items, the scope of their identifiers "should" be the same as that of other items; in particular, the scope should contain only items. Since all items are unhygienic today, this would mean the scope should be empty.

However, the scope of an identifier in a `macro_rules!` statement today is the scope that the identifier would have if it replaced the `macro_rules!` (excluding anything unhygienic, i.e. locals only).

To continue to support this, this PR tracks the scope of each `macro_rules!` and uses it in `resolve` to ensure that an identifier expanded from a `macro_rules!` gets a chance to resolve to the locals in the `macro_rules!`'s scope.

This PR is a pure refactoring. After this PR,
 - `syntax::ext::expand` is much simpler.
 - We can expand macros in any order without causing problems for hygiene (needed for macro modularization).
 - We can deprecate or remove today's `macro_rules!` scope easily.
 - Expansion performance improves by 25%, post-expansion memory usage decreases by ~5%.
 - Expanding a block is no longer quadratic in the number of `let` statements (fixes #10607).

r? @nrc
2016-07-15 08:48:41 -07:00
Jeffrey Seyfried
4e74c181a4 Make ext::base::expr_to_string work correctly with include! macro invocations 2016-07-14 10:27:18 +00:00
Jeffrey Seyfried
56c4ddffae Remove irrelevant tests 2016-07-14 01:34:38 +00:00
Jeffrey Seyfried
0701571fe7 Implement macro_rules! placeholders and the macro scope map 2016-07-14 01:34:37 +00:00
Jeffrey Seyfried
a15dfca54f Instead of renaming, treat differently marked identifiers as unequal 2016-07-14 01:34:31 +00:00
Jeffrey Seyfried
ca924047de Remove IllegalCtxt 2016-07-14 01:30:22 +00:00
Jeffrey Seyfried
57fac56cb5 Start a best-effort warning cycle. 2016-07-13 04:50:35 +00:00
Jeffrey Seyfried
c1b850d304 cleanup: Refactor parser method finish_parsing_statement -> parse_full_stmt. 2016-07-13 04:49:32 +00:00
Jeffrey Seyfried
57c56dd7e0 Parse macro-expanded statements like ordinary statements. 2016-07-12 04:31:39 +00:00
Jeffrey Seyfried
6189e6cdba Clean up statement parsing without changing the semantics of parse_stmt. 2016-07-12 04:31:13 +00:00
bors
de78655bca Auto merge of #34652 - jseyfried:fix_expansion_perf, r=nrc
Fix expansion performance regression

**syntax-[breaking-change] cc #31645**

This fixes #34630 by reverting commit 5bf7970 of PR #33943, which landed in #34424.

By removing the `Rc<_>` wrapping around `Delimited` and `SequenceRepetition` in `TokenTree`, 5bf7970 made cloning `TokenTree`s more expensive. While this had no measurable performance impact on the compiler's crates, it caused an order of magnitude performance regression on some macro-heavy code in the wild. I believe this is due to clones of `TokenTree`s in `macro_parser.rs` and/or `macro_rules.rs`.

r? @nrc
2016-07-06 20:04:11 -07:00
bors
34c9cddc89 Auto merge of #34654 - jseyfried:configure_multi_modified, r=nrc
Perform `cfg` attribute processing on `MultiModifier`-generated items

Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180.
r? @nrc
2016-07-06 11:13:48 -07:00
Jeffrey Seyfried
c454c1d4ac Strip unconfigured items from MultiModifier-expanded AST 2016-07-05 00:14:41 +00:00
Jeffrey Seyfried
547a930835 Revert "Change fold_tt and fold_tts to take token trees by value (instead of by reference)"
This reverts commit 5bf7970ac7.
2016-07-04 23:42:35 +00:00
Zack M. Davis
d37edef9dd prefer if let to match with None => {} arm in some places
This is a spiritual succesor to #34268/8531d581, in which we replaced a
number of matches of None to the unit value with `if let` conditionals
where it was judged that this made for clearer/simpler code (as would be
recommended by Manishearth/rust-clippy's `single_match` lint). The same
rationale applies to matches of None to the empty block.
2016-07-03 16:27:02 -07:00
Manish Goregaokar
8886818a9a Rollup merge of #34495 - jseyfried:only_ident_macro_invocations, r=eddyb
Forbid type parameters and global paths in macro invocations

Fixes #28558.
This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m { () => { () } }
fn main() {
    m::<T>!(); // Type parameters are no longer allowed in macro invocations
    ::m!(); // Global paths are no longer allowed in macro invocations
}
```
Any breakage can be fixed by removing the type parameters or the leading `::` (respectively).

r? @eddyb
2016-06-29 21:21:22 +05:30
Manish Goregaokar
fd45e6e912 Rollup merge of #34459 - jseyfried:expansion_cleanup, r=nrc
Miscellaneous macro expansion cleanup and groundwork

r? @nrc
2016-06-29 21:21:21 +05:30
Jeffrey Seyfried
a595ffaac5 Treat MultiDecorators as a special case of MultiModifiers 2016-06-29 01:25:46 +00:00
Jeffrey Seyfried
2dc15f2b96 cleanup: use DummyResult to implement MacroGenerable::dummy 2016-06-28 05:28:22 +00:00
bors
ea0dc92972 Auto merge of #34424 - jseyfried:breaking_batch, r=Manishearth
Batch up libsyntax breaking changes

Batch of the following syntax-[breaking-change] changes:
 - #34213: Add a variant `Macro` to `TraitItemKind`
 - #34368: Merge the variant `QPath` of `PatKind` into the variant `PatKind::Path`
 - #34385: Move `syntax::ast::TokenTree` into a new module `syntax::tokenstream`
 - #33943:
  - Remove the type parameter from `visit::Visitor`
  - Remove `attr::WithAttrs` -- use `attr::HasAttrs` instead.
  - Change `fold_tt`/`fold_tts` to take token trees by value and avoid wrapping token trees in `Rc`.
  - Remove the field `ctxt` of `ast::Mac_`
  - Remove inherent method `attrs()` of types -- use the method `attrs` of `HasAttrs` instead.
 - #34316:
  - Remove `ast::Decl`/`ast::DeclKind` and add variants `Local` and `Item` to `StmtKind`.
  - Move the node id for statements from the `StmtKind` variants to a field of `Stmt` (making `Stmt` a struct instead of an alias for `Spanned<StmtKind>`)
  - Rename `ast::ExprKind::Again` to `Continue`.
 - #34339: Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`
  - Use `.into()` in convert between `Vec<Attribute>` and `ThinVec<Attribute>`
  - Use autoderef instead of `.as_attr_slice()`
 - #34436: Remove the optional expression from `ast::Block` and instead use a `StmtKind::Expr` at the end of the statement list.
 - #34403: Move errors into a separate crate (unlikely to cause breakage)
2016-06-27 16:42:03 -07:00
Jeffrey Seyfried
e01a2ba274 Forbid type parameters and global paths in macro invocations 2016-06-27 03:17:46 +00:00
Jeffrey Seyfried
9bb3ea0feb Rollup merge of #34436 - jseyfried:no_block_expr, r=eddyb
To allow these braced macro invocation, this PR removes the optional expression from `ast::Block` and instead uses a `StmtKind::Expr` at the end of the statement list.

Currently, braced macro invocations in blocks can expand into statements (and items) except when they are last in a block, in which case they can only expand into expressions.

For example,
```rust
macro_rules! make_stmt {
    () => { let x = 0; }
}

fn f() {
    make_stmt! {} //< This is OK...
    let x = 0; //< ... unless this line is commented out.
}
```

Fixes #34418.
2016-06-26 02:20:14 +00:00
Jeffrey Seyfried
8eddf02800 Rollup merge of #34339 - jseyfried:thin_vec, r=petrochenkov,Manishearth
Generalize and abstract `ThinAttributes` to `ThinVec<Attribute>`.
2016-06-26 02:18:43 +00:00
Jeffrey Seyfried
8748cd92d0 Rollup merge of #34316 - jseyfried:refactor_ast_stmt, r=eddyb
Refactor away `ast::Decl`, refactor `ast::Stmt`, and rename `ast::ExprKind::Again` to `ast::ExprKind::Continue`.
2016-06-26 02:17:27 +00:00
Jeffrey Seyfried
33ea1e330c Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrc
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-26 02:15:04 +00:00
Jeffrey Seyfried
82a15a6a0a Rollup merge of #34385 - cgswords:tstream, r=nrc
syntax-[breaking-change] cc #31645
(Only breaking because ast::TokenTree is now tokenstream::TokenTree.)

This pull request refactors TokenTrees into their own file as src/libsyntax/tokenstream.rs, moving them out of src/libsyntax/ast.rs, in order to prepare for an accompanying TokenStream implementation (per RFC 1566).
2016-06-26 02:11:59 +00:00
Jeffrey Seyfried
d3ae56d755 Rollup merge of #34403 - jonathandturner:move_liberror, r=alexcrichton
This PR refactors the 'errors' part of libsyntax into its own crate (librustc_errors).  This is the first part of a few refactorings to simplify error reporting and potentially support more output formats (like a standardized JSON output and possibly an --explain mode that can work with the user's code), though this PR stands on its own and doesn't assume further changes.

As part of separating out the errors crate, I have also refactored the code position portion of codemap into its own crate (libsyntax_pos).  While it's helpful to have the common code positions in a separate crate for the new errors crate, this may also enable further simplifications in the future.
2016-06-25 22:35:09 +00:00
Jeffrey Seyfried
4e2e31c118 Rollup merge of #34368 - petrochenkov:astqpath, r=Manishearth
The AST part of https://github.com/rust-lang/rust/pull/34365

plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645
2016-06-25 22:35:06 +00:00
Jeffrey Seyfried
f0310e061b Rollup merge of #34213 - josephDunne:trait_item_macros, r=jseyfried
**syntax-[breaking-change]** cc #31645
New `TraitItemKind::Macro` variant

This change adds support for macro expansion inside trait items by adding the new `TraitItemKind::Macro` and associated parsing code.
2016-06-25 22:35:01 +00:00
Jeffrey Seyfried
fd12c34601 Revert a change to the relative path for macro-expanded include!s 2016-06-24 11:43:59 +00:00
Jeffrey Seyfried
8cad25199a Add ecx.stmt_semi() and fix issues with the pretty-printer 2016-06-24 11:39:54 +00:00
Jeffrey Seyfried
060a84d1f7 Refactor away duplicate method ecx.block_all() 2016-06-23 23:26:43 +00:00
Jeffrey Seyfried
b7da35a5aa Remove field expr of ast::Block 2016-06-23 17:42:08 +00:00
Jonathan Turner
51deb4fedb Address more travis errors 2016-06-23 08:07:35 -04:00
Jonathan Turner
6ae3502134 Move errors from libsyntax to its own crate 2016-06-23 08:07:35 -04:00
bors
3908913db5 Auto merge of #34253 - jseyfried:improve_multi_modifiers, r=nrc
Allow `MultiItemModifier`s to expand into zero or many items

Fixes #34223.
r? @nrc
2016-06-23 01:04:47 -07:00
cgswords
d59accfb06 Refactored tokentrees into their own files in preparation for tokenstreams. Modified tests to point to the new file now. 2016-06-21 11:12:36 -07:00
Vadim Petrochenkov
f903c97959 Merge PatKind::QPath into PatKind::Path in AST 2016-06-20 23:39:02 +03:00
Jeffrey Seyfried
a93455eb5d Remove unit tests 2016-06-20 12:13:57 +00:00
Jeffrey Seyfried
d7fa72abe2 Fix hygiene regression 2016-06-20 11:27:54 +00:00
bors
b1ae194fa6 Auto merge of #34295 - jseyfried:cfg_decoration, r=eddyb
Perform `cfg` attribute processing on decorator-generated items

Fixes https://users.rust-lang.org/t/unused-attribute-warning-for-custom-derive-attribute/6180.
r? @nrc
2016-06-18 20:12:09 -07:00
Jeffrey Seyfried
5033eca65f Generalize and abstract ThinAttributes 2016-06-19 00:01:55 +00:00
Jeffrey Seyfried
962d5c16b5 Fix fallout 2016-06-17 05:21:23 +00:00
bors
f911d87b3b Auto merge of #34272 - jseyfried:simplify_gated_cfg_checking, r=nrc
Simplify gated cfg checking

r? @nrc
2016-06-16 16:09:45 -07:00
Jeffrey Seyfried
2cd6ccf0b1 Simplify gated cfg checking 2016-06-16 19:24:44 +00:00
bors
18f28719ef Auto merge of #34187 - luser:extern-crate-abspaths, r=michaelwoerister
Add an abs_path member to FileMap, use it when writing debug info.

Fixes #34179.

When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
2016-06-16 12:13:25 -07:00
Ted Mielczarek
24e7491660 Add an abs_path member to FileMap, use it when writing debug info.
When items are inlined from extern crates, the filename in the debug info
is taken from the FileMap that's serialized in the rlib metadata.
Currently this is just FileMap.name, which is whatever path is passed to rustc.
Since libcore and libstd are built by invoking rustc with relative paths,
they wind up with relative paths in the rlib, and when linked into a binary
the debug info uses relative paths for the names, but since the compilation
directory for the final binary, tools trying to read source filenames
will wind up with bad paths. We noticed this in Firefox with source
filenames from libcore/libstd having bad paths.

This change stores an absolute path in FileMap.abs_path, and uses that
if available for writing debug info. This is not going to magically make
debuggers able to find the source, but it will at least provide sensible
paths.
2016-06-16 18:08:46 +01:00
bors
7aba683c76 Auto merge of #34239 - jseyfried:fix_macro_use_scope_regression, r=nrc
Revert a change in the scope of macros imported from crates to fix a regression

Fixes #34212.
The regression was caused by #34032, which changed the scope of macros imported from extern crates to match the scope of macros imported from modules.
r? @nrc
2016-06-16 06:37:18 -07:00
Jeffrey Seyfried
c41cf30e9d Strip unconfigured nodes from decorator-generated AST 2016-06-16 07:58:43 +00:00
Jeffrey Seyfried
83d283b67b Avoid expanding decorator-generated items twice 2016-06-16 06:44:38 +00:00
Jeffrey Seyfried
ac1a1d32f6 Allow MultiItemModifiers to expand into zero or many items 2016-06-16 03:55:55 +00:00
Jeffrey Seyfried
34191ed1c8 Refactor MultiModifier expansion 2016-06-16 03:55:53 +00:00
Jeffrey Seyfried
6ba7b7c22d Implement HasAttrs for Annotatable 2016-06-16 03:55:52 +00:00
Jeffrey Seyfried
0644aba0b3 Remove the type parameter from syntax::visit::Visitor 2016-06-14 07:40:32 +00:00
Jeffrey Seyfried
683e480ffe Refactor away WithAttrs trait 2016-06-14 07:40:30 +00:00
Jeffrey Seyfried
5bf7970ac7 Change fold_tt and fold_tts to take token trees by value (instead of by reference) 2016-06-14 07:40:18 +00:00
Jeffrey Seyfried
febe6a46f6 Refactor away field ctxt of ast::Mac_ 2016-06-14 07:39:33 +00:00
bors
bf84f4e171 Auto merge of #33749 - jseyfried:fix_call_site_span, r=nrc
Fix macro call site spans

Fix macro call site spans.
r? @nrc
2016-06-13 21:07:30 -07:00
Joseph Dunne
dc3d878e0f Add support for macro expansion inside trait items 2016-06-13 21:46:43 +01:00
Jeffrey Seyfried
2d1f3009cc Load macros from #[macro_use] crates earlier in expansion 2016-06-12 05:56:52 +00:00
Jeffrey Seyfried
8104df27ec Add method visit_with to MacroGenerable 2016-06-12 05:56:47 +00:00
Jeffrey Seyfried
66b9ade341 Strip #[test] nodes during cfg processing on non-test builds. 2016-06-11 03:13:44 +00:00
Jeffrey Seyfried
dbf0326ddc Add comment and clean up expand_annotatable 2016-06-09 00:49:42 +00:00
Jeffrey Seyfried
51499b6e1f Load macros from extern crates during expansion. 2016-06-09 00:44:17 +00:00
bors
ff1315591f Auto merge of #34010 - jseyfried:decorate_expanded, r=nrc
Run decorators on expanded AST

Fixes #32950.
r? @nrc
2016-06-08 02:05:38 -07:00
bors
371bf0eda2 Auto merge of #33982 - LeoTestard:remove-check-matcher-old, r=pnkfelix
Remove the old FOLLOW checking (aka `check_matcher_old`).

It was supposed to be removed at the next release cycle but is still in the tree since like 6 months.
Potential breaking change, since some cases (such as #25658) will change from a warning to an error. But the warning stating that it will be a hard error in the next release has been there for 6 months now.
I think it's safe to break this code. ^_^
2016-06-07 17:56:35 -07:00
Leo Testard
4dab8ae64e Remove the old FOLLOW checking (aka check_matcher_old). 2016-06-06 12:27:34 +02:00
bors
12238b984a Auto merge of #33816 - nikomatsakis:projection-cache-2, r=arielb1
Projection cache and better warnings for #32330

This PR does three things:

- it lays the groundwork for the more precise subtyping rules discussed in #32330, but does not enable them;
- it issues warnings when the result of a leak-check or subtyping check relies on a late-bound region which will late become early-bound when #32330 is fixed;
- it introduces a cache for projection in the inference context.

I'm not 100% happy with the approach taken by the cache here, but it seems like a step in the right direction. It results in big wins on some test cases, but not as big as previous versions -- I think because it is caching the `Vec<Obligation>` (whereas before I just returned the normalized type with an empty vector). However, that change was needed to fix an ICE in @alexcrichton's future-rs module (I haven't fully tracked the cause of that ICE yet). Also, because trans/the collector use a fresh inference context for every call to `fulfill_obligation`, they don't profit nearly as much from this cache as they ought to.

Still, here are the results from the future-rs `retry.rs`:

```
06:26 <nmatsakis> time: 6.246; rss: 44MB  item-bodies checking
06:26 <nmatsakis> time: 54.783; rss: 63MB   translation item collection
06:26 <nmatsakis> time: 140.086; rss: 86MB    translation

06:26 <nmatsakis> time: 0.361; rss: 46MB  item-bodies checking
06:26 <nmatsakis> time: 5.299; rss: 63MB    translation item collection
06:26 <nmatsakis> time: 12.140; rss: 86MB translation
```

~~Another example is the example from #31849. For that, I get 34s to run item-bodies without any cache. The version of the cache included here takes 2s to run item-bodies type-checking. An alternative version which doesn't track nested obligations takes 0.2s, but that version ICEs on @alexcrichton's future-rs (and may well be incorrect, I've not fully convinced myself of that). So, a definite win, but I think there's definitely room for further progress.~~

Pushed a modified version which improves performance of the case from #31849:

```
lunch-box. time rustc --stage0 ~/tmp/issue-31849.rs  -Z no-trans
real    0m33.539s
user    0m32.932s
sys     0m0.570s
lunch-box. time rustc --stage2 ~/tmp/issue-31849.rs  -Z no-trans
real    0m0.195s
user    0m0.154s
sys     0m0.042s
```

Some sort of cache is also needed for unblocking further work on lazy normalization, since that will lean even more heavily on the cache, and will also require cycle detection.

r? @arielb1
2016-06-04 10:47:55 -07:00
Jeffrey Seyfried
58d7e1bf70 Remove redundant check_for_macros AST pass. 2016-06-01 18:51:35 +00:00
Jeffrey Seyfried
dc5cc1b1f2 Run decorators on expanded AST. 2016-06-01 11:12:38 +00:00
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
Niko Matsakis
75543c08c7 simplify HR subtyping back to what we did before
A lot of the refactors, however, seem helpful, so leave those in,
particularly since we may want to make this change in the future.
2016-05-31 19:42:22 -04:00
Jeffrey Seyfried
4259fba7e6 Fix macro call site spans 2016-05-28 05:22:16 +00:00
bors
8b012ed142 Auto merge of #33706 - jseyfried:refactor_cfg, r=nrc
Perform `cfg` attribute processing during macro expansion and fix bugs

This PR refactors `cfg` attribute processing and fixes bugs. More specifically:
 - It merges gated feature checking for stmt/expr attributes, `cfg_attr` processing, and `cfg` processing into a single fold.
  - This allows feature gated `cfg` variables to be used in `cfg_attr` on unconfigured items. All other feature gated attributes can already be used on unconfigured items.
 - It performs `cfg` attribute processing during macro expansion instead of after expansion so that macro-expanded items are configured the same as ordinary items. In particular, to match their non-expanded counterparts,
  - macro-expanded unconfigured macro invocations are no longer expanded,
  - macro-expanded unconfigured macro definitions are no longer usable, and
  - feature gated `cfg` variables on macro-expanded macro definitions/invocations are now errors.

This is a [breaking-change]. For example, the following would break:
```rust
macro_rules! m {
    () => {
        #[cfg(attr)]
        macro_rules! foo { () => {} }
        foo!(); // This will be an error

        macro_rules! bar { () => { fn f() {} } }
        #[cfg(attr)] bar!(); // This will no longer be expanded ...
        fn g() { f(); } // ... so that `f` will be unresolved.

        #[cfg(target_thread_local)] // This will be a gated feature error
        macro_rules! baz { () => {} }
    }
}

m!();
```

r? @nrc
2016-05-27 17:46:14 -07:00
Manish Goregaokar
7905452f08 Rollup merge of #33644 - petrochenkov:selfast, r=nrc
The AST part of https://github.com/rust-lang/rust/pull/33505.
https://github.com/rust-lang/rust/pull/33505 isn't landed yet, so this PR is based on top of it.

r? @nrc

plugin-[breaking-change] cc #31645 @Manishearth
2016-05-27 09:57:11 +05:30
Manish Goregaokar
35785712cd Rollup merge of #33639 - petrochenkov:dotdot, r=nmatsakis
cc https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis

plugin-[breaking-change] cc https://github.com/rust-lang/rust/issues/31645 @Manishearth
2016-05-27 09:57:00 +05:30
Manish Goregaokar
a70880fea9 Rollup merge of #33351 - birkenfeld:loop-label-spans, r=pnkfelix
This makes the \"shadowing labels\" warning *not* print the entire loop as a span, but only the lifetime.

Also makes #31719 go away, but does not fix its root cause (the span of the expanded loop is still wonky, but not used anymore).
2016-05-27 09:56:47 +05:30
Jeffrey Seyfried
0558df24af Refactor expand_expr 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
1aa34e0b5f Strip unconfigured items during macro expansion 2016-05-27 00:01:04 +00:00
Jeffrey Seyfried
25c733360b Update spans' expn_id during the marking fold 2016-05-27 00:01:04 +00:00
Leo Testard
864b3c8017 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.
2016-05-26 19:05:44 +02:00
bors
dc91467db0 Auto merge of #33766 - jseyfried:cleanup_expansion, r=nrc
Cleanup macro expansion and improve diagnostics

Cleanup macro expansion and improve diagnostics. Fixes #33709.
r? @nrc
2016-05-26 08:32:21 -07:00
Vadim Petrochenkov
d69aeaf662 Implement .. in tuple (struct) patterns 2016-05-26 11:11:58 +03:00
Vadim Petrochenkov
1a1de5bf89 Add a new AST-only type variant ImplicitSelf 2016-05-25 21:55:04 +03:00
Vadim Petrochenkov
5660a00486 Remove ExplicitSelf from AST 2016-05-25 21:55:04 +03:00
bors
da66f2fd8c Auto merge of #33713 - LeoTestard:macro-rules-invalid-lhs, r=pnkfelix
Make sure that macros that didn't pass LHS checking are not expanded.

This avoid duplicate errors for things like invalid fragment specifiers, or
parsing errors for ambiguous macros.
2016-05-25 09:40:06 -07:00
Georg Brandl
2e812e10f4 syntax/hir: give loop labels a span
This makes the "shadowing labels" warning *not* print the entire loop
as a span, but only the lifetime.

Also makes #31719 go away, but does not fix its root cause (the span
of the expanded loop is still wonky, but not used anymore).
2016-05-24 14:22:14 +02:00
Jeffrey Seyfried
e9c0283369 Add comments and fix a nit 2016-05-24 11:48:00 +00:00
Leo Testard
7d521445fd Avoid iterating two times over the list of LHSes. 2016-05-24 11:21:37 +02:00
Leo Testard
eb364e9c29 Make sure that macros that didn't pass LHS checking are not expanded.
This avoids duplicate errors for things like invalid fragment specifiers, or
parsing errors for ambiguous macros. Fixes #29231.
2016-05-24 11:21:28 +02:00
Jeffrey Seyfried
ba8b9324d6 Move placement_in_syntax gated feature checking from expansion to the post-expansion visitor 2016-05-21 23:02:34 +00:00
Jeffrey Seyfried
82b49cd200 Refactor away check_attributes 2016-05-21 23:01:02 +00:00
Jeffrey Seyfried
a3d705ef30 Refactor away expand_item_mac 2016-05-21 23:01:02 +00:00
Jeffrey Seyfried
3192adbf87 Refactor out mac_result in expand_mac_invoc 2016-05-21 23:01:02 +00:00
Jeffrey Seyfried
215c1460f6 Check attributes in expand_mac_invoc 2016-05-21 23:01:02 +00:00
Jeffrey Seyfried
f4075e9467 Use expand_mac_invoc in expand_pat 2016-05-21 23:01:01 +00:00
Jeffrey Seyfried
8ee93b73d1 Re-fold expanded items in expand_mac_invoc 2016-05-21 23:01:01 +00:00
Jeffrey Seyfried
2e7afd7367 Improve diagnostics 2016-05-21 23:01:01 +00:00
Jeffrey Seyfried
7f30eef2ee Introduce MacroGenerable trait 2016-05-21 23:00:57 +00:00
Jeffrey Seyfried
f630419351 Fix bug in macro expression spans 2016-05-18 11:46:08 +00:00
Alex Crichton
0ec321f7b5 rustc: Implement custom panic runtimes
This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.

[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md

Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.

With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.

Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).
2016-05-09 08:22:36 -07:00
Niko Matsakis
489a6c95bf replace fileline_{help,note} with {help,note}
The extra filename and line was mainly there to keep the indentation
relative to the main snippet; now that this doesn't include
filename/line-number as a prefix, it is distracted.
2016-05-02 11:49:23 -04:00
Niko Matsakis
1ff1887cc9 thread tighter span for closures around
Track the span corresponding to the `|...|` part of the closure.
2016-05-02 11:47:10 -04:00
bors
b0aefff714 Auto merge of #32846 - jseyfried:allow_unconfigured_gated_expanded_items, r=nrc
Avoid gated feature checking unconfigured expanded items

Avoid gated feature checking unconfigured macro-expanded items (fixes #32840).
Unconfigured items that are not macro-expanded are already not gated feature checked.
r? @nrc
2016-04-30 02:07:33 -07:00
bors
435095f32a Auto merge of #32791 - LeoTestard:feature-gate-clean, r=nikomatsakis
Feature gate clean

This PR does a bit of cleaning in the feature-gate-handling code of libsyntax. It also fixes two bugs (#32782 and #32648). Changes include:

* Change the way the existing features are declared in `feature_gate.rs`. The array of features and the `Features` struct are now defined together by a single macro. `featureck.py` has been updated accordingly. Note: there are now three different arrays for active, removed and accepted features instead of a single one with a `Status` item to tell wether a feature is active, removed, or accepted. This is mainly due to the way I implemented my macro in the first time and I can switch back to a single array if needed. But an advantage of the way it is now is that when an active feature is used, the parser only searches through the list of active features. It goes through the other arrays only if the feature is not found. I like to think that error checking (in this case, checking that an used feature is active) does not slow down compilation of valid code. :) But this is not very important...
* Feature-gate checking pass now use the `Features` structure instead of looking through a string vector. This should speed them up a bit. The construction of the `Features` struct should be faster too since it is build directly when parsing features instead of calling `has_feature` dozens of times.
* The MacroVisitor pass has been removed, it was mostly useless since the `#[cfg]-stripping` phase happens before (fixes #32648). The features that must actually be checked before expansion are now checked at the time they are used. This also allows us to check attributes that are generated by macro expansion and not visible to MacroVisitor, but are also removed by macro expansion and thus not visible to PostExpansionVisitor either. This fixes #32782. Note that in order for `#[derive_*]` to be feature-gated but still accepted when generated by `#[derive(Trait)]`, I had to do a little bit of trickery with spans that I'm not totally confident into. Please review that part carefully. (It's in `libsyntax_ext/deriving/mod.rs`.)::

Note: this is a [breaking change], since programs with feature-gated attributes on macro-generated macro invocations were not rejected before. For example:

```rust
macro_rules! bar (
    () => ()
);

macro_rules! foo (
    () => (
        #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps
        bar!();
    );
);
```
foo!();
2016-04-27 18:35:29 -07:00
mitaa
6887202ea3 Make some fatal lexer errors recoverable 2016-04-27 20:48:18 +02:00
Manish Goregaokar
a31658de51
Rollup merge of #33041 - petrochenkov:path, r=nrc,Manishearth
Paths are mostly parsed without taking whitespaces into account, e.g. `std :: vec :: Vec :: new ()` parses successfully, however, there are some special cases involving keywords `super`, `self` and `Self`. For example, `self::` is considered a path start only if there are no spaces between `self` and `::`. These restrictions probably made sense when `self` and friends weren't keywords, but now they are unnecessary.

The first two commits remove this special treatment of whitespaces by removing `token::IdentStyle` entirely and therefore fix https://github.com/rust-lang/rust/issues/14109.
This change also affects naked `self` and `super` (which are not tightly followed by `::`, obviously) they can now be parsed as paths, however they are still not resolved correctly in imports (cc @jseyfried, see `compile-fail/use-keyword.rs`), so https://github.com/rust-lang/rust/issues/29036 is not completely fixed.

The third commit also makes `super`, `self`, `Self` and `static` keywords nominally (before this they acted as keywords for all purposes) and removes most of remaining \"special idents\".

The last commit (before tests) contains some small improvements - some qualified paths with type parameters are parsed correctly, `parse_path` is not used for parsing single identifiers, imports are sanity checked for absence of type parameters - such type parameters can be generated by syntax extensions or by macros when https://github.com/rust-lang/rust/issues/10415 is fixed (~~soon!~~already!).

This patch changes some pretty basic things in `libsyntax`, like `token::Token` and the keyword list, so it's a plugin-[breaking-change].

r? @eddyb
2016-04-25 00:47:44 +05:30
Vadim Petrochenkov
6c44bea644 syntax: Check paths in visibilities for type parameters
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix
syntax: Rename PathParsingMode and its variants to better express their purpose
syntax: Remove obsolete error message about 'self lifetime
syntax: Remove ALLOW_MODULE_PATHS workaround
syntax/resolve: Adjust some error messages
resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
2016-04-24 20:59:44 +03:00
Vadim Petrochenkov
b32d7b5923 syntax: Merge keywords and remaining special idents in one list
Simplify the macro used for generation of keywords
Make `Keyword::ident` private
2016-04-24 20:59:44 +03:00
Vadim Petrochenkov
e2c821d35e syntax: Make static/super/self/Self keywords + special ident cleanup 2016-04-24 20:59:44 +03:00
Vadim Petrochenkov
546c052d22 syntax: Get rid of token::IdentStyle 2016-04-24 20:59:44 +03:00
Niko Matsakis
ecd10f04ce thread tighter span for closures around
Track the span corresponding to the `|...|` part of the closure.
2016-04-24 18:10:57 +05:30
Leo Testard
fa23d10863 Remove some useless code. 2016-04-22 01:40:33 +02:00
Leo Testard
03ab057f97 Remove the MacroVisitor pass.
This pass was supposed to check use of gated features before
`#[cfg]`-stripping but this was not the case since it in fact happens
after. Checks that are actually important and must be done before macro
expansion are now made where the features are actually used. Close #32648.
Also ensure that attributes on macro-generated macro invocations are
checked as well. Close #32782 and #32655.
2016-04-22 01:40:33 +02:00
Leo Testard
ef1de519ff Generate the features structure and arrays with new macros.
This is more readable, safer, and allows for a much more efficient parsing.
2016-04-21 14:00:14 +02:00
Manish Goregaokar
90c8d81ee4
Rollup merge of #32945 - durka:rfc1494, r=pnkfelix
implement RFC amendment 1494

Adds `:block` to the follow set for `:ty` and `:path`. See rust-lang/rfcs#1494.
2016-04-16 01:18:07 +05:30
Alex Burka
01aebf01bc implement RFC amendment 1494 2016-04-13 23:25:42 -04:00
Jeffrey Seyfried
5a8bbf1202 Fixes #32922, a macro hygiene bug 2016-04-13 00:24:21 +00:00
Jeffrey Seyfried
86f069d41a Remove redundant call to expand_item_multi_modifier 2016-04-09 05:37:56 +00:00
Vadim Petrochenkov
8fe4290f1c Move span into StructField 2016-04-06 11:19:10 +03:00
Vadim Petrochenkov
7f3744f07f Get rid of ast::StructFieldKind 2016-04-06 10:33:15 +03:00
Niko Matsakis
05baf645e4 do not overwrite spans as eagerly
this was required to preserve the span from
the #[structural_match] attribute -- but honestly
I am not 100% sure if it makes sense.
2016-03-25 06:44:14 -04:00
Jorge Aparicio
0f02309e4b try! -> ?
Automated conversion using the untry tool [1] and the following command:

```
$ find -name '*.rs' -type f | xargs untry
```

at the root of the Rust repo.

[1]: https://github.com/japaric/untry
2016-03-22 22:01:37 -05:00
Richo Healey
178b28099f syntax: impl ToTokens for P<ast::ImplItem> 2016-03-15 19:50:11 +01:00
Aaron Turon
8fe63e2342 Add default as contextual keyword, and parse it for impl items. 2016-03-14 15:04:33 -07:00
bors
cbbd3d9b92 Auto merge of #31631 - jonas-schievink:agoraphobia, r=nrc
[breaking-batch] Move more uses of `panictry!` out of libsyntax
2016-03-09 05:25:48 -08:00
Jeffrey Seyfried
472fcb5973 Fix the search paths for macro-expanded non-inline modules 2016-03-02 23:50:19 +00:00
Corey Farwell
5850d16d52 Remove unnecessary explicit lifetime bounds.
These explicit lifetimes can be ommitted because of lifetime elision
rules. Instances were found using rust-clippy.
2016-02-18 08:37:10 -05:00
ggomez
eca0ab25d8 Add check on find_best_match_for_name and improve help message for undefined macro 2016-02-16 22:30:08 +01:00
Jonas Schievink
3a872782d3 Move more uses of panictry! out of libsyntax
[breaking-change] for syntax extensions
2016-02-16 13:32:40 +01:00
Vadim Petrochenkov
9f414a44a7 Split ast::PatKind::Enum into tuple struct and path patterns 2016-02-13 15:51:27 +03:00
Vadim Petrochenkov
14adc9bb63 Rename ast::Pat_ and its variants 2016-02-13 13:49:24 +03:00
Jonas Schievink
c877d61b15 Use more autoderef in libsyntax 2016-02-12 19:28:42 +01:00
Vadim Petrochenkov
77cc5764b9 Remove some unnecessary indirection from AST structures 2016-02-11 23:33:09 +03:00
Oliver 'ker' Schneider
2b816b0d6a [breaking-change] don't glob export ast::PathListItem_ variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
8b3856b1bc [breaking-change] don't glob export ast::StrStyle variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
d844bfb196 [breaking-change] don't glob export ast::Visibility variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
dfe35da6b8 [breaking-change] don't glob export ast::TraitItemKind variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
73fa9b2da2 [breaking-change] don't glob export ast::Mutablity variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
14e09ad468 [breaking-change] don't glob export ast::MetaItem_ 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
e797e1961d [breaking-change] don't glob export ast::MacStmtStyle 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
798974cae5 [breaking-change] don't glob export ast::KleeneOp variants 2016-02-11 12:34:48 +01:00
Oliver 'ker' Schneider
019614f03d [breaking-change] don't glob export ast::Item_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
8290c950a8 [breaking-change] don't pub export ast::Stmt_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
498a2e416e [breaking-change] don't pub export ast::IntLitType variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
69072c4f5d [breaking-change] don't pub export ast::Lit_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
05d4cefd63 [breaking-change] don't pub export ast::Ty_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
bfa66bb389 [breaking-change] remove the sign from integer literals in the ast 2016-02-11 12:34:48 +01:00
Oliver Schneider
625e78b700 [breaking-change] don't glob export ast::{UintTy, IntTy} variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
80bf9ae18a [breaking-change] don't glob export ast::Expr_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
79fa657abc [breaking-change] don't glob export ast::Decl_ variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
8516ba367d [breaking-change] don't glob export ast::CaptureClause variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
243a30c931 [breaking-change] don't glob import/export syntax::abi enum variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
47b0784ba8 [breaking-change] don't glob export ast::BlockCheckMode variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
3b57d40fe5 [breaking-change] don't glob import ast::FunctionRetTy variants 2016-02-11 12:34:48 +01:00
Oliver Schneider
05e25de4f0 [breaking-change] don't glob export ast::BinOp_ 2016-02-11 12:34:48 +01:00
Oliver Schneider
f875f4c4c2 [breaking-change] don't glob export ast::UnOp variants 2016-02-11 12:34:48 +01:00
Alex Burka
fd4d013a2c trpl: fix macro follow sets 2016-01-27 13:26:47 -05:00
Manish Goregaokar
b46bd2fb29 Rollup merge of #31152 - durka:ty-follow-bracket, r=pnkfelix
cc #31135 rust-lang/rfcs#1462 #30923 @retep998
r? @pnkfelix
2016-01-26 13:11:57 +05:30
Alex Burka
e1e0de86ec add [ to FOLLOW(ty) and FOLLOW(path)
Following RFC 1462 (amending 550). Closes #31135.
2016-01-23 16:37:14 -05:00
Nick Cameron
0ac8915875 The war on abort_if_errors 2016-01-22 08:19:27 +13:00
Felix S. Klock II
3703ef5820 extending FOLLOW(NT) as specified in amendment.
See RFC amendment 1384:

  https://github.com/rust-lang/rfcs/pull/1384
2016-01-07 20:53:33 +01:00
Felix S. Klock II
076e64475a macro_rules: proper FIRST/FOLLOW computations for checking macro_rules validity.
See RFC amendment 1384 and tracking issue 30450:
  https://github.com/rust-lang/rfcs/pull/1384
  https://github.com/rust-lang/rust/issues/30450

Moved old check_matcher code into check_matcher_old

combined the two checks to enable a warning cycle (where we will
continue to error if the two checks agree to reject, accept if the new
check says accept, and warn if the old check accepts but the new check
rejects).
2016-01-07 20:53:33 +01:00
bors
5daa75373d Auto merge of #30654 - nrc:panictry, r=brson
The motivation (other than removing boilerplate) is that this is a baby step towards a parser with error recovery.

[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2016-01-06 20:30:55 +00:00
Guillaume Gomez
6e68cdfcc2 Add test for "malformed macro lhs" and change back span_bug to span_fatal 2016-01-04 01:13:57 +01:00
Nick Cameron
9023c659af Cut out a bunch of Result and panictry! boilerplate from libsyntax.
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-31 14:29:02 +13:00
bors
85fb3b6fc0 Auto merge of #30526 - Ms2ger:PathParameters, r=brson 2015-12-30 14:19:08 +00:00
Nick Cameron
95dc7efad0 use structured errors 2015-12-30 14:27:59 +13:00
bors
4ce1dafd1d Auto merge of #30377 - Wafflespeanut:levenshtein, r=Manishearth
fixes part of #30197
2015-12-23 08:55:38 +00:00
Ms2ger
2359ab0dc9 Stop re-exporting PathParameters's variants. 2015-12-22 17:12:33 +01:00
bors
709d00a231 Auto merge of #30460 - Ms2ger:BindingMode, r=alexcrichton 2015-12-21 19:10:51 +00:00
Ms2ger
143b9d80d0 Stop re-exporting the ast::BindingMode variants. 2015-12-20 22:15:26 +01:00
Manish Goregaokar
9e953df6f0 Rollup merge of #30420 - petrochenkov:owned2, r=nrc
Part of https://github.com/rust-lang/rust/pull/30095 not causing mysterious segfaults.

r? @nrc
2015-12-18 20:02:12 +05:30
Manish Goregaokar
c2902965cb Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakis
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-18 16:47:37 +05:30
Vadim Petrochenkov
0d298f9904 Deprecate name OwnedSlice and don't use it 2015-12-18 00:52:56 +03:00
Jeffrey Seyfried
8364a6feef Remove unused imports 2015-12-17 05:43:27 +00:00
Nick Cameron
6309b0f5bb move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*
Also split out emitters into their own module.
2015-12-17 09:35:50 +13:00
Manish Goregaokar
b0b9a556df Rollup merge of #30388 - DanielJCampbell:macro-ident-spans, r=nrc
r? @nrc
2015-12-16 17:46:29 +05:30
Ravi Shankar
51ff171948 Modify the Levenshtein-based suggestions to include imports 2015-12-16 16:33:24 +05:30
Seo Sanghyeon
bb21b6738a Fix expansion tests 2015-12-15 15:04:47 +09:00
Seo Sanghyeon
f9ba107824 Move built-in syntax extensions to a separate crate 2015-12-15 15:04:46 +09:00
Daniel Campbell
2dcd791d46 Generated code spans now point to callsite parameters (where applicable) 2015-12-15 17:41:03 +13:00
faineance
ec8ea22c7f [breaking-change] move ast_util functions to methods 2015-12-14 21:15:01 +00:00
bors
50a02b43ba Auto merge of #29735 - Amanieu:asm_indirect_constraint, r=pnkfelix
This PR reverts #29543 and instead implements proper support for "=*m" and "+*m" indirect output operands. This provides a framework on top of which support for plain memory operands ("m", "=m" and "+m") can be implemented.

This also fixes the liveness analysis pass not handling read/write operands correctly.
2015-12-14 13:48:41 +00:00
Tamir Duberstein
b964b1d043 remove deprecated APIs missed in #30182 2015-12-13 01:02:12 -05:00
Alex Crichton
464cdff102 std: Stabilize APIs for the 1.6 release
This commit is the standard API stabilization commit for the 1.6 release cycle.
The list of issues and APIs below have all been through their cycle-long FCP and
the libs team decisions are listed below

Stabilized APIs

* `Read::read_exact`
* `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`)
* libcore -- this was a bit of a nuanced stabilization, the crate itself is now
  marked as `#[stable]` and the methods appearing via traits for primitives like
  `char` and `str` are now also marked as stable. Note that the extension traits
  themeselves are marked as unstable as they're imported via the prelude. The
  `try!` macro was also moved from the standard library into libcore to have the
  same interface. Otherwise the functions all have copied stability from the
  standard library now.
* The `#![no_std]` attribute
* `fs::DirBuilder`
* `fs::DirBuilder::new`
* `fs::DirBuilder::recursive`
* `fs::DirBuilder::create`
* `os::unix::fs::DirBuilderExt`
* `os::unix::fs::DirBuilderExt::mode`
* `vec::Drain`
* `vec::Vec::drain`
* `string::Drain`
* `string::String::drain`
* `vec_deque::Drain`
* `vec_deque::VecDeque::drain`
* `collections::hash_map::Drain`
* `collections::hash_map::HashMap::drain`
* `collections::hash_set::Drain`
* `collections::hash_set::HashSet::drain`
* `collections::binary_heap::Drain`
* `collections::binary_heap::BinaryHeap::drain`
* `Vec::extend_from_slice` (renamed from `push_all`)
* `Mutex::get_mut`
* `Mutex::into_inner`
* `RwLock::get_mut`
* `RwLock::into_inner`
* `Iterator::min_by_key` (renamed from `min_by`)
* `Iterator::max_by_key` (renamed from `max_by`)

Deprecated APIs

* `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`)
* `OsString::from_bytes`
* `OsStr::to_cstring`
* `OsStr::to_bytes`
* `fs::walk_dir` and `fs::WalkDir`
* `path::Components::peek`
* `slice::bytes::MutableByteVector`
* `slice::bytes::copy_memory`
* `Vec::push_all` (renamed to `extend_from_slice`)
* `Duration::span`
* `IpAddr`
* `SocketAddr::ip`
* `Read::tee`
* `io::Tee`
* `Write::broadcast`
* `io::Broadcast`
* `Iterator::min_by` (renamed to `min_by_key`)
* `Iterator::max_by` (renamed to `max_by_key`)
* `net::lookup_addr`

New APIs (still unstable)

* `<[T]>::sort_by_key` (added to mirror `min_by_key`)

Closes #27585
Closes #27704
Closes #27707
Closes #27710
Closes #27711
Closes #27727
Closes #27740
Closes #27744
Closes #27799
Closes #27801
cc #27801 (doesn't close as `Chars` is still unstable)
Closes #28968
2015-12-05 15:09:44 -08:00