about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate.rs
AgeCommit message (Collapse)AuthorLines
2015-03-26Implement `Reflect` trait with a variant on the standard OIBITNiko Matsakis-1/+6
semantics that tests the *interface* of trait objects, rather than what they close over.
2015-03-23rollup merge of #23506: alexcrichton/remove-some-deprecated-thingsAlex Crichton-2/+0
Conflicts: src/test/run-pass/deprecated-no-split-stack.rs
2015-03-20Feature gate defaulted traitsFlavio Percoco-0/+7
2015-03-18rustc: Remove some long deprecated features:Alex Crichton-2/+0
* no_split_stack was renamed to no_stack_check * deriving was renamed to derive * `use foo::mod` was renamed to `use foo::self`; * legacy lifetime definitions in closures have been replaced with `for` syntax * `fn foo() -> &A + B` has been deprecated for some time (needs parens) * Obsolete `for Sized?` syntax * Obsolete `Sized? Foo` syntax * Obsolete `|T| -> U` syntax
2015-03-13Add an "allocator" attribute to mark functions as allocatorsBjörn Steinbrink-0/+3
When this attribute is applied to a function, its return value gets the noalias attribute, which is how you tell LLVM that the function returns a "new" pointer that doesn't alias anything accessible to the caller, i.e. it acts like a memory allocator. Plain malloc doesn't need this attribute because LLVM already knows about malloc and adds the attribute itself.
2015-03-09remove uses of as_slice where deref coercions can be usedRicho Healey-2/+2
2015-03-06Make #[derive(Anything)] into sugar for #[derive_Anything]Keegan McAllister-0/+14
This is a hack, but I don't think we can do much better as long as `derive` is running at the syntax expansion phase. If the custom_derive feature gate is enabled, this works with user-defined traits and syntax extensions. Without the gate, you can't use e.g. #[derive_Clone] directly, so this does not change the stable language. This commit also cleans up the deriving code somewhat, and forbids some previously-meaningless attribute syntax. For this reason it's technically a [breaking-change]
2015-03-06Check gated attributes before and after macro expansionKeegan McAllister-37/+38
This is important because attributes can affect expansion.
2015-03-06Auto merge of #22899 - huonw:macro-stability, r=alexcrichtonbors-8/+34
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!("{}", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system. --- This updates `thread_local!` macro to use the attribute, since it uses unstable features internally (initialising a struct with unstable fields).
2015-03-06Run feature-gating on the final AST passed to the compiler.Huon Wilson-5/+9
This ensures we catch everything; previously, an unknown attribute inserted by #[cfg_attr(...)] in a macro expansion would not be detected.
2015-03-06Add more debugging to syntax::feature_gate.Huon Wilson-2/+6
2015-03-06Add #[allow_internal_unstable] to track stability for macros better.Huon Wilson-1/+19
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!("{}", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system.
2015-03-05Rollup merge of #22764 - ivanradanov:fileline_help, r=huonwManish Goregaokar-2/+2
When warnings and errors occur, the associated help message should not print the same code snippet. https://github.com/rust-lang/rust/issues/21938
2015-03-03Change span_help calls to fileline_help where appropriateIvan Radanov Ivanov-2/+2
2015-03-03Rollup merge of #22876 - Florob:const, r=nikomatsakisManish Goregaokar-2/+2
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-03Rollup merge of #22960 - huonw:static-assert, r=huonwManish Goregaokar-2/+5
The API this exposes is a little strange (being attached to `static`s), so it makes sense to conservatively feature gate it. If it is highly popular, it is possible to reverse this gating.
2015-03-03Feature gate `#[static_assert]`.Huon Wilson-2/+5
The API this exposes is a little strange (being attached to `static`s), so it makes sense to conservatively feature gate it. If it is highly popular, it is possible to reverse this gating.
2015-03-03Add cfg_attr to known attributesManish Goregaokar-0/+1
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-2/+2
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-25Whitelist #[should_panic]Steven Fackler-0/+1
2015-02-25Turn `unsafe_no_drop_flag` back into a gated-feature.Felix S. Klock II-1/+3
Fix #22173
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-1/+1
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-1/+1
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-11/+11
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-11/+11
2015-02-18For now, accept the `i`, `u`, `is`, and `us` suffixes, but warn whenNiko Matsakis-4/+4
they are used without a feature-gate. This is both kinder to existing code and should make it easier to land this PR, since we don't have to catch EVERY SINGLE SUFFIX.
2015-02-17Rollup merge of #22383 - pnkfelix:pass-features-along-during-expansion, r=huonwManish Goregaokar-11/+42
Pass features along during expansion Use the set of passed features to detect uses of feature-gated macros without the corresponding feature enabled. Fix #22234. ---- Also, the framework this add (passing along a reference to the features in the expansion context) is a necessary precursor for landing a properly feature-gated desugaring-based overloaded-`box` and placement-`in` (#22181). ---- This is fixing a bug, but since there might be code out there that is unknowingly taking advantage of that bug, I feel obligated to mark this as a: [breaking-change]
2015-02-17Add gating for rustc_* attrsManish Goregaokar-13/+30
2015-02-17move other attribute check to visit_attributeManish Goregaokar-20/+10
2015-02-17Add `Gated` attribute typeManish Goregaokar-28/+28
2015-02-16Clean up visit_attribute in feature_gate.rsManish Goregaokar-37/+26
- We shouldn't be using `check_name` here at all - `contains_name(ref_slice(foo), bar)` is redundant, `contains_name` just iterates over its first arg and calls `check_name` - match would be better than a bunch of ifs
2015-02-16Feature gate custom attributes (fixes #22203)Manish Goregaokar-0/+54
2015-02-16Move ATTRIBUTE_WHITELIST and CRATE_ATTRS to KNOWN_ATTRIBUTES in ↵Manish Goregaokar-0/+69
syntax::feature_gate
2015-02-16Address the other cases of #22234; fix #22234.Felix S. Klock II-6/+32
The other cases: `concat_idents!`, `log_syntax!`, and `trace_macros!`, (these macros, with `asm!`, are handled (eagerly) in feature_gate.rs).
2015-02-15Address the `asm!` case of #22234.Felix S. Klock II-5/+10
2015-02-15Rollup merge of #22277 - pnkfelix:reference-update-feature-gate-list, ↵Manish Goregaokar-0/+1
r=steveklabnik Added all active features to the list in reference.md. Added a second note about keeping the reference.md list up-to-date to the bottom of the list, since not everyone (including me) reads the big comment at the top of it. :) Ensured that the feature gate list in reference.md is kept in alphabetical order.
2015-02-13Added all active features to the list in reference.md.Felix S. Klock II-0/+1
Added a second note about keeping the reference.md list up-to-date to the bottom of the list, since not everyone (including me) reads the big comment at the top of it. :) Ensured that the feature gate list in reference.md is kept in alphabetical order.
2015-02-13Re-tag `slicing_syntax` as `Accepted`.Felix S. Klock II-1/+1
Rollup merge (373cbab5b08d6630da58f28d2166c19afc327fa6) of PR #20723 accidentally reverted a portion of commit 8327bcc167661c26ca5c6b967309ff745d302329 which shifted `slicing_syntax` from Active to Accepted.
2015-02-11rollup merge of #22178: pnkfelix/featuregate-unsafe-no-drop-flagAlex Crichton-0/+10
Conflicts: src/libsyntax/feature_gate.rs
2015-02-11Generalize all error messages with "experimental in alpha release" toFelix S. Klock II-1/+1
just say "experimental."
2015-02-11Feature-gate the `#[unsafe_no_drop_flag]` attribute.Felix S. Klock II-0/+10
See RFC 320, "Non-zeroing dynamic drops." Fix #22173 [breaking-change]
2015-02-11generalize error text to not focus on any particular release.Felix S. Klock II-1/+1
2015-02-11Add `box_patterns` feature gate.Felix S. Klock II-1/+4
Switch feature-gate checker from `box_syntax` to `box_patterns` when visiting a pattern. (Having to opt into both `box_syntax` and `box_patterns` seemed unnecessary.) [breaking-change]
2015-02-09Use a crate attribute to load pluginsKeegan McAllister-5/+5
#[plugin] #[no_link] extern crate bleh; becomes a crate attribute #![plugin(bleh)] The feature gate is still required. It's almost never correct to link a plugin into the resulting library / executable, because it will bring all of libsyntax and librustc with it. However if you really want this behavior, you can get it with a separate `extern crate` item in addition to the `plugin` attribute. Fixes #21043. Fixes #20769. [breaking-change]
2015-02-07Feature-gate #![no_std]Keegan McAllister-1/+9
Fixes #21833. [breaking-change]
2015-02-07Auto merge of #21505 - GuillaumeGomez:interned_string, r=alexcrichtonbors-2/+3
It's in order to make the code more homogeneous.
2015-02-06Libsyntax has been updatedGuillaumeGomez-3/+3
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-2/+3
2015-02-06Rollup merge of #21958 - brson:stable-features, r=alexcrichtonManish Goregaokar-5/+10
.... The 'stable_features' lint helps people progress from unstable to stable Rust by telling them when they no longer need a `feature` attribute because upstream Rust has declared it stable. This compares to the existing 'unstable_features' lint, which is used to implement feature staging, and triggers on *any* use of `#[feature]`.
2015-02-06Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnikManish Goregaokar-1/+1
The spelling corrections were made in both documentation comments and regular comments.