Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d68e7eb

Browse files
committedJul 20, 2022
Auto merge of #99520 - matthiaskrgr:rollup-05uuv5s, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #99212 (introduce `implied_by` in `#[unstable]` attribute) - #99352 (Use `typeck_results` to avoid duplicate `ast_ty_to_ty` call) - #99355 (better error for bad depth parameter on macro metavar expr) - #99480 (Diagnostic width span is not added when '0$' is used as width in format strings) - #99488 (compiletest: Allow using revisions with debuginfo tests.) - #99489 (rustdoc UI fixes) - #99508 (Avoid `Symbol` to `String` conversions) - #99510 (adapt assembly/static-relocation-model test for LLVM change) - #99516 (Use new tracking issue for proc_macro::tracked_*.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents a7468c6 + a5a6811 commit d68e7eb

File tree

60 files changed

+584
-254
lines changed

Some content is hidden

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

60 files changed

+584
-254
lines changed
 

‎compiler/rustc_attr/src/builtin.rs

+44-5
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,42 @@ impl ConstStability {
135135
#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
136136
#[derive(HashStable_Generic)]
137137
pub enum StabilityLevel {
138-
// Reason for the current stability level and the relevant rust-lang issue
139-
Unstable { reason: Option<Symbol>, issue: Option<NonZeroU32>, is_soft: bool },
140-
Stable { since: Symbol, allowed_through_unstable_modules: bool },
138+
/// `#[unstable]`
139+
Unstable {
140+
/// Reason for the current stability level.
141+
reason: Option<Symbol>,
142+
/// Relevant `rust-lang/rust` issue.
143+
issue: Option<NonZeroU32>,
144+
is_soft: bool,
145+
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
146+
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
147+
/// contained a item.
148+
///
149+
/// ```pseudo-Rust
150+
/// #[unstable(feature = "foo", issue = "...")]
151+
/// fn foo() {}
152+
/// #[unstable(feature = "foo", issue = "...")]
153+
/// fn foobar() {}
154+
/// ```
155+
///
156+
/// ...becomes...
157+
///
158+
/// ```pseudo-Rust
159+
/// #[stable(feature = "foo", since = "1.XX.X")]
160+
/// fn foo() {}
161+
/// #[unstable(feature = "foobar", issue = "...", implied_by = "foo")]
162+
/// fn foobar() {}
163+
/// ```
164+
implied_by: Option<Symbol>,
165+
},
166+
/// `#[stable]`
167+
Stable {
168+
/// Rust release which stabilized this feature.
169+
since: Symbol,
170+
/// Is this item allowed to be referred to on stable, despite being contained in unstable
171+
/// modules?
172+
allowed_through_unstable_modules: bool,
173+
},
141174
}
142175

143176
impl StabilityLevel {
@@ -243,6 +276,7 @@ where
243276
let mut issue = None;
244277
let mut issue_num = None;
245278
let mut is_soft = false;
279+
let mut implied_by = None;
246280
for meta in metas {
247281
let Some(mi) = meta.meta_item() else {
248282
handle_errors(
@@ -308,6 +342,11 @@ where
308342
}
309343
is_soft = true;
310344
}
345+
sym::implied_by => {
346+
if !get(mi, &mut implied_by) {
347+
continue 'outer;
348+
}
349+
}
311350
_ => {
312351
handle_errors(
313352
&sess.parse_sess,
@@ -332,7 +371,7 @@ where
332371
);
333372
continue;
334373
}
335-
let level = Unstable { reason, issue: issue_num, is_soft };
374+
let level = Unstable { reason, issue: issue_num, is_soft, implied_by };
336375
if sym::unstable == meta_name {
337376
stab = Some((Stability { level, feature }, attr.span));
338377
} else {
@@ -391,7 +430,7 @@ where
391430
meta.span(),
392431
AttrError::UnknownMetaItem(
393432
pprust::path_to_string(&mi.path),
394-
&["since", "note"],
433+
&["feature", "since"],
395434
),
396435
);
397436
continue 'outer;

‎compiler/rustc_builtin_macros/src/format.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl<'a, 'b> Context<'a, 'b> {
485485
if let Some(span) = fmt.width_span {
486486
let span = self.fmtsp.from_inner(InnerSpan::new(span.start, span.end));
487487
match fmt.width {
488-
parse::CountIsParam(pos) if pos > self.num_args() => {
488+
parse::CountIsParam(pos) if pos >= self.num_args() => {
489489
e.span_label(
490490
span,
491491
&format!(
@@ -1004,9 +1004,7 @@ fn lint_named_arguments_used_positionally(
10041004
node_id: ast::CRATE_NODE_ID,
10051005
lint_id: LintId::of(&NAMED_ARGUMENTS_USED_POSITIONALLY),
10061006
diagnostic: BuiltinLintDiagnostics::NamedArgumentUsedPositionally(
1007-
arg_span,
1008-
span,
1009-
symbol.to_string(),
1007+
arg_span, span, symbol,
10101008
),
10111009
});
10121010
}

0 commit comments

Comments
 (0)
Please sign in to comment.