about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
AgeCommit message (Collapse)AuthorLines
2016-11-17Add feature `use_extern_macros`.Jeffrey Seyfried-0/+2
2016-11-16rustc: Implement #[link(cfg(..))] and crt-staticAlex Crichton-0/+3
This commit is an implementation of [RFC 1721] which adds a new target feature to the compiler, `crt-static`, which can be used to select how the C runtime for a target is linked. Most targets dynamically linke the C runtime by default with the notable exception of some of the musl targets. [RFC 1721]: https://github.com/rust-lang/rfcs/blob/master/text/1721-crt-static.md This commit first adds the new target-feature, `crt-static`. If enabled, then the `cfg(target_feature = "crt-static")` will be available. Targets like musl will have this enabled by default. This feature can be controlled through the standard target-feature interface, `-C target-feature=+crt-static` or `-C target-feature=-crt-static`. Next this adds an gated and unstable `#[link(cfg(..))]` feature to enable the `crt-static` semantics we want with libc. The exact behavior of this attribute is a little squishy, but it's intended to be a forever-unstable implementation detail of the liblibc crate. Specifically the `#[link(cfg(..))]` annotation means that the `#[link]` directive is only active in a compilation unit if that `cfg` value is satisfied. For example when compiling an rlib, these directives are just encoded and ignored for dylibs, and all staticlibs are continued to be put into the rlib as usual. When placing that rlib into a staticlib, executable, or dylib, however, the `cfg` is evaluated *as if it were defined in the final artifact* and the library is decided to be linked or not. Essentially, what'll happen is: * On MSVC with `-C target-feature=-crt-static`, the `msvcrt.lib` library will be linked to. * On MSVC with `-C target-feature=+crt-static`, the `libcmt.lib` library will be linked to. * On musl with `-C target-feature=-crt-static`, the object files in liblibc.rlib are removed and `-lc` is passed instead. * On musl with `-C target-feature=+crt-static`, the object files in liblibc.rlib are used and `-lc` is not passed. This commit does **not** include an update to the liblibc module to implement these changes. I plan to do that just after the 1.14.0 beta release is cut to ensure we get ample time to test this feature. cc #37406
2016-11-10Rollup merge of #37661 - brson:qmarkstab, r=nikomatsakisEduard-Mihai Burtescu-1/+1
question_mark was stabilized in 1.13
2016-11-10syntax: don't fake a block around closures' bodies during parsing.Eduard Burtescu-5/+4
2016-11-09Rollup merge of #37614 - keeperofdakeys:proc_macro, r=jseyfriedEduard-Mihai Burtescu-4/+6
macros 1.1: Allow proc_macro functions to declare attributes to be mark as used This PR allows proc macro functions to declare attribute names that should be marked as used when attached to the deriving item. There are a few questions for this PR. - Currently this uses a separate attribute named `#[proc_macro_attributes(..)]`, is this the best choice? - In order to make this work, the `check_attribute` function had to be modified to not error on attributes marked as used. This is a pretty large change in semantics, is there a better way to do this? - I've got a few clones where I don't know if I need them (like turning `item` into a `TokenStream`), can these be avoided? - Is switching to `MultiItemDecorator` the right thing here? Also fixes https://github.com/rust-lang/rust/issues/37563.
2016-11-09question_mark was stabilized in 1.13Brian Anderson-1/+1
2016-11-08Partially stabilize RFC 1506 "Clarify relationships between ADTs"Vadim Petrochenkov-18/+17
2016-11-08Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakisbors-15/+2
Stabilize `..` in tuple (struct) patterns I'd like to nominate `..` in tuple and tuple struct patterns for stabilization. This feature is a relatively small extension to existing stable functionality and doesn't have known blockers. The feature first appeared in Rust 1.10 6 months ago. An example of use: https://github.com/rust-lang/rust/pull/36203 Closes https://github.com/rust-lang/rust/issues/33627 r? @nikomatsakis
2016-11-08Rename KNOWN_ATTRS to BUILT_ATTRS, and create KNOWN_ATTRSJosh Driver-4/+6
KNOWN_ATTRIBUTES should really be named BUILT_ATTRIBUTES, while KNOWN_ATTRIBUTES should be used to mark attributes as known, similar to USED_ATTRIBUTES.
2016-11-05Fix tests from the rollupAlex Crichton-1/+1
2016-11-05Merge branch 'selfgate' of https://github.com/petrochenkov/rust into rollupAlex Crichton-0/+3
2016-11-03Add feature gate for Self and associated types in struct expressions and ↵Vadim Petrochenkov-0/+3
patterns
2016-11-03Stabilize `..` in tuple (struct) patternsVadim Petrochenkov-15/+2
2016-10-31rustc: Add knowledge of Windows subsystems.Alex Crichton-0/+9
This commit is an implementation of [RFC 1665] which adds support for the `#![windows_subsystem]` attribute. This attribute allows specifying either the "windows" or "console" subsystems on Windows to the linker. [RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md Previously all Rust executables were compiled as the "console" subsystem which meant that if you wanted a graphical application it would erroneously pop up a console whenever opened. When compiling an application, however, this is undesired behavior and the "windows" subsystem is used instead to have control over user interactions. This attribute is validated, but ignored on all non-Windows platforms. cc #37499
2016-10-27Auto merge of #37128 - nrc:depr-attr, r=@alexcrichtonbors-48/+116
Deprecate no_debug and custom_derive r? @nikomatsakis
2016-10-26Auto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrcbors-0/+11
Implement field shorthands in struct literal expressions. Implements #37340 in a straight-forward way: `Foo { x, y: f() }` parses as `Foo { x: x, y: f() }`. Because of the added `is_shorthand` to `ast::Field`, this is `[syntax-breaking]` (cc @Manishearth). * [x] Mark the fields as being a shorthand (the exact same way we do it in patterns), for pretty-printing. * [x] Gate the shorthand syntax with `#![feature(field_init_shorthand)]`. * [x] Don't parse numeric field as identifiers. * [x] Arbitrary field order tests.
2016-10-27review changesNick Cameron-8/+23
2016-10-27Implement field shorthands in struct literal expressions.Eduard Burtescu-0/+11
2016-10-27Deprecate custom_deriveNick Cameron-1/+6
Has a custom deprecation since deprecating features is not supported and is a pain to implement
2016-10-27deprecate no_debugNick Cameron-1/+1
2016-10-27Add possibility of deprecating attributesNick Cameron-44/+92
2016-10-26Fix typo, it bothered meJohn Hodge-1/+1
2016-10-19Rollup merge of #37265 - brson:bootstrap, r=alexcrichtonEduard-Mihai Burtescu-9/+6
Allow bootstrapping without a key. Fixes #36548 This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable. r? @alexcrichton
2016-10-19Rollup merge of #37117 - pnkfelix:may-dangle-attr, r=nikomatsakisEduard-Mihai Burtescu-0/+8
`#[may_dangle]` attribute `#[may_dangle]` attribute Second step of #34761. Last big hurdle before we can work in earnest towards Allocator integration (#32838) Note: I am not clear if this is *also* a syntax-breaking change that needs to be part of a breaking-batch.
2016-10-19Allow bootstrapping without a key. Fixes #36548Brian Anderson-9/+6
This will make it easier for packagers to bootstrap rustc when they happen to have a bootstrap compiler with a slightly different version number. It's not ok for anything other than the build system to set this environment variable.
2016-10-18Add invalid doc comment help messageGuillaume Gomez-2/+7
2016-10-12Stabilise `?`Nick Cameron-6/+2
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-11Add feature gate for `dropck_eyepatch` feature (RFC 1327).Felix S. Klock II-0/+8
2016-10-06rustc: Rename rustc_macro to proc_macroAlex Crichton-6/+6
This commit blanket renames the `rustc_macro` infrastructure to `proc_macro`, which reflects the general consensus of #35900. A follow up PR to Cargo will be required to purge the `rustc-macro` name as well.
2016-10-01Rollup merge of #34764 - pnkfelix:attrs-on-generic-formals, r=eddybManish Goregaokar-0/+21
First step for #34761
2016-09-28libsyntax: clearer names for some AST partsJonas Schievink-2/+2
This applies the HIR changes from the previous commits to the AST, and is thus a syntax-[breaking-change] Renames `PatKind::Vec` to `PatKind::Slice`, since these are called slice patterns, not vec patterns. Renames `TyKind::Vec`, which represents the type `[T]`, to `TyKind::Slice`. Renames `TyKind::FixedLengthVec` to `TyKind::Array`.
2016-09-26emit feature help in cheat modeTim Neumann-6/+5
2016-09-26make is_nightly_build a method on UnstableFeaturesTim Neumann-0/+7
2016-09-26add unstable_features to ParseSessTim Neumann-0/+18
2016-09-26make emit_feature_err take a ParseSessTim Neumann-11/+13
2016-09-23ICH: Add ability to test the ICH of exported metadata items.Michael Woerister-0/+10
2016-09-23Add attribute support to generic lifetime and type parameters.Felix S. Klock II-0/+21
I am using `ThinAttributes` rather than a vector for attributes attached to generics, since I expect almost all lifetime and types parameters to not carry any attributes.
2016-09-12crate-ify compiler-rt into compiler-builtinsJorge Aparicio-0/+10
libcompiler-rt.a is dead, long live libcompiler-builtins.rlib This commit moves the logic that used to build libcompiler-rt.a into a compiler-builtins crate on top of the core crate and below the std crate. This new crate still compiles the compiler-rt instrinsics using gcc-rs but produces an .rlib instead of a static library. Also, with this commit rustc no longer passes -lcompiler-rt to the linker. This effectively makes the "no-compiler-rt" field of target specifications a no-op. Users of `no_std` will have to explicitly add the compiler-builtins crate to their crate dependency graph *if* they need the compiler-rt intrinsics. Users of the `std` have to do nothing extra as the std crate depends on compiler-builtins. Finally, this a step towards lazy compilation of std with Cargo as the compiler-rt intrinsics can now be built by Cargo instead of having to be supplied by the user by some other method. closes #34400
2016-09-07add static_in_const feature gateAndre Bogus-0/+3
also updates tests and deletes the spurious .bk files I inadvertently added last time.
2016-09-05Rollup merge of #36245 - alexcrichton:add-back-accident, r=arielb1Manish Goregaokar-0/+1
Add back feature accidentally removed This feature was accidentally removed in https://github.com/rust-lang/rust/pull/35957.
2016-09-03Add back feature accidentally removedAlex Crichton-0/+1
This feature was accidentally removed in https://github.com/rust-lang/rust/pull/35957.
2016-09-03Translate union constantsVadim Petrochenkov-1/+1
Fix alignment for packed unions Add some missing privacy test Get rid of `unimplemented_unions` macro
2016-09-03Lower unions from AST to HIR and from HIR to typesVadim Petrochenkov-0/+9
Parse union items and add a feature for them
2016-09-02rustc: Implement custom derive (macros 1.1)Alex Crichton-6/+18
This commit is an implementation of [RFC 1681] which adds support to the compiler for first-class user-define custom `#[derive]` modes with a far more stable API than plugins have today. [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md The main features added by this commit are: * A new `rustc-macro` crate-type. This crate type represents one which will provide custom `derive` implementations and perhaps eventually flower into the implementation of macros 2.0 as well. * A new `rustc_macro` crate in the standard distribution. This crate will provide the runtime interface between macro crates and the compiler. The API here is particularly conservative right now but has quite a bit of room to expand into any manner of APIs required by macro authors. * The ability to load new derive modes through the `#[macro_use]` annotations on other crates. All support added here is gated behind the `rustc_macro` feature gate, both for the library support (the `rustc_macro` crate) as well as the language features. There are a few minor differences from the implementation outlined in the RFC, such as the `rustc_macro` crate being available as a dylib and all symbols are `dlsym`'d directly instead of having a shim compiled. These should only affect the implementation, however, not the public interface. This commit also ended up touching a lot of code related to `#[derive]`, making a few notable changes: * Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't sure how to keep this behavior and *not* expose it to custom derive. * Derive attributes no longer have access to unstable features by default, they have to opt in on a granular level. * The `derive(Copy,Clone)` optimization is now done through another "obscure attribute" which is just intended to ferry along in the compiler that such an optimization is possible. The `derive(PartialEq,Eq)` optimization was also updated to do something similar. --- One part of this PR which needs to be improved before stabilizing are the errors and exact interfaces here. The error messages are relatively poor quality and there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]` not working by default. The custom attributes added by the compiler end up becoming unstable again when going through a custom impl. Hopefully though this is enough to start allowing experimentation on crates.io! syntax-[breaking-change]
2016-09-01Add `item_like_imports` feature.Jeffrey Seyfried-1/+4
2016-08-31Add a tracking issue to the feature gate of the sysv64 ABICensoredUsername-1/+1
2016-08-30Feature gate the sysv64 abi as feature(abi_sysv64) and add testsCensoredUsername-7/+16
2016-08-28Rollup merge of #35917 - jseyfried:remove_attr_ext_traits, r=nrcJeffrey Seyfried-1/+1
syntax: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`
2016-08-28Rollup merge of #35850 - SergioBenitez:master, r=nrcJeffrey Seyfried-13/+38
Implement RFC#1559: allow all literals in attributes Implemented rust-lang/rfcs#1559, tracked by #34981.
2016-08-27Change Constness to Spanned<Constness>Keith Yeung-4/+4