Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple stability attributes on items #131824

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,7 @@ dependencies = [
"rustc_serialize",
"rustc_session",
"rustc_span",
"smallvec",
]

[[package]]
Expand Down Expand Up @@ -3506,6 +3507,7 @@ dependencies = [
"rustc_target",
"rustc_trait_selection",
"rustc_type_ir",
"smallvec",
"tracing",
]

Expand Down Expand Up @@ -3683,6 +3685,7 @@ dependencies = [
name = "rustc_feature"
version = "0.0.0"
dependencies = [
"either",
"rustc_data_structures",
"rustc_span",
]
Expand Down Expand Up @@ -4217,6 +4220,7 @@ dependencies = [
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"smallvec",
"tracing",
]

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use rustc_ast as ast;
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::{NodeId, PatKind, attr, token};
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features, GateIssue};
use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features};
use rustc_session::Session;
use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
use rustc_session::parse::{feature_err, feature_warn};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::sym;
use rustc_span::{Span, Symbol};
Expand Down Expand Up @@ -81,7 +81,7 @@ impl<'a> PostExpansionVisitor<'a> {
match abi::is_enabled(self.features, span, symbol_unescaped.as_str()) {
Ok(()) => (),
Err(abi::AbiDisabled::Unstable { feature, explain }) => {
feature_err_issue(&self.sess, feature, span, GateIssue::Language, explain).emit();
feature_err(&self.sess, feature, span, explain).emit();
}
Err(abi::AbiDisabled::Unrecognized) => {
if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_attr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ rustc_macros = { path = "../rustc_macros" }
rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
# tidy-alphabetical-end
8 changes: 7 additions & 1 deletion compiler/rustc_attr/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ attr_multiple_item =
multiple '{$item}' items

attr_multiple_stability_levels =
multiple stability levels
multiple stability levels for feature `{$feature}`

attr_multiple_unstable_reasons =
multiple reasons provided for unstability

attr_non_ident_feature =
'feature' is not an identifier
Expand All @@ -97,6 +100,9 @@ attr_rustc_const_stable_indirect_pairing =
attr_rustc_promotable_pairing =
`rustc_promotable` attribute must be paired with either a `rustc_const_unstable` or a `rustc_const_stable` attribute

attr_soft_inconsistent =
`soft` must be present on either none or all of an item's `unstable` attributes

attr_soft_no_args =
`soft` should not have any arguments

Expand Down
Loading
Loading