Skip to content

Commit 1ce08f9

Browse files
committed
Auto merge of #68351 - Centril:rollup-0gzuh0p, r=Centril
Rollup of 5 pull requests Successful merges: - #67712 (Stabilize `#![feature(slice_patterns)]` in 1.42.0) - #68224 (Prevent urls in headings) - #68340 (clean up e0200 explanation) - #68341 (Fix syscalls tables in docs of std::time.) - #68342 (improve type_name_of_val docs) Failed merges: r? @ghost
2 parents 779f85b + e8819b6 commit 1ce08f9

File tree

147 files changed

+432
-678
lines changed

Some content is hidden

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

147 files changed

+432
-678
lines changed

src/doc/unstable-book/src/language-features/slice-patterns.md

-32
This file was deleted.

src/libcore/any.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,15 @@ pub const fn type_name<T: ?Sized>() -> &'static str {
476476
///
477477
/// This is intended for diagnostic use. The exact contents and format of the
478478
/// string are not specified, other than being a best-effort description of the
479-
/// type. For example, `type_name_of::<Option<String>>(None)` could return
479+
/// type. For example, `type_name_of_val::<Option<String>>(None)` could return
480480
/// `"Option<String>"` or `"std::option::Option<std::string::String>"`, but not
481481
/// `"foobar"`. In addition, the output may change between versions of the
482482
/// compiler.
483483
///
484+
/// This function does not resolve trait objects,
485+
/// meaning that `type_name_of_val(&7u32 as &dyn Debug)`
486+
/// may return `"dyn Debug"`, but not `"u32"`.
487+
///
484488
/// The type name should not be considered a unique identifier of a type;
485489
/// multiple types may share the same type name.
486490
///

src/libcore/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
#![feature(associated_type_bounds)]
134134
#![feature(const_type_id)]
135135
#![feature(const_caller_location)]
136-
#![feature(slice_patterns)]
136+
#![cfg_attr(bootstrap, feature(slice_patterns))]
137137

138138
#[prelude_import]
139139
#[allow(unused)]

src/libcore/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#![feature(range_is_empty)]
2020
#![feature(raw)]
2121
#![feature(saturating_neg)]
22-
#![feature(slice_patterns)]
22+
#![cfg_attr(bootstrap, feature(slice_patterns))]
2323
#![feature(sort_internals)]
2424
#![feature(slice_partition_at_index)]
2525
#![feature(specialization)]

src/librustc/benches/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(slice_patterns)]
1+
#![cfg_attr(bootstrap, feature(slice_patterns))]
22
#![feature(test)]
33

44
extern crate test;

src/librustc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#![feature(optin_builtin_traits)]
4343
#![feature(option_expect_none)]
4444
#![feature(range_is_empty)]
45-
#![feature(slice_patterns)]
45+
#![cfg_attr(bootstrap, feature(slice_patterns))]
4646
#![feature(specialization)]
4747
#![feature(unboxed_closures)]
4848
#![feature(thread_local)]

src/librustc_ast_passes/feature_gate.rs

-21
Original file line numberDiff line numberDiff line change
@@ -470,29 +470,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
470470
visit::walk_expr(self, e)
471471
}
472472

