about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
AgeCommit message (Collapse)AuthorLines
2018-08-02Auto merge of #52841 - petrochenkov:premacro, r=alexcrichtonbors-24/+14
resolve: Implement prelude search for macro paths, implement tool attributes When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details. "Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude. This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope. The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order. If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway). Fixes https://github.com/rust-lang/rust/issues/52576 Fixes https://github.com/rust-lang/rust/issues/52512 Fixes https://github.com/rust-lang/rust/issues/51277 cc https://github.com/rust-lang/rust/issues/52269
2018-08-01resolve: Implement prelude search for macro pathsVadim Petrochenkov-24/+14
resolve/expansion: Implement tool attributes
2018-08-01Rollup merge of #52842 - toidiu:ak-commentUpdate, r=estebankPietro Albini-1/+1
update comment r? @joshtriplett Addressing comment: https://github.com/rust-lang/rust/pull/52761#pullrequestreview-141323066
2018-07-30Auto merge of #52722 - alexcrichton:more-identifier-lints, r=oli-obkbors-1/+1
Tweak the raw_identifiers lints in 2018 * Enable the `raw_identifiers` feature automatically in the 2018 preview * Only emit lint warnings if the `raw_identifiers` feature is activated cc rust-lang/cargo#5783
2018-07-29update commenttoidiu-1/+1
2018-07-26feature gate for inferring 'static lifetimestoidiu-0/+9
2018-07-26Tweak the raw_identifiers lints in 2018Alex Crichton-1/+1
* Enable the `raw_identifiers` feature automatically in the 2018 preview * Only emit lint warnings if the `raw_identifiers` feature is activated cc rust-lang/cargo#5783
2018-07-23Rollup merge of #52581 - petrochenkov:bmacrodoc, r=alexcrichtonkennytm-1/+2
Avoid using `#[macro_export]` for documenting builtin macros Use a special `rustc_*` attribute instead. cc https://github.com/rust-lang/rust/pull/52234
2018-07-22Auto merge of #52394 - estebank:println, r=oli-obkbors-0/+4
Improve suggestion for missing fmt str in println Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal. Fix #52347.
2018-07-21Gate `format_args_nll` behind feature flagEsteban Küber-0/+4
2018-07-21Avoid using `#[macro_export]` for documenting builtin macrosVadim Petrochenkov-1/+2
2018-07-20Auto merge of #52445 - alexcrichton:wasm-import-module, r=eddybbors-7/+0
rustc: Stabilize #[wasm_import_module] as #[link(...)] This commit stabilizes the `#[wasm_import_module]` attribute as `#[link(wasm_import_module = "...")]`. Tracked by #52090 this new directive in the `#[link]` attribute is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
2018-07-19Auto merge of #52024 - oli-obk:existential_parse, r=nikomatsakisbors-0/+21
Implement existential types (not for associated types yet) r? @nikomatsakis cc @Centril @varkor @alexreg
2018-07-18rustc: Stabilize #[wasm_import_module] as #[link(...)]Alex Crichton-7/+0
This commit stabilizes the `#[wasm_import_module]` attribute as `#[link(wasm_import_module = "...")]`. Tracked by #52090 this new directive in the `#[link]` attribute is used to configured the module name that the imports are listed with. The WebAssembly specification indicates two utf-8 names are associated with all imported items, one for the module the item comes from and one for the item itself. The item itself is configurable in Rust via its identifier or `#[link_name = "..."]`, but the module name was previously not configurable and defaulted to `"env"`. This commit ensures that this is also configurable. Closes #52090
2018-07-18Rollup merge of #52472 - alexcrichton:macros-edition-2018, r=petrochenkovkennytm-1/+1
rustc: Enable `use_extern_macros` in 2018 edition This was previously enabled via `proc_macro`, but since `proc_macro` is now stable this is no longer the case. Explicitly include it in the 2018 edition here.
2018-07-18Implement existential typesOliver Schneider-0/+21
2018-07-18Auto merge of #52353 - alexcrichton:wasm-custom-section, r=eddybbors-8/+0
rustc: Use link_section, not wasm_custom_section This commit transitions definitions of custom sections on the wasm target from the unstable `#[wasm_custom_section]` attribute to the already-stable-for-other-targets `#[link_section]` attribute. Mostly the same restrictions apply as before, except that this now applies only to statics. Closes #51088
2018-07-17rustc: Enable `use_extern_macros` in 2018 editionAlex Crichton-1/+1
This was previously enabled via `proc_macro`, but since `proc_macro` is now stable this is no longer the case. Explicitly include it in the 2018 edition here.
2018-07-16rustc: Use link_section, not wasm_custom_sectionAlex Crichton-8/+0
This commit transitions definitions of custom sections on the wasm target from the unstable `#[wasm_custom_section]` attribute to the already-stable-for-other-targets `#[link_section]` attribute. Mostly the same restrictions apply as before, except that this now applies only to statics. Closes #51088
2018-07-16rustc: Stabilize much of the `proc_macro` featureAlex Crichton-26/+11
This commit stabilizes some of the `proc_macro` language feature as well as a number of APIs in the `proc_macro` crate as [previously discussed][1]. This means that on stable Rust you can now define custom procedural macros which operate as attributes attached to items or `macro_rules!`-like bang-style invocations. This extends the suite of currently stable procedural macros, custom derives, with custom attributes and custom bang macros. Note though that despite the stabilization in this commit procedural macros are still not usable on stable Rust. To stabilize that we'll need to stabilize at least part of the `use_extern_macros` feature. Currently you can define a procedural macro attribute but you can't import it to call it! A summary of the changes made in this PR (as well as the various consequences) is: * The `proc_macro` language and library features are now stable. * Other APIs not stabilized in the `proc_macro` crate are now named under a different feature, such as `proc_macro_diagnostic` or `proc_macro_span`. * A few checks in resolution for `proc_macro` being enabled have switched over to `use_extern_macros` being enabled. This means that code using `#![feature(proc_macro)]` today will likely need to move to `#![feature(use_extern_macros)]`. It's intended that this PR, once landed, will be followed up with an attempt to stabilize a small slice of `use_extern_macros` just for procedural macros to make this feature 100% usable on stable. [1]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
2018-07-14Remove most of `PartialEq` impls from AST and HIR structuresVadim Petrochenkov-6/+8
2018-07-13Add the `amdgpu-kernel` ABI.Richard Diamond-0/+6
Technically, there are requirements imposed by the LLVM `AMDGPUTargetMachine` on functions with this ABI (eg, the return type must be void), but I'm unsure exactly where this should be enforced.
2018-07-09Implement #[alloc_error_handler]Simon Sapin-0/+8
This to-be-stable attribute is equivalent to `#[lang = "oom"]`. It is required when using the alloc crate without the std crate. It is called by `handle_alloc_error`, which is in turned called by "infallible" allocations APIs such as `Vec::push`.
2018-07-06Auto merge of #52018 - flip1995:rfc2103, r=oli-obkbors-0/+2
Implementation of tool lints. Tracking issue: #44690
2018-07-05rustc: Update tracking issue for wasm_import_moduleAlex Crichton-1/+1
It's now https://github.com/rust-lang/rust/issues/52090
2018-07-04Implementation of tool lintsflip1995-0/+2
2018-06-30Auto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertjbors-1/+1
Lowering cleanups [1/N]
2018-06-28Rollup merge of #51799 - mark-i-m:lower_case_feature_gate, r=mark-i-mkennytm-4/+4
Lower case some feature gate error messages
2018-06-27Generate `DefId`s for the impl trait of `async` functionsOliver Schneider-1/+1
2018-06-26lower case some feature gate messagesmark-4/+4
2018-06-26inclusive range syntax lint (`...` → `..=`)Zack M. Davis-1/+2
Our implementation ends up changing the `PatKind::Range` variant in the AST to take a `Spanned<RangeEnd>` instead of just a `RangeEnd`, because the alternative would be to try to infer the span of the range operator from the spans of the start and end subexpressions, which is both hideous and nontrivial to get right (whereas getting the change to the AST right was a simple game of type tennis). This is concerning #51043.
2018-06-26Auto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakisbors-0/+3
Implementation of RFC 2086 - Allow Irrefutable Let patterns This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)
2018-06-21async await desugaring and testsTaylor Cramer-3/+9
2018-06-21Parse async fn header.Without Boats-18/+23
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-20Remove methods from ast::GenericParam and ast::Genericsvarkor-2/+2
2018-06-17Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, ↵bors-1/+1
r=petrochenkov refactor: create multiple HIR items for imports When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to. The current version of this PR does the following: * Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available. * When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution. * To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available. Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-14create multiple HIR items for a use statementQuietMisdreavus-1/+1
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-8/+2
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-11Stabilize the #[global_allocator] attributeSimon Sapin-7/+3
Fixes https://github.com/rust-lang/rust/issues/27389
2018-06-08Rollup merge of #51298 - Dylan-DPC:stabilise/termination-test, r=nikomatsakisMark Rousskov-3/+2
Stabilize unit tests with non-`()` return type References #48854
2018-06-08rename `irrefutable_let_pattern` to `irrefutable_let_patterns`Niko Matsakis-1/+1
2018-06-08Rollup merge of #51283 - ↵kennytm-1/+1
kennytm:fix-51279-preempt-the-warning-song-and-dance, r=nikomatsakis Deny #[cfg] and #[cfg_attr] on generic parameters. Fix #51279. Attributes on generic parameters are not expanded, meaning `#[cfg]`, `#[cfg_attr]` and attribute proc macros are entirely ignored on them. This PR makes using the first two attributes an error, because if they are correctly expanded will affect the AST and change code behavior. I'm beta-nominating this, because generic parameter attributes are stabilizing in 1.27, and if we did not reserve their usage, we may never be able to repurpose the meaning of these attributes in the Rust 2015 edition.
2018-06-05flag changed to nonedylan_DPC-1/+1
2018-06-05Implementation of RFC 2086 - Allow Irrefutable Let patternsSebastian Malton-0/+3
2018-06-04Put doc keyword behind feature flagGuillaume Gomez-0/+8
2018-06-04Merge branch 'master' into stabilise/termination-testDylan DPC-0/+8
2018-06-03implement #[panic_implementation]Jorge Aparicio-0/+9
2018-06-02fixed feature gate to right placedylan_DPC-2/+2
2018-06-02Stabilize unit tests with non-`()` return typedylan_DPC-3/+3
2018-06-02Deny #[cfg] and #[cfg_attr] on generic parameters.kennytm-1/+1