about summary refs log tree commit diff
path: root/src/libsyntax_ext
AgeCommit message (Collapse)AuthorLines
2017-06-21Rollup merge of #42620 - wesleywiser:compile_error, r=brsonCorey Farwell-0/+42
Add compile_error! Related to #40872
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-19Add compile_error!Wesley Wiser-0/+42
Related to #40872
2017-05-25Hygienize lifetimes.Jeffrey Seyfried-12/+11
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-2/+2
2017-05-13Auto merge of #41919 - nrc:save-crate, r=eddybbors-1/+1
Include the crate's root module in save-analysis r? @eddyb
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-6/+0
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges:
2017-05-12Remove some unused macros from the rust codebaseest31-6/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-12Pass crate attributes in visit.rsNick Cameron-1/+1
2017-04-24support `default impl` for specializationGianni Ciccarelli-0/+1
this commit implements the first step of the `default impl` feature: all items in a `default impl` are (implicitly) `default` and hence specializable. In order to test this feature I've copied all the tests provided for the `default` method implementation (in run-pass/specialization and compile-fail/specialization directories) and moved the `default` keyword from the item to the impl. See referenced issue for further info
2017-04-21Implementation of repr struct alignment RFC 1358.Cameron Hart-1/+1
The main changes around rustc::ty::Layout::struct and rustc_trans:adt: * Added primitive_align field which stores alignment before repr align * Always emit field padding when generating the LLVM struct fields * Added methods for adjusting field indexes from the layout index to the LLVM struct field index The main user of this information is rustc_trans::adt::struct_llfields which determines the LLVM fields to be used by LLVM, including padding fields.
2017-04-12Replace ExpnId with SyntaxContextA.J. Gardner-1/+0
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+68
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-11/+4
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-48/+27
2017-03-23Remove internal liblogAlex Crichton-1/+1
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-10/+12
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-10/+12
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-1/+1
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-10Give spans to individual path segments in ASTVadim Petrochenkov-1/+1
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-8/+12
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-1/+1
2017-03-02Rollup merge of #40129 - abonander:proc_macro_bang, r=jseyfriedCorey Farwell-9/+92
Implement function-like procedural macros ( `#[proc_macro]`) Adds the `#[proc_macro]` attribute, which expects bare functions of the kind `fn(TokenStream) -> TokenStream`, which can be invoked like `my_macro!()`. cc rust-lang/rfcs#1913, #38356 r? @jseyfried cc @nrc
2017-02-28Implement function-like procedural macros ( `#[proc_macro]`)Austin Bonander-9/+92
2017-02-28Add `syntax::ext::tt::quoted::{TokenTree, ..}` and remove ↵Jeffrey Seyfried-1/+0
`tokenstream::TokenTree::Sequence`.
2017-02-25rustc_typeck: hook up collect and item/body check to on-demand.Eduard-Mihai Burtescu-1/+1
2017-02-12Allow using inert attributes from `proc_macro_derive`s with ↵Jeffrey Seyfried-5/+3
`#![feature(proc_macro)]`.
2017-02-05Move derive macro expansion into the MacroExpanderJosh Driver-248/+10
This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.
2017-02-05Rename CustomDerive to ProcMacroDerive for macros 1.1Josh Driver-15/+15
2017-02-05Make builtin derives a SyntaxExtensionJosh Driver-21/+25
This allows builtin derives to be registered and resolved, just like other derive types.
2017-01-20Rollup merge of #38842 - abonander:proc_macro_attribute, r=jseyfriedAlex Crichton-71/+210
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-16Implement `#[proc_macro_attribute]`Austin Bonander-69/+195
* 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-17Use resizable Vec instead of P<[T]> in ASTVadim Petrochenkov-6/+5
2017-01-16AST/HIR: Replace Path with Type in WhereEqPredicateVadim Petrochenkov-2/+2
2017-01-15Refactor `proc_macro::TokenStream` to use ↵Austin Bonander-2/+15
`syntax::tokenstream::TokenStream`; fix tests for changed semantics
2017-01-12Auto merge of #38814 - Ralith:cfg-fields, r=jseyfriedbors-0/+1
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-0/+1
2017-01-10Give custom derive spans an expansion IDNick Cameron-7/+20
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-02rustc: Stabilize the `proc_macro` featureAlex Crichton-17/+2
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
2016-12-31Auto merge of #38482 - est31:i128, r=eddybbors-0/+2
i128 and u128 support Brings i128 and u128 support to nightly rust, behind a feature flag. The goal of this PR is to do the bulk of the work for 128 bit integer support. Smaller but just as tricky features needed for stabilisation like 128 bit enum discriminants are left for future PRs. Rebased version of #37900, which in turn was a rebase + improvement of #35954 . Sadly I couldn't reopen #37900 due to github. There goes my premium position in the homu queue... [plugin-breaking-change] cc #35118 (tracking issue)
2016-12-31Style fixesJosh Driver-2/+1
2016-12-31Stop macro calls in structs for proc_macro_derive from panicingJosh Driver-1/+4
2016-12-30Fix rebase falloutSimonas Kazlauskas-0/+1
This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-1/+2
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
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-23Auto merge of #38533 - jseyfried:legacy_custom_derive_deprecation, r=nrcbors-1/+3
Allow legacy custom derive authors to disable warnings in downstream crates This PR allows legacy custom derive authors to use a pre-deprecated method `registry.register_custom_derive()` instead of `registry.register_syntax_extension()` to avoid downstream deprecation warnings. r? @nrc
2016-12-23Allow legacy custom derive authors to disable warnings in downstream crates.Jeffrey Seyfried-1/+3
2016-12-22Refactor how global paths are represented (for both ast and hir).Jeffrey Seyfried-8/+4