473-
fn visit_arm(&mut self, arm: &'a ast::Arm) {
474-
visit::walk_arm(self, arm)
475-
}
476-
477473
fn visit_pat(&mut self, pattern: &'a ast::Pat) {
478474
match &pattern.kind {
479-
PatKind::Slice(pats) => {
480-
for pat in &*pats {
481-
let span = pat.span;
482-
let inner_pat = match &pat.kind {
483-
PatKind::Ident(.., Some(pat)) => pat,
484-
_ => pat,
485-
};
486-
if inner_pat.is_rest() {
487-
gate_feature_post!(
488-
&self,
489-
slice_patterns,
490-
span,
491-
"subslice patterns are unstable"
492-
);
493-
}
494-
}
495-
}
496475
PatKind::Box(..) => {
497476
gate_feature_post!(
498477
&self,

src/librustc_ast_passes/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
33
//! by `rustc_ast_lowering`.
44
5-
#![feature(slice_patterns)]
5+
#![cfg_attr(bootstrap, feature(slice_patterns))]
66

77
pub mod ast_validation;
88
pub mod feature_gate;

src/librustc_codegen_ssa/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![feature(box_syntax)]
55
#![feature(core_intrinsics)]
66
#![feature(libc)]
7-
#![feature(slice_patterns)]
7+
#![cfg_attr(bootstrap, feature(slice_patterns))]
88
#![feature(stmt_expr_attributes)]
99
#![feature(try_blocks)]
1010
#![feature(in_band_lifetimes)]
+14-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
An unsafe trait was implemented without an unsafe implementation.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0200
6+
struct Foo;
7+
8+
unsafe trait Bar { }
9+
10+
impl Bar for Foo { } // error!
11+
```
12+
113
Unsafe traits must have unsafe implementations. This error occurs when an
214
implementation for an unsafe trait isn't marked as unsafe. This may be resolved
315
by marking the unsafe implementation as unsafe.
416

5-
```compile_fail,E0200
17+
```
618
struct Foo;
719
820
unsafe trait Bar { }
921
10-
// this won't compile because Bar is unsafe and impl isn't unsafe
11-
impl Bar for Foo { }
12-
// this will compile
13-
unsafe impl Bar for Foo { }
22+
unsafe impl Bar for Foo { } // ok!
1423
```

src/librustc_error_codes/error_codes/E0527.md

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Ensure that the pattern is consistent with the size of the matched
1717
array. Additional elements can be matched with `..`:
1818

1919
```
20-
#![feature(slice_patterns)]
21-
2220
let r = &[1, 2, 3, 4];
2321
match r {
2422
&[a, b, ..] => { // ok!

src/librustc_error_codes/error_codes/E0528.md

-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ matched array.
44
Example of erroneous code:
55

66
```compile_fail,E0528
7-
#![feature(slice_patterns)]
8-
97
let r = &[1, 2];
108
match r {
119
&[a, b, c, rest @ ..] => { // error: pattern requires at least 3
@@ -19,8 +17,6 @@ Ensure that the matched array has at least as many elements as the pattern
1917
requires. You can match an arbitrary number of remaining elements with `..`:
2018

2119
```
22-
#![feature(slice_patterns)]
23-
2420
let r = &[1, 2, 3, 4, 5];
2521
match r {
2622
&[a, b, c, rest @ ..] => { // ok!

src/librustc_error_codes/error_codes/E0730.md

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Ensure that the pattern is consistent with the size of the matched
1818
array. Additional elements can be matched with `..`:
1919

2020
```
21-
#![feature(slice_patterns)]
22-
2321
let r = &[1, 2, 3, 4];
2422
match r {
2523
&[a, b, ..] => { // ok!

src/librustc_feature/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ declare_features! (
257257
/// Allows relaxing the coherence rules such that
258258
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
259259
(accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
260+
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
261+
(accepted, slice_patterns, "1.42.0", Some(62254), None),
260262

261263
// -------------------------------------------------------------------------
262264
// feature-group-end: accepted features

src/librustc_feature/active.rs

-3
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,6 @@ declare_features! (
262262
/// Allows using non lexical lifetimes (RFC 2094).
263263
(active, nll, "1.0.0", Some(43234), None),
264264

265-
/// Allows using slice patterns.
266-
(active, slice_patterns, "1.0.0", Some(62254), None),
267-
268265
/// Allows the definition of `const` functions with some advanced features.
269266
(active, const_fn, "1.2.0", Some(57563), None),
270267

src/librustc_metadata/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#![feature(proc_macro_internals)]
1111
#![feature(proc_macro_quote)]
1212
#![feature(rustc_private)]
13-
#![feature(slice_patterns)]
13+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1414
#![feature(specialization)]
1515
#![feature(stmt_expr_attributes)]
1616
#![recursion_limit = "256"]

src/librustc_mir/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
77
#![feature(nll)]
88
#![feature(in_band_lifetimes)]
99
#![feature(inner_deref)]
10-
#![feature(slice_patterns)]
10+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1111
#![feature(bool_to_option)]
1212
#![feature(box_patterns)]
1313
#![feature(box_syntax)]

src/librustc_mir_build/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#![feature(box_patterns)]
66
#![feature(box_syntax)]
77
#![feature(crate_visibility_modifier)]
8-
#![feature(slice_patterns)]
8+
#![cfg_attr(bootstrap, feature(slice_patterns))]
99
#![feature(bool_to_option)]
1010
#![recursion_limit = "256"]
1111

src/librustc_parse/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
#![feature(bool_to_option)]
44
#![feature(crate_visibility_modifier)]
5-
#![feature(slice_patterns)]
5+
#![cfg_attr(bootstrap, feature(slice_patterns))]
66

77
use syntax::ast;
88
use syntax::print::pprust;

src/librustc_passes/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
88
#![feature(in_band_lifetimes)]
99
#![feature(nll)]
10-
#![feature(slice_patterns)]
10+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1111
#![recursion_limit = "256"]
1212

1313
#[macro_use]

src/librustc_target/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![feature(box_syntax)]
1212
#![feature(bool_to_option)]
1313
#![feature(nll)]
14-
#![feature(slice_patterns)]
14+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1515

1616
#[macro_use]
1717
extern crate log;

src/librustc_ty/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![feature(bool_to_option)]
99
#![feature(in_band_lifetimes)]
1010
#![feature(nll)]
11-
#![feature(slice_patterns)]
11+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1212
#![recursion_limit = "256"]
1313

1414
#[macro_use]

src/librustc_typeck/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ This API is completely unstable and subject to change.
6464
#![feature(exhaustive_patterns)]
6565
#![feature(in_band_lifetimes)]
6666
#![feature(nll)]
67-
#![feature(slice_patterns)]
67+
#![cfg_attr(bootstrap, feature(slice_patterns))]
6868
#![feature(try_blocks)]
6969
#![feature(never_type)]
7070
#![recursion_limit = "256"]

src/librustdoc/html/markdown.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@ impl<'a, 'b, 'ids, I: Iterator<Item = Event<'a>>> Iterator for HeadingLinks<'a,
380380
}
381381
_ => {}
382382
}
383-
self.buf.push_back(event);
383+
match event {
384+
Event::Start(Tag::Link(_, _, _)) | Event::End(Tag::Link(..)) => {}
385+
event => self.buf.push_back(event),
386+
}
384387
}
385388
let id = self.id_map.derive(id);
386389

@@ -395,7 +398,7 @@ impl<'a, 'b, 'ids, I: Iterator<Item = Event<'a>>> Iterator for HeadingLinks<'a,
395398

396399
let start_tags = format!(
397400
"<h{level} id=\"{id}\" class=\"section-header\">\
398-
<a href=\"#{id}\">",
401+
<a href=\"#{id}\">",
399402
id = id,
400403
level = level
401404
);

src/libstd/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
#![feature(shrink_to)]
295295
#![feature(slice_concat_ext)]
296296
#![feature(slice_internals)]
297-
#![feature(slice_patterns)]
297+
#![cfg_attr(bootstrap, feature(slice_patterns))]
298298
#![feature(specialization)]
299299
#![feature(staged_api)]
300300
#![feature(std_internals)]

src/libstd/time.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub use core::time::Duration;
6565
///
6666
/// | Platform | System call |
6767
/// |:---------:|:--------------------------------------------------------------------:|
68-
/// | Cloud ABI | [clock_time_get (Monotonic Clock)] |
68+
/// | CloudABI | [clock_time_get (Monotonic Clock)] |
6969
/// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] |
7070
/// | UNIX | [clock_gettime (Monotonic Clock)] |
7171
/// | Darwin | [mach_absolute_time] |
@@ -79,7 +79,7 @@ pub use core::time::Duration;
7979
/// [__wasi_clock_time_get (Monotonic Clock)]: https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md#clock_time_get
8080
/// [clock_gettime (Monotonic Clock)]: https://linux.die.net/man/3/clock_gettime
8181
/// [mach_absolute_time]: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/services/services.html
82-
/// [clock_time_get (Monotonic Clock)]: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt
82+
/// [clock_time_get (Monotonic Clock)]: https://nuxi.nl/cloudabi/#clock_time_get
8383
///
8484
/// **Disclaimer:** These system calls might change over time.
8585
///
@@ -144,15 +144,15 @@ pub struct Instant(time::Instant);
144144
///
145145
/// | Platform | System call |
146146
/// |:---------:|:--------------------------------------------------------------------:|
147-
/// | Cloud ABI | [clock_time_get (Realtime Clock)] |
147+
/// | CloudABI | [clock_time_get (Realtime Clock)] |
148148
/// | SGX | [`insecure_time` usercall]. More information on [timekeeping in SGX] |
149149
/// | UNIX | [clock_gettime (Realtime Clock)] |
150150
/// | DARWIN | [gettimeofday] |
151151
/// | VXWorks | [clock_gettime (Realtime Clock)] |
152152
/// | WASI | [__wasi_clock_time_get (Realtime Clock)] |
153153
/// | Windows | [GetSystemTimeAsFileTime] |
154154
///
155-
/// [clock_time_get (Realtime Clock)]: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt
155+
/// [clock_time_get (Realtime Clock)]: https://nuxi.nl/cloudabi/#clock_time_get
156156
/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
157157
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
158158
/// [gettimeofday]: http://man7.org/linux/man-pages/man2/gettimeofday.2.html

src/libsyntax/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#![feature(label_break_value)]
1414
#![feature(nll)]
1515
#![feature(try_trait)]
16-
#![feature(slice_patterns)]
16+
#![cfg_attr(bootstrap, feature(slice_patterns))]
1717
#![feature(unicode_internals)]
1818
#![recursion_limit = "256"]
1919

src/test/mir-opt/uniform_array_move_out.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(box_syntax)]
2-
#![feature(slice_patterns)]
32

43
fn move_out_from_end() {
54
let a = [box 1, box 2];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![crate_name = "foo"]
2+
3+
// @has foo/fn.foo.html
4+
// !@has - '//a[@href="http://a.a"]'
5+
// @has - '//a[@href="#implementing-stuff-somewhere"]' 'Implementing stuff somewhere'
6+
// @has - '//a[@href="#another-one-urg"]' 'Another one urg'
7+
8+
/// fooo
9+
///
10+
/// # Implementing [stuff](http://a.a "title") somewhere
11+
///
12+
/// hello
13+
///
14+
/// # Another [one][two] urg
15+
///
16+
/// [two]: http://a.a
17+
pub fn foo() {}

src/test/ui/match/match-vec-mismatch.rs src/test/ui/array-slice-vec/slice-pat-type-mismatches.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(slice_patterns)]
2-
31
fn main() {
42
match "foo".to_string() {
53
['f', 'o', ..] => {}

0 commit comments

Comments
 (0)