about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate
AgeCommit message (Collapse)AuthorLines
2019-11-21Gate fallback via `#![feature(never_type_fallback)]`.Mazdak Farrokhzad-0/+3
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-21/+2
2019-11-20Rollup merge of #66060 - traxys:test_65401, r=michaelwoeristerMazdak Farrokhzad-1/+4
Making ICEs and test them in incremental This adds: - A way to make the compiler ICE - A way to check for ICE in `cfail` tests with `should-ice` - A regression test for issue #65401 I am not sure the attribute added `should-ice` is the best for this job
2019-11-19Auto merge of #66206 - PotHix:master, r=estebankbors-1/+1
Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]` The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank Ref: #61286.
2019-11-16ast: Keep string literals in ABIs preciselyVadim Petrochenkov-3/+3
2019-11-16ast: Keep `extern` qualifiers in functions more preciselyVadim Petrochenkov-4/+12
2019-11-15Rollup merge of #66197 - Centril:transparent-ast, r=varkorTyler Mandry-20/+26
Push `ast::{ItemKind, ImplItemKind}::OpaqueTy` hack down into lowering We currently have a hack in the form of `ast::{ItemKind, ImplItemKind}::OpaqueTy` which is constructed literally when you write `type Alias = impl Trait;` but not e.g. `type Alias = Vec<impl Trait>;`. Per https://github.com/rust-lang/rfcs/pull/2515, this needs to change to allow `impl Trait` in nested positions. This PR achieves this change for the syntactic aspect but not the semantic one, which will require changes in lowering and def collection. In the interim, `TyKind::opaque_top_hack` is introduced to avoid knock-on changes in lowering, collection, and resolve. These hacks can then be removed and fixed one by one until the desired semantics are supported. r? @varkor
2019-11-14TAIT: feature gate recursive locationsMazdak Farrokhzad-20/+26
2019-11-14Update to use new librustc_error_codes libraryGuillaume Gomez-0/+3
2019-11-13Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavusYuki Okushi-1/+1
rename cfg(rustdoc) into cfg(doc) Needed by https://github.com/rust-lang/rust/pull/61351 r? @QuietMisdreavus
2019-11-11support issue = "none" in unstable attributesRoss MacArthur-20/+28
- Use `Option<NonZeroU32>` to represent issue numbers.
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-3/+17
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: https://github.com/rust-lang/rust/pull/57921 cc https://github.com/rust-lang/rust/issues/44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes https://github.com/rust-lang/rust/issues/29642
2019-11-10Auto merge of #65324 - Centril:organize-syntax, r=petrochenkovbors-20/+3
Split libsyntax apart In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax): - libsyntax: - concrete syntax tree (`syntax::ast`) - definition of tokens and token-streams (`syntax::{token, tokenstream}`) -- used by `syntax::ast` - visitors (`syntax::visit`, `syntax::mut_visit`) - shared definitions between `libsyntax_expand` - feature gating (`syntax::feature_gate`) -- we could possibly move this out to its own crater later. - attribute and meta item utilities, including used-marking (`syntax::attr`) - pretty printer (`syntax::print`) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken via `ParseSess`. This entails that e.g. `Debug` impls for `Path` cannot reference the pretty printer. - definition of `ParseSess` (`syntax::sess`) -- this is used by `syntax::{attr, print, feature_gate}` and is a common definition used by the parser and other things like librustc. - the `syntax::source_map` -- this includes definitions used by `syntax::ast` and other things but could ostensibly be moved `syntax_pos` since that is more related to this module. - a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR. - librustc_parse: - parser (`rustc_parse::parser`) -- reading a file and such are defined in the crate root tho. - lexer (`rustc_parse::lexer`) - validation of meta grammar (post-expansion) in (`rustc_parse::validate_attr`) - libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not. - conditional compilation (`syntax_expand::config`) -- moved from `syntax::config` to here - the bulk of this crate is made up of the old `syntax::ext` r? @estebank
2019-11-09Address review commentsVadim Petrochenkov-4/+4
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-3/+3
2019-11-09Support registering attributes and attribute tools using crate-level attributesVadim Petrochenkov-0/+14
2019-11-09Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, ↵bors-4/+3
r=nikomatsakis Stabilize the `re_rebalance_coherence` feature This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html), re-rebalance coherence. Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic. I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703) against the reference, updating it with the content of the RFC. Closes #63599 r? @nikomatsakis
2019-11-09move attr meta grammar to parse::validate_atr + ast_validationMazdak Farrokhzad-20/+3
2019-11-08Suggest `#[repr(C)]` instead of `#[repr(C, packed, ...)]`PotHix-1/+1
The code was previously suggesting `#[repr(C, packed, ...)]` for incorrect uses of `repr` (e.g. `#[repr = "C"]`). This change suggests the usage of `#[repr(C)]` instead. r? @estebank ref #61286
2019-11-07Push `re_rebalance_coherence` to 1.41Ohad Ravid-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-07syntax::parser::token -> syntax::tokenMazdak Farrokhzad-1/+1
2019-11-07Rollup merge of #65974 - Centril:matcher-friendly-gating, r=petrochenkovMazdak Farrokhzad-7/+5
A scheme for more macro-matcher friendly pre-expansion gating Pre-expansion gating will now avoid gating macro matchers that did not result in `Success(...)`. That is, the following is now OK despite `box 42` being a valid `expr` and that form being pre-expansion gated: ```rust macro_rules! m { ($e:expr) => { 0 }; // This fails on the input below due to `, foo`. (box $e:expr, foo) => { 1 }; // Successful matcher, we should get `2`. } fn main() { assert_eq!(1, m!(box 42, foo)); } ``` Closes https://github.com/rust-lang/rust/issues/65846. r? @petrochenkov cc @Mark-Simulacrum
2019-11-07Rollup merge of #65884 - Centril:non-hardcoded-abis, r=petrochenkovMazdak Farrokhzad-28/+35
syntax: ABI-oblivious grammar This PR has the following effects: 1. `extern $lit` is now legal where `$lit:literal` and `$lit` is substituted for a string literal. 2. `extern "abi_that_does_not_exist"` is now *syntactically* legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate. 3. `ast::FloatTy` is now distinct from `rustc_target::abi::FloatTy`. The former is used substantially more and the translation between them is only necessary in a single place. 4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat. cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :) r? @varkor
2019-11-07parser: don't hardcode ABIs into grammarMazdak Farrokhzad-28/+35
2019-11-07Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitorbors-11/+10
Rollup of 12 pull requests Successful merges: - #65794 (gate rustc_on_unimplemented under rustc_attrs) - #65945 (Optimize long-linker-command-line test) - #66044 (Improve uninit/zeroed lint) - #66076 (HIR docs: mention how to resolve method paths) - #66084 (Do not require extra LLVM backends for `x.py test` to pass) - #66111 (improve from_raw_parts docs) - #66114 (Improve std::thread::Result documentation) - #66117 (Fixed PhantomData markers in Arc and Rc) - #66146 (Remove unused parameters in `__thread_local_inner`) - #66147 (Miri: Refactor to_scalar_ptr out of existence) - #66162 (Fix broken link in README) - #66171 (Update link on CONTRIBUTING.md) Failed merges: r? @ghost
2019-11-07Rollup merge of #65794 - Centril:unimpl-internal, r=varkorYuki Okushi-11/+10
gate rustc_on_unimplemented under rustc_attrs Move `rustc_on_implemented` from the `on_implemented` gate to `rustc_attrs` as it is internal. Closes #29628 r? @varkor
2019-11-06rename cfg(rustdoc) into cfg(doc)Guillaume Gomez-1/+1
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-1/+2
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06Remove unnecessary `Deref` impl for `Attribute`.Nicholas Nethercote-1/+1
This kind of thing just makes the code harder to read.
2019-11-06rollback gating for failing macro matchersMazdak Farrokhzad-1/+1
2019-11-06revamp pre-expansion gating infraMazdak Farrokhzad-6/+4
2019-11-06gate rustc_on_unimplemented under rustc_attrsMazdak Farrokhzad-11/+10
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-1/+1
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-03add rustc_error(delay_span_bug_from_inside_query) attributeQuentin Boyer-1/+4
2019-11-02Simplify various `Symbol` use points.Nicholas Nethercote-1/+1
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch of unnecessary sigils.
2019-10-31syntax: disable the new early feature-gatings added in #65742.Eduard-Mihai Burtescu-0/+15
2019-10-31Revert "pre-expansion gate trait_alias."Eduard-Mihai Burtescu-0/+9
This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.
2019-10-31Revert "pre-expansion gate associated_type_bounds"Eduard-Mihai Burtescu-1/+14
This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.
2019-10-31Revert "pre-expansion gate crate_visibility_modifier"Eduard-Mihai Burtescu-0/+8
This reverts commit 04c661ba021730bc13d33c6d55cb9aad05026f36.
2019-10-31Revert "pre-expansion gate const_generics"Eduard-Mihai Burtescu-1/+11
This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.
2019-10-31Revert "pre-expansion gate decl_macro"Eduard-Mihai Burtescu-0/+5
This reverts commit 1f470ceac2202ecffe8a15acc1139edb9ad4a03b.
2019-10-31Revert "pre-expansion gate box_patterns"Eduard-Mihai Burtescu-1/+14
This reverts commit 2aff6b36d7ed5c25700669a92b4a43200ee0fe6b.
2019-10-31Revert "pre-expansion gate exclusive_range_pattern"Eduard-Mihai Burtescu-1/+6
This reverts commit 665a876e307933c6480a6c55a3e38e88937aff2c.
2019-10-31Revert "pre-expansion gate try_blocks"Eduard-Mihai Burtescu-0/+3
This reverts commit 1935ba658c576f14397c2c7a26a6642cf08f26a6.
2019-10-31Revert "pre-expansion gate label_break_value"Eduard-Mihai Burtescu-0/+6
This reverts commit 137ded8ab1edf5112c45e0b6854272ae2e9d3a6d.
2019-10-31Revert "pre-expansion gate box_syntax"Eduard-Mihai Burtescu-0/+6
This reverts commit e4ed8865786a787a7b0c045f7674569b6be0e9bc.
2019-10-31Revert "pre-expansion gate type_ascription"Eduard-Mihai Burtescu-0/+15
This reverts commit 15a6c09b6e8a977f2c6f5a73de01a20d00b37930.
2019-10-31Stabilize the `re_rebalance_coherence` featureOhad Ravid-4/+3
2019-10-29stabilize cfg(doctest)Guillaume Gomez-4/+2
2019-10-29Rollup merge of #65809 - roblabla:eficall-abi, r=nagisaMazdak Farrokhzad-0/+7
Add new EFIAPI ABI Fixes #54527 Adds a new ABI, "efiapi", which reflects the calling convention as specified by [the current spec UEFI spec](https://uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf#G6.999903). When compiling for x86_64, we should select the `win64` ABI, while on all other architectures (Itanium, x86, ARM and ARM64 and RISC-V), we should select the `C` ABI. Currently, this is done by just turning it into the C ABI everywhere except on x86_64, where it's turned into the win64 ABI. Should we prevent this ABI from being used on unsupported architectures, and if so, how would this be done?