Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 015c777

Browse files
committed
Auto merge of #142432 - matthiaskrgr:rollup-ziuls9y, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #138016 (Added `Clone` implementation for `ChunkBy`) - #141162 (refactor `AttributeGate` and `rustc_attr!` to emit notes during feature checking) - #141474 (Add `ParseMode::Diagnostic` and fix multiline spans in diagnostic attribute lints) - #141947 (Specify that "option-like" enums must be `#[repr(Rust)]` to be ABI-compatible with their non-1ZST field.) - #142252 (Improve clarity of `core::sync::atomic` docs about "Considerations" in regards to CAS operations) - #142337 (miri: add flag to suppress float non-determinism) r? `@ghost` `@rustbot` modify labels: rollup
2 parents ed44c0e + 88df5a5 commit 015c777

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+907
-594
lines changed

‎compiler/rustc_ast_passes/src/feature_gate.rs‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ macro_rules! gate_alt {
3636
feature_err(&$visitor.sess, $name, $span, $explain).emit();
3737
}
3838
}};
39+
($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr, $notes: expr) => {{
40+
if !$has_feature && !$span.allows_unstable($name) {
41+
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
42+
let mut diag = feature_err(&$visitor.sess, $name, $span, $explain);
43+
for note in $notes {
44+
diag.note(*note);
45+
}
46+
diag.emit();
47+
}
48+
}};
3949
}
4050

4151
/// The case involving a multispan.
@@ -154,11 +164,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
154164
let attr_info = attr.ident().and_then(|ident| BUILTIN_ATTRIBUTE_MAP.get(&ident.name));
155165
// Check feature gates for built-in attributes.
156166
if let Some(BuiltinAttribute {
157-
gate: AttributeGate::Gated(_, name, descr, has_feature),
167+
gate: AttributeGate::Gated{ feature, message, check, notes, .. },
158168
..
159169
}) = attr_info
160170
{
161-
gate_alt!(self, has_feature(self.features), *name, attr.span, *descr);
171+
gate_alt!(self, check(self.features), *feature, attr.span, *message,*notes);
162172
}
163173
// Check unstable flavors of the `#[doc]` attribute.
164174
if attr.has_name(sym::doc) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /