Skip to content

Allow tracking issues for lang features. #28246

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

Merged
merged 1 commit into from
Sep 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/etc/featureck.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,24 @@
is_feature_line = True

if is_feature_line:
line = line.replace("(", "").replace("),", "").replace(")", "")
# turn ` ("foo", "1.0.0", Some(10), Active)` into
# `"foo", "1.0.0", Some(10), Active`
line = line.strip(' ,()')
parts = line.split(",")
if len(parts) != 3:
if len(parts) != 4:
print("error: unexpected number of components in line: " + original_line)
sys.exit(1)
feature_name = parts[0].strip().replace('"', "")
since = parts[1].strip().replace('"', "")
status = parts[2].strip()
issue = parts[2].strip()
status = parts[3].strip()
assert len(feature_name) > 0
assert len(since) > 0
assert len(issue) > 0
assert len(status) > 0

language_feature_names += [feature_name]
language_features += [(feature_name, since, status)]
language_features += [(feature_name, since, issue, status)]

assert len(language_features) > 0

Expand Down Expand Up @@ -158,7 +162,7 @@
status = "unstable"
stable_since = None

if f[2] == "Accepted":
if f[3] == "Accepted":
status = "stable"
if status == "stable":
stable_since = f[1]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/check_static_recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use util::nodemap::NodeMap;

use syntax::{ast};
use syntax::codemap::Span;
use syntax::feature_gate::emit_feature_err;
use syntax::feature_gate::{GateIssue, emit_feature_err};
use rustc_front::visit::Visitor;
use rustc_front::visit;
use rustc_front::hir;
Expand Down Expand Up @@ -143,7 +143,7 @@ impl<'a, 'ast: 'a> CheckItemRecursionVisitor<'a, 'ast> {
if !self.sess.features.borrow().static_recursion {
emit_feature_err(&self.sess.parse_sess.span_diagnostic,
"static_recursion",
*self.root_span, "recursive static");
*self.root_span, GateIssue::Language, "recursive static");
}
} else {
span_err!(self.sess, *self.root_span, E0265, "recursive constant");
Expand Down
10 changes: 3 additions & 7 deletions src/librustc/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use syntax::parse::token::InternedString;
use syntax::codemap::{Span, DUMMY_SP};
use syntax::ast;
use syntax::ast::NodeId;
use syntax::feature_gate::emit_feature_err;
use syntax::feature_gate::{GateIssue, emit_feature_err};
use util::nodemap::{DefIdMap, FnvHashSet, FnvHashMap};

use rustc_front::hir;
Expand Down Expand Up @@ -294,18 +294,14 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
self.used_features.insert(feature.clone(), attr::Unstable);

if !self.active_features.contains(feature) {
let mut msg = match *reason {
let msg = match *reason {
Some(ref r) => format!("use of unstable library feature '{}': {}",
&feature, &r),
None => format!("use of unstable library feature '{}'", &feature)
};
if let Some(n) = issue {
use std::fmt::Write;
write!(&mut msg, " (see issue #{})", n).unwrap();
}

emit_feature_err(&self.tcx.sess.parse_sess.span_diagnostic,
&feature, span, &msg);
&feature, span, GateIssue::Library(issue), &msg);
}
}
Some(&Stability { level, ref feature, .. }) => {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ use util::nodemap::FnvHashSet;
use std::slice;
use syntax::{abi, ast};
use syntax::codemap::{Span, Pos};
use syntax::feature_gate::emit_feature_err;
use syntax::feature_gate::{GateIssue, emit_feature_err};
use syntax::parse::token;

use rustc_front::print::pprust;
Expand Down Expand Up @@ -797,7 +797,7 @@ fn create_substs_for_ast_trait_ref<'a,'tcx>(this: &AstConv<'tcx>,
// only with `Fn()` etc.
if !this.tcx().sess.features.borrow().unboxed_closures && trait_def.paren_sugar {
emit_feature_err(&this.tcx().sess.parse_sess.span_diagnostic,
"unboxed_closures", span,
"unboxed_closures", span, GateIssue::Language,
"\
the precise format of `Fn`-family traits' type parameters is \
subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead");
Expand All @@ -810,7 +810,7 @@ fn create_substs_for_ast_trait_ref<'a,'tcx>(this: &AstConv<'tcx>,
// only with `Fn()` etc.
if !this.tcx().sess.features.borrow().unboxed_closures && !trait_def.paren_sugar {
emit_feature_err(&this.tcx().sess.parse_sess.span_diagnostic,
"unboxed_closures", span,
"unboxed_closures", span, GateIssue::Language,
"\
parenthetical notation is only stable when used with `Fn`-family traits");
}
Expand Down
4 changes: 3 additions & 1 deletion src/libsyntax/ext/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
-> Box<base::MacResult+'cx> {
if !cx.ecfg.enable_asm() {
feature_gate::emit_feature_err(
&cx.parse_sess.span_diagnostic, "asm", sp, feature_gate::EXPLAIN_ASM);
&cx.parse_sess.span_diagnostic, "asm", sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_ASM);
return DummyResult::expr(sp);
}

Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/ext/concat_idents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub fn expand_syntax_ext<'cx>(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]
feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
"concat_idents",
sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_CONCAT_IDENTS);
return base::DummyResult::expr(sp);
}
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/ext/deriving/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn expand_derive(cx: &mut ExtCtxt,
feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
"custom_derive",
titem.span,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_CUSTOM_DERIVE);
continue;
}
Expand Down
4 changes: 3 additions & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
&fld.cx.parse_sess.span_diagnostic,
"allow_internal_unstable",
it.span,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_ALLOW_INTERNAL_UNSTABLE)
}

Expand Down Expand Up @@ -1469,7 +1470,8 @@ pub fn expand_type(t: P<ast::Ty>, fld: &mut MacroExpander) -> P<ast::Ty> {
&fld.cx.parse_sess.span_diagnostic,
"type_macros",
t.span,
"type macros are experimental (see issue: #27336)");
feature_gate::GateIssue::Language,
"type macros are experimental");

DummyResult::raw_ty(t.span)
}
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/ext/log_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt,
feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
"log_syntax",
sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_LOG_SYNTAX);
return base::DummyResult::any(sp);
}
Expand Down
1 change: 1 addition & 0 deletions src/libsyntax/ext/trace_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt,
feature_gate::emit_feature_err(&cx.parse_sess.span_diagnostic,
"trace_macros",
sp,
feature_gate::GateIssue::Language,
feature_gate::EXPLAIN_TRACE_MACROS);
return base::DummyResult::any(sp);
}
Expand Down
Loading