Skip to content

Commit 7240fad

Browse files
committed
auto merge of #13471 : Ryman/rust/feature_syntax_error, r=brson
The current error message is misleading, it asks users to add `#[feature(..)]` which ends up being treated as an outer attribute, which then has no error unless `attribute_usage` lint is enforced. The code will still fail and the user might not understand why.
2 parents 4c62ab1 + c48a3ef commit 7240fad

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/librustc/front/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a> Context<'a> {
9696
fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
9797
if !self.has_feature(feature) {
9898
self.sess.span_err(span, explain);
99-
self.sess.span_note(span, format!("add \\#[feature({})] to the \
99+
self.sess.span_note(span, format!("add \\#![feature({})] to the \
100100
crate attributes to enable",
101101
feature));
102102
}

src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3698,7 +3698,7 @@ pub fn instantiate_path(fcx: &FnCtxt,
36983698
&& !fcx.tcx().sess.features.default_type_params.get() {
36993699
fcx.tcx().sess.span_err(pth.span, "default type parameters are \
37003700
experimental and possibly buggy");
3701-
fcx.tcx().sess.span_note(pth.span, "add #[feature(default_type_params)] \
3701+
fcx.tcx().sess.span_note(pth.span, "add #![feature(default_type_params)] \
37023702
to the crate attributes to enable");
37033703
}
37043704

0 commit comments

Comments
 (0)