about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-01-24Auto merge of #39173 - jseyfried:tokenstream, r=nrcbors-827/+219
Refactor `TokenStream` r? @nrc
2017-01-24Add an option to the parser so cfg'ed out modules can still be parsedNick Cameron-1/+5
2017-01-23Remove `open_span` and `close_span` from `Delimited`.Jeffrey Seyfried-47/+35
2017-01-22Refactor `TokenStream`.Jeffrey Seyfried-781/+185
2017-01-22Auto merge of #39060 - jseyfried:improve_unused, r=nrcbors-4/+0
Improve unused `extern crate` and unused `#[macro_use]` warnings This PR - adds `unused_imports` warnings for unused `#[macro_use] extern crate` macro imports, - improves `unused_extern_crates` warnings (avoids false negatives), and - removes unused `#[macro_use]` imports and unused `extern crate`s. r? @nrc
2017-01-22Remove unused `extern crate`s.Jeffrey Seyfried-4/+0
2017-01-21syntax: remove abi::Os and abi::ArchitectureWang Xuerui-48/+0
They're long dead since the switch to flexible targets, but was not removed like their consumers were. Interesting they even got maintained by various porters out there! Technically [syntax-breaking] as they're public API, but since they're unused in the compiler, the potential breakage IMO should be minimal.
2017-01-20Fix multiple labels when some don't have messageEsteban Küber-0/+388
The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | | | `b` is a good letter | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | `b` is a good letter ``` and from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | `a` is a good letter ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ `a` is a good letter ```
2017-01-20Rollup merge of #39179 - petrochenkov:objparen, r=eddybAlex Crichton-2/+9
Fix regression in parsing of trait object types Fixes https://github.com/rust-lang/rust/issues/39169 Accepting parens in this position is a regression itself, introduced in Rust 1.6 by https://github.com/rust-lang/rust/pull/29870, so I hope to revert this in my next bounds refactoring patch (possibly with a warning, crater run, etc). r? @eddyb
2017-01-20Rollup merge of #39118 - jseyfried:token_tree_based_parser, r=nrcAlex Crichton-428/+339
Refactor the parser to consume token trees This is groundwork for efficiently parsing attribute proc macro invocations, bang macro invocations, and `TokenStream`-based attributes and fragment matchers. This improves parsing performance by 8-15% and expansion performance by 0-5% on a sampling of the compiler's crates. r? @nrc
2017-01-20Rollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfriedAlex Crichton-9/+88
Implement `#[proc_macro_attribute]` This implements `#[proc_macro_attribute]` as described in https://github.com/rust-lang/rfcs/pull/1566 The following major (hopefully non-breaking) changes are included: * Refactor `proc_macro::TokenStream` to use `syntax::tokenstream::TokenStream`. * `proc_macro::tokenstream::TokenStream` no longer emits newlines between items, this can be trivially restored if desired * `proc_macro::TokenStream::from_str` does not try to parse an item anymore, moved to `impl MultiItemModifier for CustomDerive` with more informative error message * Implement `#[proc_macro_attribute]`, which expects functions of the kind `fn(TokenStream, TokenStream) -> TokenStream` * Reactivated `#![feature(proc_macro)]` and gated `#[proc_macro_attribute]` under it * `#![feature(proc_macro)]` and `#![feature(custom_attribute)]` are mutually exclusive * adding `#![feature(proc_macro)]` makes the expansion pass assume that any attributes that are not built-in, or introduced by existing syntax extensions, are proc-macro attributes * Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()` * This change wasn't necessary for this PR, but it helped debugging a problem where I was using the wrong feature string. * Move "completed feature gate checking" pass to after "name resolution" pass * This was necessary for proper feature-gating of `#[proc_macro_attribute]` invocations when the `proc_macro` feature flag isn't set. Prototype/Litmus Test: [Implementation](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/src/lib.rs#L13) -- [Usage](https://github.com/abonander/anterofit/blob/proc_macro/service-attr/examples/post_service.rs#L35)
2017-01-20Auto merge of #38955 - estebank:highlighted-diags, r=nikomatsakisbors-10/+10
Teach Diagnostics to highlight text Support styled `Diagnostic` output: <img width="469" alt="mismatched types error with colorized types in the note" src="https://cloud.githubusercontent.com/assets/1606434/21871227/93a84198-d815-11e6-88b1-0ede3c7e28ef.png"> Closes #37532 and #38901. r? @nikomatsakis CC @jonathandturner @nagisa @nrc
2017-01-19Feature gateVadim Chugunov-0/+3
2017-01-19Auto merge of #38465 - japaric:msp430-interrupt, r=eddybbors-0/+9
calling convention for MSP430 interrupts This calling convention is used to define interrup handlers on MSP430 microcontrollers. Usage looks like this: ``` rust #[no_mangle] #[link_section = "__interrupt_vector_10"] pub static TIM0_VECTOR: unsafe extern "msp430-interrupt" fn() = tim0; unsafe extern "msp430-interrupt" fn tim0() { P1OUT.write(0x00); } ``` which generates the following assembly: ``` asm Disassembly of section __interrupt_vector_10: 0000fff2 <TIM0_VECTOR>: fff2: 10 c0 interrupt service routine at 0xc010 Disassembly of section .text: 0000c010 <_ZN3msp4tim017h3193b957fd6a4fd4E>: c010: c2 43 21 00 mov.b #0, &0x0021 ;r3 As==00 c014: 00 13 reti ... ```
2017-01-19Rollup merge of #38970 - apasel422:may-dangle, r=pnkfelixGuillaume Gomez-3/+3
Deprecate `#[unsafe_destructor_blind_to_params]` CC #34761 r? @pnkfelix
2017-01-19Fix regression in parsing of trait object typesVadim Petrochenkov-2/+9
2017-01-19add exclusive range patterns under a feature gateOliver Schneider-22/+67
2017-01-18calling convention for MSP430 interruptsJorge Aparicio-0/+9
This calling convention is used to define interrup handlers on MSP430 microcontrollers. Usage looks like this: ``` rust #[no_mangle] #[link_section = "__interrupt_vector_10"] pub static TIM0_VECTOR: unsafe extern "msp430-interrupt" fn() = tim0; unsafe extern "msp430-interrupt" fn tim0() { P1OUT.write(0x00); } ``` which generates the following assembly: ``` asm Disassembly of section __interrupt_vector_10: 0000fff2 <TIM0_VECTOR>: fff2: 10 c0 interrupt service routine at 0xc010 Disassembly of section .text: 0000c010 <_ZN3msp4tim017h3193b957fd6a4fd4E>: c010: c2 43 21 00 mov.b #0, &0x0021 ;r3 As==00 c014: 00 13 reti ... ```
2017-01-18Auto merge of #39019 - nikomatsakis:issue-38919, r=eddybbors-1/+1
only consider value items when searching for methods, not types Fixes #38919 r? @eddyb
2017-01-17tolerate `None` return from `get_line`Niko Matsakis-1/+1
2017-01-17Teach Diagnostics to highlight textEsteban Küber-10/+10
2017-01-17Fix fallout in `rustdoc`.Jeffrey Seyfried-3/+3
2017-01-17Remove the lookahead buffer.Jeffrey Seyfried-37/+14
2017-01-17Auto merge of #39110 - petrochenkov:sum, r=eddybbors-134/+172
Merge ObjectSum and PolyTraitRef in AST/HIR + some other refactoring `ObjectSum` and `PolyTraitRef` are the same thing (list of bounds), they exist separately only due to parser quirks. The second commit merges them. The first commit replaces `Path` with `Ty` in (not yet supported) equality predicates. They are parsed as types anyway and arbitrary types can always be disguised as paths using aliases, so this doesn't add any new functionality. The third commit uses `Vec` instead of `P<[T]>` in AST. AST is not immutable like HIR and `Vec`s are more convenient for it, unnecessary conversions are also avoided. The last commit renames `parse_ty_sum` (which is used for parsing types in general) into `parse_ty`, and renames `parse_ty` (which is used restricted contexts where `+` is not permitted due to operator priorities or other reasons) into `parse_ty_no_plus`. This is the first part of https://github.com/rust-lang/rust/issues/39085#issuecomment-272743755 and https://github.com/rust-lang/rust/issues/39080 focused on data changes and mechanical renaming, I'll submit a PR with parser changes a bit later. r? @eddyb
2017-01-17Avoid interpolated token trees.Jeffrey Seyfried-37/+9
2017-01-17Clean up `ext::tt::transcribe`.Jeffrey Seyfried-74/+35
2017-01-17Refactor the parser to consume token trees.Jeffrey Seyfried-197/+52
2017-01-17Introduce `string_reader.parse_all_token_trees()`.Jeffrey Seyfried-22/+187
2017-01-17Give the `StringReader` a `sess: &ParseSess`.Jeffrey Seyfried-74/+58
2017-01-17Rename ObjectSum into TraitObject in AST/HIRVadim Petrochenkov-7/+7
2017-01-16Fix `feature_gate::find_lang_feature_issue()` to not use `unwrap()`Austin Bonander-3/+4
2017-01-16Implement `#[proc_macro_attribute]`Austin Bonander-6/+84
* Add support for `#[proc_macro]` * Reactivate `proc_macro` feature and gate `#[proc_macro_attribute]` under it * Have `#![feature(proc_macro)]` imply `#![feature(use_extern_macros)]`, error on legacy import of proc macros via `#[macro_use]`
2017-01-17Auto merge of #39090 - solson:exprkind-array, r=eddybbors-10/+10
Rename ExprKind::Vec to Array in HIR and HAIR. This is a clearer name since they represent `[a, b, c]` array literals. r? @eddyb
2017-01-17Remove field `tokens_consumed` of `Parser`.Jeffrey Seyfried-3/+0
2017-01-17syntax: Rename parse_ty -> parse_ty_no_plus, parse_ty_sum -> parse_tyVadim Petrochenkov-40/+44
2017-01-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-50/+32
2017-01-17AST/HIR: Merge ObjectSum and PolyTraitRefVadim Petrochenkov-32/+83
2017-01-16AST/HIR: Replace Path with Type in WhereEqPredicateVadim Petrochenkov-14/+15
2017-01-16Rename ExprKind::Vec to Array in HIR and HAIR.Scott Olson-10/+10
This is a clearer name since they represent [a, b, c] array literals.
2017-01-15Mark the pushpop_unsafe feature as "removed"est31-4/+1
This marks the pushpop_unsafe feature as removed inside the feature_gate. It was added in commit 1829fa5199bae5a192c771807c532badce14be37 and then removed again in commit d399098fd82e0bf3ed61bbbbcdbb0b6adfa4c808 . Seems that the second commit forgot to mark it as removed in feature_gate.rs. This enables us to remove another element from the whitelist of non gate tested unstable lang features (issue #39059).
2017-01-15Remove the safe_suggestion featureest31-3/+0
This removes the safe_suggestion feature from feature_gate.rs. It was added in commit 164f0105bb65f31b89e5fb7f368c9e6f5833a3f8 and then removed again in commit c11fe553df269d6f47b4c48f5c47c08efdd373dc . As the removal was in the same PR #38099 as the addition, we don't move it to the "removed" section. Removes an element from the whitelist of non gate tested unstable lang features (issue #39059).
2017-01-12Auto merge of #38814 - Ralith:cfg-fields, r=jseyfriedbors-19/+113
syntax: enable attributes and cfg on struct fields This enables conditional compilation of field initializers in a struct literal, simplifying construction of structs whose fields are themselves conditionally present. For example, the intializer for the constant in the following becomes legal, and has the intuitive effect: ```rust struct Foo { #[cfg(unix)] bar: (), } const FOO: Foo = Foo { #[cfg(unix)] bar: (), }; ``` It's not clear to me whether this calls for the full RFC process, but the implementation was simple enough that I figured I'd begin the conversation with code.
2017-01-11syntax: struct field attributes and cfgBenjamin Saunders-19/+113
2017-01-10Deprecate `#[unsafe_destructor_blind_to_params]`Andrew Paseltiner-3/+3
CC #34761
2017-01-08Auto merge of #38679 - alexcrichton:always-deny-warnings, r=nrcbors-1/+1
Remove not(stage0) from deny(warnings) Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2017-01-06Auto merge of #38792 - jseyfried:improve_macros_11_diagnostics, r=nikomatsakisbors-7/+7
proc macros 1.1: improve diagnostics Fixes #38586. r? @nrc
2017-01-03Fold all spans in the AST.Jeffrey Seyfried-7/+7
2017-01-02rustc: Stabilize the `proc_macro` featureAlex Crichton-10/+3
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-01Auto merge of #38692 - estebank:remove-try-from-pprust, r=petrochenkovbors-857/+857
Use `?` instead of `try!` macro in `print::pprust`
2016-12-30Further and hopefully final Windows fixesSimonas Kazlauskas-1/+10