Skip to content

Commit a143517

Browse files
committed
Auto merge of #82192 - GuillaumeGomez:rollup-gi1639b, r=GuillaumeGomez
Rollup of 6 pull requests Successful merges: - #82145 (Fix ES5 errors (IE11)) - #82160 (Fix typo in rustc_infer::infer::UndoLog) - #82161 (Add long explanation for E0545) - #82163 (avoid full-slicing slices) - #82175 (validation: fix invalid-fn-ptr error message) - #82184 ([Minor] Update discriminant_value docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9d3deed + 9502e5c commit a143517

File tree

30 files changed

+127
-62
lines changed

30 files changed

+127
-62
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
135135

136136
let parent_generics = match self.items.get(&parent_hir_id).unwrap().kind {
137137
hir::ItemKind::Impl(hir::Impl { ref generics, .. })
138-
| hir::ItemKind::Trait(_, _, ref generics, ..) => &generics.params[..],
138+
| hir::ItemKind::Trait(_, _, ref generics, ..) => generics.params,
139139
_ => &[],
140140
};
141141
let lt_def_names = parent_generics.iter().filter_map(|param| match param.kind {

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ impl<'a> State<'a> {
16811681
self.ibox(INDENT_UNIT);
16821682
self.s.word("[");
16831683
self.print_inner_attributes_inline(attrs);
1684-
self.commasep_exprs(Inconsistent, &exprs[..]);
1684+
self.commasep_exprs(Inconsistent, exprs);
16851685
self.s.word("]");
16861686
self.end();
16871687
}
@@ -1722,7 +1722,7 @@ impl<'a> State<'a> {
17221722
self.print_inner_attributes_inline(attrs);
17231723
self.commasep_cmnt(
17241724
Consistent,
1725-
&fields[..],
1725+
fields,
17261726
|s, field| {
17271727
s.print_outer_attributes(&field.attrs);
17281728
s.ibox(INDENT_UNIT);
@@ -1757,7 +1757,7 @@ impl<'a> State<'a> {
17571757
fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>], attrs: &[ast::Attribute]) {
17581758
self.popen();
17591759
self.print_inner_attributes_inline(attrs);
1760-
self.commasep_exprs(Inconsistent, &exprs[..]);
1760+
self.commasep_exprs(Inconsistent, exprs);
17611761
if exprs.len() == 1 {
17621762
self.s.word(",");
17631763
}

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl<'a, 'b> Context<'a, 'b> {
270270
parse::ArgumentNamed(s) => Named(s),
271271
};
272272

273-
let ty = Placeholder(match &arg.format.ty[..] {
273+
let ty = Placeholder(match arg.format.ty {
274274
"" => "Display",
275275
"?" => "Debug",
276276
"e" => "LowerExp",

compiler/rustc_builtin_macros/src/format_foreign.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pub mod printf {
312312
return Some((Substitution::Escape, &s[start + 2..]));
313313
}
314314

315-
Cur::new_at(&s[..], start)
315+
Cur::new_at(s, start)
316316
};
317317

318318
// This is meant to be a translation of the following regex:
@@ -673,7 +673,7 @@ pub mod shell {
673673
_ => { /* fall-through */ }
674674
}
675675

676-
Cur::new_at(&s[..], start)
676+
Cur::new_at(s, start)
677677
};
678678

679679
let at = at.at_next_cp()?;

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
709709
let (tup, args) = args.split_last().unwrap();
710710
(args, Some(tup))
711711
} else {
712-
(&args[..], None)
712+
(args, None)
713713
};
714714

715715
'make_args: for (i, arg) in first_args.iter().enumerate() {

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ E0538: include_str!("./error_codes/E0538.md"),
286286
E0539: include_str!("./error_codes/E0539.md"),
287287
E0541: include_str!("./error_codes/E0541.md"),
288288
E0542: include_str!("./error_codes/E0542.md"),
289+
E0545: include_str!("./error_codes/E0545.md"),
289290
E0546: include_str!("./error_codes/E0546.md"),
290291
E0547: include_str!("./error_codes/E0547.md"),
291292
E0550: include_str!("./error_codes/E0550.md"),
@@ -606,7 +607,6 @@ E0781: include_str!("./error_codes/E0781.md"),
606607
// E0540, // multiple rustc_deprecated attributes
607608
E0543, // missing 'reason'
608609
E0544, // multiple stability levels
609-
E0545, // incorrect 'issue'
610610
// E0548, // replaced with a generic attribute input check
611611
// rustc_deprecated attribute must be paired with either stable or unstable
612612
// attribute
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
The `issue` value is incorrect in a stability attribute.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0545
6+
#![feature(staged_api)]
7+
#![stable(since = "1.0.0", feature = "test")]
8+
9+
#[unstable(feature = "_unstable_fn", issue = "0")] // invalid
10+
fn _unstable_fn() {}
11+
12+
#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "0")] // invalid
13+
fn _unstable_const_fn() {}
14+
```
15+
16+
To fix this issue, you need to provide a correct value in the `issue` field.
17+
Example:
18+
19+
```
20+
#![feature(staged_api)]
21+
#![stable(since = "1.0.0", feature = "test")]
22+
23+
#[unstable(feature = "_unstable_fn", issue = "none")] // ok!
24+
fn _unstable_fn() {}
25+
26+
#[rustc_const_unstable(feature = "_unstable_const_fn", issue = "1")] // ok!
27+
fn _unstable_const_fn() {}
28+
```
29+
30+
See the [How Rust is Made and “Nightly Rust”][how-rust-made-nightly] appendix
31+
of the Book and the [Stability attributes][stability-attributes] section of the
32+
Rustc Dev Guide for more details.
33+
34+
[how-rust-made-nightly]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
35+
[stability-attributes]: https://rustc-dev-guide.rust-lang.org/stability.html

compiler/rustc_hir_pretty/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<'a> State<'a> {
392392
&f.decl,
393393
None,
394394
&f.generic_params,
395-
&f.param_names[..],
395+
f.param_names,
396396
);
397397
}
398398
hir::TyKind::OpaqueDef(..) => self.s.word("/*impl Trait*/"),
@@ -1200,7 +1200,7 @@ impl<'a> State<'a> {
12001200
self.s.word("{");
12011201
self.commasep_cmnt(
12021202
Consistent,
1203-
&fields[..],
1203+
fields,
12041204
|s, field| {
12051205
s.ibox(INDENT_UNIT);
12061206
if !field.is_shorthand {

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
671671
if !impl_candidates.is_empty() && e.span.contains(span) {
672672
if let Some(expr) = exprs.first() {
673673
if let ExprKind::Path(hir::QPath::Resolved(_, path)) = expr.kind {
674-
if let [path_segment] = &path.segments[..] {
674+
if let [path_segment] = path.segments {
675675
let candidate_len = impl_candidates.len();
676676
let suggestions = impl_candidates.iter().map(|candidate| {
677677
format!(

compiler/rustc_infer/src/infer/undo_log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct Snapshot<'tcx> {
1515
_marker: PhantomData<&'tcx ()>,
1616
}
1717

18-
/// Records the 'undo' data fora single operation that affects some form of inference variable.
18+
/// Records the "undo" data for a single operation that affects some form of inference variable.
1919
pub(crate) enum UndoLog<'tcx> {
2020
TypeVariables(type_variable::UndoLog<'tcx>),
2121
ConstUnificationTable(sv::UndoLog<ut::Delegate<ty::ConstVid<'tcx>>>),

0 commit comments

Comments
 (0)