Skip to content

Commit 20fc02f

Browse files
committedApr 20, 2020
Auto merge of rust-lang#71356 - Dylan-DPC:rollup-liockhk, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - rust-lang#71250 (Replace big JS dict with JSON parsing) - rust-lang#71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`) - rust-lang#71284 (fix -Zast-json to output correct JSON form) - rust-lang#71328 (Stabilize PathBuf capacity methods) - rust-lang#71334 (Update pattern docs.) Failed merges: r? @ghost
2 parents 8ce3f84 + b921587 commit 20fc02f

File tree

11 files changed

+223
-60
lines changed

11 files changed

+223
-60
lines changed
 

Diff for: ‎src/libcore/str/mod.rs

+115-36
Original file line numberDiff line numberDiff line change
@@ -3010,6 +3010,12 @@ impl str {
30103010
///
30113011
/// Returns `false` if it does not.
30123012
///
3013+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3014+
/// function or closure that determines if a character matches.
3015+
///
3016+
/// [`char`]: primitive.char.html
3017+
/// [pattern]: str/pattern/index.html
3018+
///
30133019
/// # Examples
30143020
///
30153021
/// Basic usage:
@@ -3031,6 +3037,12 @@ impl str {
30313037
///
30323038
/// Returns `false` if it does not.
30333039
///
3040+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3041+
/// function or closure that determines if a character matches.
3042+
///
3043+
/// [`char`]: primitive.char.html
3044+
/// [pattern]: str/pattern/index.html
3045+
///
30343046
/// # Examples
30353047
///
30363048
/// Basic usage:
@@ -3051,6 +3063,12 @@ impl str {
30513063
///
30523064
/// Returns `false` if it does not.
30533065
///
3066+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3067+
/// function or closure that determines if a character matches.
3068+
///
3069+
/// [`char`]: primitive.char.html
3070+
/// [pattern]: str/pattern/index.html
3071+
///
30543072
/// # Examples
30553073
///
30563074
/// Basic usage:
@@ -3074,10 +3092,12 @@ impl str {
30743092
///
30753093
/// Returns [`None`] if the pattern doesn't match.
30763094
///
3077-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
3078-
/// a character matches.
3095+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3096+
/// function or closure that determines if a character matches.
30793097
///
30803098
/// [`None`]: option/enum.Option.html#variant.None
3099+
/// [`char`]: primitive.char.html
3100+
/// [pattern]: str/pattern/index.html
30813101
///
30823102
/// # Examples
30833103
///
@@ -3121,10 +3141,12 @@ impl str {
31213141
///
31223142
/// Returns [`None`] if the pattern doesn't match.
31233143
///
3124-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
3125-
/// a character matches.
3144+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3145+
/// function or closure that determines if a character matches.
31263146
///
31273147
/// [`None`]: option/enum.Option.html#variant.None
3148+
/// [`char`]: primitive.char.html
3149+
/// [pattern]: str/pattern/index.html
31283150
///
31293151
/// # Examples
31303152
///
@@ -3166,8 +3188,11 @@ impl str {
31663188
/// An iterator over substrings of this string slice, separated by
31673189
/// characters matched by a pattern.
31683190
///
3169-
/// The pattern can be any type that implements the Pattern trait. Notable
3170-
/// examples are `&str`, [`char`], and closures that determines the split.
3191+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3192+
/// function or closure that determines if a character matches.
3193+
///
3194+
/// [`char`]: primitive.char.html
3195+
/// [pattern]: str/pattern/index.html
31713196
///
31723197
/// # Iterator behavior
31733198
///
@@ -3285,6 +3310,12 @@ impl str {
32853310
/// `split` in that `split_inclusive` leaves the matched part as the
32863311
/// terminator of the substring.
32873312
///
3313+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3314+
/// function or closure that determines if a character matches.
3315+
///
3316+
/// [`char`]: primitive.char.html
3317+
/// [pattern]: str/pattern/index.html
3318+
///
32883319
/// # Examples
32893320
///
32903321
/// ```
@@ -3319,8 +3350,11 @@ impl str {
33193350
/// An iterator over substrings of the given string slice, separated by
33203351
/// characters matched by a pattern and yielded in reverse order.
33213352
///
3322-
/// The pattern can be any type that implements the Pattern trait. Notable
3323-
/// examples are `&str`, [`char`], and closures that determines the split.
3353+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3354+
/// function or closure that determines if a character matches.
3355+
///
3356+
/// [`char`]: primitive.char.html
3357+
/// [pattern]: str/pattern/index.html
33243358
///
33253359
/// # Iterator behavior
33263360
///
@@ -3370,8 +3404,11 @@ impl str {
33703404
/// An iterator over substrings of the given string slice, separated by
33713405
/// characters matched by a pattern.
33723406
///
3373-
/// The pattern can be any type that implements the Pattern trait. Notable
3374-
/// examples are `&str`, [`char`], and closures that determines the split.
3407+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3408+
/// function or closure that determines if a character matches.
3409+
///
3410+
/// [`char`]: primitive.char.html
3411+
/// [pattern]: str/pattern/index.html
33753412
///
33763413
/// Equivalent to [`split`], except that the trailing substring
33773414
/// is skipped if empty.
@@ -3414,10 +3451,11 @@ impl str {
34143451
/// An iterator over substrings of `self`, separated by characters
34153452
/// matched by a pattern and yielded in reverse order.
34163453
///
3417-
/// The pattern can be any type that implements the Pattern trait. Notable
3418-
/// examples are `&str`, [`char`], and closures that determines the split.
3419-
/// Additional libraries might provide more complex patterns like
3420-
/// regular expressions.
3454+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3455+
/// function or closure that determines if a character matches.
3456+
///
3457+
/// [`char`]: primitive.char.html
3458+
/// [pattern]: str/pattern/index.html
34213459
///
34223460
/// Equivalent to [`split`], except that the trailing substring is
34233461
/// skipped if empty.
@@ -3462,8 +3500,11 @@ impl str {
34623500
/// If `n` substrings are returned, the last substring (the `n`th substring)
34633501
/// will contain the remainder of the string.
34643502
///
3465-
/// The pattern can be any type that implements the Pattern trait. Notable
3466-
/// examples are `&str`, [`char`], and closures that determines the split.
3503+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3504+
/// function or closure that determines if a character matches.
3505+
///
3506+
/// [`char`]: primitive.char.html
3507+
/// [pattern]: str/pattern/index.html
34673508
///
34683509
/// # Iterator behavior
34693510
///
@@ -3512,8 +3553,11 @@ impl str {
35123553
/// If `n` substrings are returned, the last substring (the `n`th substring)
35133554
/// will contain the remainder of the string.
35143555
///
3515-
/// The pattern can be any type that implements the Pattern trait. Notable
3516-
/// examples are `&str`, [`char`], and closures that determines the split.
3556+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3557+
/// function or closure that determines if a character matches.
3558+
///
3559+
/// [`char`]: primitive.char.html
3560+
/// [pattern]: str/pattern/index.html
35173561
///
35183562
/// # Iterator behavior
35193563
///
@@ -3557,8 +3601,11 @@ impl str {
35573601
/// An iterator over the disjoint matches of a pattern within the given string
35583602
/// slice.
35593603
///
3560-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
3561-
/// a character matches.
3604+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3605+
/// function or closure that determines if a character matches.
3606+
///
3607+
/// [`char`]: primitive.char.html
3608+
/// [pattern]: str/pattern/index.html
35623609
///
35633610
/// # Iterator behavior
35643611
///
@@ -3593,8 +3640,11 @@ impl str {
35933640
/// An iterator over the disjoint matches of a pattern within this string slice,
35943641
/// yielded in reverse order.
35953642
///
3596-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
3597-
/// a character matches.
3643+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3644+
/// function or closure that determines if a character matches.
3645+
///
3646+
/// [`char`]: primitive.char.html
3647+
/// [pattern]: str/pattern/index.html
35983648
///
35993649
/// # Iterator behavior
36003650
///
@@ -3634,8 +3684,11 @@ impl str {
36343684
/// For matches of `pat` within `self` that overlap, only the indices
36353685
/// corresponding to the first match are returned.
36363686
///
3637-
/// The pattern can be a `&str`, [`char`], or a closure that determines
3638-
/// if a character matches.
3687+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3688+
/// function or closure that determines if a character matches.
3689+
///
3690+
/// [`char`]: primitive.char.html
3691+
/// [pattern]: str/pattern/index.html
36393692
///
36403693
/// # Iterator behavior
36413694
///
@@ -3676,8 +3729,11 @@ impl str {
36763729
/// For matches of `pat` within `self` that overlap, only the indices
36773730
/// corresponding to the last match are returned.
36783731
///
3679-
/// The pattern can be a `&str`, [`char`], or a closure that determines if a
3680-
/// character matches.
3732+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
3733+
/// function or closure that determines if a character matches.
3734+
///
3735+
/// [`char`]: primitive.char.html
3736+
/// [pattern]: str/pattern/index.html
36813737
///
36823738
/// # Iterator behavior
36833739
///
@@ -3894,8 +3950,11 @@ impl str {
38943950
/// Returns a string slice with all prefixes and suffixes that match a
38953951
/// pattern repeatedly removed.
38963952
///
3897-
/// The pattern can be a [`char`] or a closure that determines if a
3898-
/// character matches.
3953+
/// The [pattern] can be a [`char`], a slice of [`char`]s, or a function
3954+
/// or closure that determines if a character matches.
3955+
///
3956+
/// [`char`]: primitive.char.html
3957+
/// [pattern]: str/pattern/index.html
38993958
///
39003959
/// # Examples
39013960
///
@@ -3939,8 +3998,11 @@ impl str {
39393998
/// Returns a string slice with all prefixes that match a pattern
39403999
/// repeatedly removed.
39414000
///
3942-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
3943-
/// a character matches.
4001+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4002+
/// function or closure that determines if a character matches.
4003+
///
4004+
/// [`char`]: primitive.char.html
4005+
/// [pattern]: str/pattern/index.html
39444006
///
39454007
/// # Text directionality
39464008
///
@@ -3981,6 +4043,12 @@ impl str {
39814043
///
39824044
/// If the string does not start with `prefix`, `None` is returned.
39834045
///
4046+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4047+
/// function or closure that determines if a character matches.
4048+
///
4049+
/// [`char`]: primitive.char.html
4050+
/// [pattern]: str/pattern/index.html
4051+
///
39844052
/// # Examples
39854053
///
39864054
/// ```
@@ -4005,6 +4073,12 @@ impl str {
40054073
///
40064074
/// If the string does not end with `suffix`, `None` is returned.
40074075
///
4076+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4077+
/// function or closure that determines if a character matches.
4078+
///
4079+
/// [`char`]: primitive.char.html
4080+
/// [pattern]: str/pattern/index.html
4081+
///
40084082
/// # Examples
40094083
///
40104084
/// ```
@@ -4027,8 +4101,11 @@ impl str {
40274101
/// Returns a string slice with all suffixes that match a pattern
40284102
/// repeatedly removed.
40294103
///
4030-
/// The pattern can be a `&str`, [`char`], or a closure that
4031-
/// determines if a character matches.
4104+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4105+
/// function or closure that determines if a character matches.
4106+
///
4107+
/// [`char`]: primitive.char.html
4108+
/// [pattern]: str/pattern/index.html
40324109
///
40334110
/// # Text directionality
40344111
///
@@ -4073,10 +4150,11 @@ impl str {
40734150
/// Returns a string slice with all prefixes that match a pattern
40744151
/// repeatedly removed.
40754152
///
4076-
/// The pattern can be a `&str`, [`char`], or a closure that determines if
4077-
/// a character matches.
4153+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4154+
/// function or closure that determines if a character matches.
40784155
///
40794156
/// [`char`]: primitive.char.html
4157+
/// [pattern]: str/pattern/index.html
40804158
///
40814159
/// # Text directionality
40824160
///
@@ -4109,10 +4187,11 @@ impl str {
41094187
/// Returns a string slice with all suffixes that match a pattern
41104188
/// repeatedly removed.
41114189
///
4112-
/// The pattern can be a `&str`, [`char`], or a closure that
4113-
/// determines if a character matches.
4190+
/// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
4191+
/// function or closure that determines if a character matches.
41144192
///
41154193
/// [`char`]: primitive.char.html
4194+
/// [pattern]: str/pattern/index.html
41164195
///
41174196
/// # Text directionality
41184197
///

Diff for: ‎src/libcore/str/pattern.rs

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
11
//! The string Pattern API.
22
//!
3+
//! The Pattern API provides a generic mechanism for using different pattern
4+
//! types when searching through a string.
5+
//!
36
//! For more details, see the traits [`Pattern`], [`Searcher`],
47
//! [`ReverseSearcher`], and [`DoubleEndedSearcher`].
8+
//!
9+
//! Although this API is unstable, it is exposed via stable APIs on the
10+
//! [`str`] type.
11+
//!
12+
//! # Examples
13+
//!
14+
//! [`Pattern`] is [implemented][pattern-impls] in the stable API for
15+
//! [`&str`], [`char`], slices of [`char`], and functions and closures
16+
//! implementing `FnMut(char) -> bool`.
17+
//!
18+
//! ```
19+
//! let s = "Can you find a needle in a haystack?";
20+
//!
21+
//! // &str pattern
22+
//! assert_eq!(s.find("you"), Some(4));
23+
//! // char pattern
24+
//! assert_eq!(s.find('n'), Some(2));
25+
//! // slice of chars pattern
26+
//! assert_eq!(s.find(&['a', 'e', 'i', 'o', 'u'][..]), Some(1));
27+
//! // closure pattern
28+
//! assert_eq!(s.find(|c: char| c.is_ascii_punctuation()), Some(35));
29+
//! ```
30+
//!
31+
//! [`&str`]: ../../../std/primitive.str.html
32+
//! [`char`]: ../../../std/primitive.char.html
33+
//! [`str`]: ../../../std/primitive.str.html
34+
//! [`DoubleEndedSearcher`]: trait.DoubleEndedSearcher.html
35+
//! [`Pattern`]: trait.Pattern.html
36+
//! [`ReverseSearcher`]: trait.ReverseSearcher.html
37+
//! [`Searcher`]: trait.Searcher.html
38+
//! [pattern-impls]: trait.Pattern.html#implementors
539
640
#![unstable(
741
feature = "pattern",
@@ -702,7 +736,7 @@ unsafe impl<'a, 'b> ReverseSearcher<'a> for CharSliceSearcher<'a, 'b> {
702736

703737
impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b> {}
704738

705-
/// Searches for chars that are equal to any of the chars in the array.
739+
/// Searches for chars that are equal to any of the chars in the slice.
706740
///
707741
/// # Examples
708742
///

Diff for: ‎src/librustc_ast/ast.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2211,14 +2211,14 @@ rustc_index::newtype_index! {
22112211
}
22122212

22132213
impl rustc_serialize::Encodable for AttrId {
2214-
fn encode<S: Encoder>(&self, _: &mut S) -> Result<(), S::Error> {
2215-
Ok(())
2214+
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
2215+
s.emit_unit()
22162216
}
22172217
}
22182218

22192219
impl rustc_serialize::Decodable for AttrId {
2220-
fn decode<D: Decoder>(_: &mut D) -> Result<AttrId, D::Error> {
2221-
Ok(crate::attr::mk_attr_id())
2220+
fn decode<D: Decoder>(d: &mut D) -> Result<AttrId, D::Error> {
2221+
d.read_nil().map(|_| crate::attr::mk_attr_id())
22222222
}
22232223
}
22242224

Diff for: ‎src/librustc_typeck/check/demand.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
222222
let mut methods =
223223
self.probe_for_return_type(span, probe::Mode::MethodCall, expected, checked_ty, hir_id);
224224
methods.retain(|m| {
225-
self.has_no_input_arg(m)
225+
self.has_only_self_parameter(m)
226226
&& self
227227
.tcx
228228
.get_attrs(m.def_id)
@@ -243,10 +243,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
243243
methods
244244
}
245245

246-
// This function checks if the method isn't static and takes other arguments than `self`.
247-
fn has_no_input_arg(&self, method: &AssocItem) -> bool {
246+
/// This function checks whether the method is not static and does not accept other parameters than `self`.
247+
fn has_only_self_parameter(&self, method: &AssocItem) -> bool {
248248
match method.kind {
249-
ty::AssocKind::Fn => self.tcx.fn_sig(method.def_id).inputs().skip_binder().len() == 1,
249+
ty::AssocKind::Fn => {
250+
method.fn_has_self_parameter
251+
&& self.tcx.fn_sig(method.def_id).inputs().skip_binder().len() == 1
252+
}
250253
_ => false,
251254
}
252255
}

Diff for: ‎src/librustdoc/html/render.rs

+35-4
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,37 @@ themePicker.onblur = handleThemeButtonsBlur;
789789
Ok((ret, krates))
790790
}
791791

792+
fn collect_json(path: &Path, krate: &str) -> io::Result<(Vec<String>, Vec<String>)> {
793+
let mut ret = Vec::new();
794+
let mut krates = Vec::new();
795+
796+
if path.exists() {
797+
for line in BufReader::new(File::open(path)?).lines() {
798+
let line = line?;
799+
if !line.starts_with("\"") {
800+
continue;
801+
}
802+
if line.starts_with(&format!("\"{}\"", krate)) {
803+
continue;
804+
}
805+
if line.ends_with(",\\") {
806+
ret.push(line[..line.len() - 2].to_string());
807+
} else {
808+
// Ends with "\\" (it's the case for the last added crate line)
809+
ret.push(line[..line.len() - 1].to_string());
810+
}
811+
krates.push(
812+
line.split('"')
813+
.filter(|s| !s.is_empty())
814+
.next()
815+
.map(|s| s.to_owned())
816+
.unwrap_or_else(String::new),
817+
);
818+
}
819+
}
820+
Ok((ret, krates))
821+
}
822+
792823
fn show_item(item: &IndexItem, krate: &str) -> String {
793824
format!(
794825
"{{'crate':'{}','ty':{},'name':'{}','desc':'{}','p':'{}'{}}}",
@@ -909,18 +940,18 @@ themePicker.onblur = handleThemeButtonsBlur;
909940

910941
// Update the search index
911942
let dst = cx.dst.join(&format!("search-index{}.js", cx.shared.resource_suffix));
912-
let (mut all_indexes, mut krates) = try_err!(collect(&dst, &krate.name, "searchIndex"), &dst);
943+
let (mut all_indexes, mut krates) = try_err!(collect_json(&dst, &krate.name), &dst);
913944
all_indexes.push(search_index);
914945

915946
// Sort the indexes by crate so the file will be generated identically even
916947
// with rustdoc running in parallel.
917948
all_indexes.sort();
918949
{
919-
let mut v = String::from("var searchIndex={};\n");
920-
v.push_str(&all_indexes.join("\n"));
950+
let mut v = String::from("var searchIndex = JSON.parse('{\\\n");
951+
v.push_str(&all_indexes.join(",\\\n"));
921952
// "addSearchOptions" has to be called first so the crate filtering can be set before the
922953
// search might start (if it's set into the URL for example).
923-
v.push_str("\naddSearchOptions(searchIndex);initSearch(searchIndex);");
954+
v.push_str("\\\n}');\naddSearchOptions(searchIndex);initSearch(searchIndex);");
924955
cx.shared.fs.write(&dst, &v)?;
925956
}
926957
if options.enable_index_page {

Diff for: ‎src/librustdoc/html/render/cache.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -634,14 +634,19 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
634634

635635
// Collect the index into a string
636636
format!(
637-
r#"searchIndex["{}"] = {};"#,
637+
r#""{}":{}"#,
638638
krate.name,
639639
serde_json::to_string(&CrateData {
640640
doc: crate_doc,
641641
items: crate_items,
642642
paths: crate_paths,
643643
})
644644
.expect("failed serde conversion")
645+
// All these `replace` calls are because we have to go through JS string for JSON content.
646+
.replace(r"\", r"\\")
647+
.replace("'", r"\'")
648+
// We need to escape double quotes for the JSON.
649+
.replace("\\\"", "\\\\\"")
645650
)
646651
}
647652

Diff for: ‎src/libstd/path.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,6 @@ impl PathBuf {
11161116
/// # Examples
11171117
///
11181118
/// ```
1119-
/// #![feature(path_buf_capacity)]
11201119
/// use std::path::PathBuf;
11211120
///
11221121
/// let mut path = PathBuf::with_capacity(10);
@@ -1130,7 +1129,7 @@ impl PathBuf {
11301129
///
11311130
/// [`with_capacity`]: ../ffi/struct.OsString.html#method.with_capacity
11321131
/// [`OsString`]: ../ffi/struct.OsString.html
1133-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1132+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
11341133
pub fn with_capacity(capacity: usize) -> PathBuf {
11351134
PathBuf { inner: OsString::with_capacity(capacity) }
11361135
}
@@ -1374,7 +1373,7 @@ impl PathBuf {
13741373
///
13751374
/// [`capacity`]: ../ffi/struct.OsString.html#method.capacity
13761375
/// [`OsString`]: ../ffi/struct.OsString.html
1377-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1376+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
13781377
pub fn capacity(&self) -> usize {
13791378
self.inner.capacity()
13801379
}
@@ -1383,7 +1382,7 @@ impl PathBuf {
13831382
///
13841383
/// [`clear`]: ../ffi/struct.OsString.html#method.clear
13851384
/// [`OsString`]: ../ffi/struct.OsString.html
1386-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1385+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
13871386
pub fn clear(&mut self) {
13881387
self.inner.clear()
13891388
}
@@ -1392,7 +1391,7 @@ impl PathBuf {
13921391
///
13931392
/// [`reserve`]: ../ffi/struct.OsString.html#method.reserve
13941393
/// [`OsString`]: ../ffi/struct.OsString.html
1395-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1394+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
13961395
pub fn reserve(&mut self, additional: usize) {
13971396
self.inner.reserve(additional)
13981397
}
@@ -1401,7 +1400,7 @@ impl PathBuf {
14011400
///
14021401
/// [`reserve_exact`]: ../ffi/struct.OsString.html#method.reserve_exact
14031402
/// [`OsString`]: ../ffi/struct.OsString.html
1404-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1403+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
14051404
pub fn reserve_exact(&mut self, additional: usize) {
14061405
self.inner.reserve_exact(additional)
14071406
}
@@ -1410,7 +1409,7 @@ impl PathBuf {
14101409
///
14111410
/// [`shrink_to_fit`]: ../ffi/struct.OsString.html#method.shrink_to_fit
14121411
/// [`OsString`]: ../ffi/struct.OsString.html
1413-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1412+
#[stable(feature = "path_buf_capacity", since = "1.44.0")]
14141413
pub fn shrink_to_fit(&mut self) {
14151414
self.inner.shrink_to_fit()
14161415
}
@@ -1419,7 +1418,7 @@ impl PathBuf {
14191418
///
14201419
/// [`shrink_to`]: ../ffi/struct.OsString.html#method.shrink_to
14211420
/// [`OsString`]: ../ffi/struct.OsString.html
1422-
#[unstable(feature = "path_buf_capacity", issue = "58234")]
1421+
#[unstable(feature = "shrink_to", issue = "56431")]
14231422
pub fn shrink_to(&mut self, min_capacity: usize) {
14241423
self.inner.shrink_to(min_capacity)
14251424
}

Diff for: ‎src/test/ui/ast-json/ast-json-noexpand-output.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Check that AST json printing works.
2+
#![crate_type = "lib"]
3+
4+
// check-pass
5+
// compile-flags: -Zast-json-noexpand
6+
// normalize-stdout-test ":\d+" -> ":0"
7+
8+
// Only include a single item to reduce how often the test output needs
9+
// updating.
10+
extern crate core;

Diff for: ‎src/test/ui/ast-json/ast-json-noexpand-output.stdout

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"module":{"inner":{"lo":0,"hi":0},"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"node":"Inherited","span":{"lo":0,"hi":0}},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":{"_field0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["extern",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["core",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":"Semi","span":{"lo":0,"hi":0}}]},"NonJoint"]]}}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}]},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"_field0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"NonJoint"]]}]}}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]}

Diff for: ‎src/test/ui/ast-json/ast-json-output.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Check that AST json printing works.
2+
#![crate_type = "lib"]
23

34
// check-pass
4-
// compile-flags: -Zast-json-noexpand
5+
// compile-flags: -Zast-json
56
// normalize-stdout-test ":\d+" -> ":0"
67

78
// Only include a single item to reduce how often the test output needs

Diff for: ‎src/test/ui/ast-json/ast-json-output.stdout

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"module":{"inner":{"lo":0,"hi":0},"items":[{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"node":"Inherited","span":{"lo":0,"hi":0}},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":{"_field0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["extern",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["core",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":"Semi","span":{"lo":0,"hi":0}}]},"NonJoint"]]}}],"inline":true},"attrs":[],"span":{"lo":0,"hi":0},"proc_macros":[]}
1+
{"module":{"inner":{"lo":0,"hi":0},"items":[{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"prelude_import","span":{"lo":0,"hi":0}},"id":0,"args":null}]},"args":"Empty"}]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"node":"Inherited","span":{"lo":0,"hi":0}},"ident":{"name":"","span":{"lo":0,"hi":0}},"kind":{"variant":"Use","fields":[{"prefix":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"{{root}}","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"std","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"prelude","span":{"lo":0,"hi":0}},"id":0,"args":null},{"ident":{"name":"v1","span":{"lo":0,"hi":0}},"id":0,"args":null}]},"kind":"Glob","span":{"lo":0,"hi":0}}]},"tokens":null},{"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"macro_use","span":{"lo":0,"hi":0}},"id":0,"args":null}]},"args":"Empty"}]},"id":null,"style":"Outer","span":{"lo":0,"hi":0}}],"id":0,"span":{"lo":0,"hi":0},"vis":{"node":"Inherited","span":{"lo":0,"hi":0}},"ident":{"name":"std","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":null},{"attrs":[],"id":0,"span":{"lo":0,"hi":0},"vis":{"node":"Inherited","span":{"lo":0,"hi":0}},"ident":{"name":"core","span":{"lo":0,"hi":0}},"kind":{"variant":"ExternCrate","fields":[null]},"tokens":{"_field0":[[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["extern",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["crate",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":{"variant":"Ident","fields":["core",false]},"span":{"lo":0,"hi":0}}]},"NonJoint"],[{"variant":"Token","fields":[{"kind":"Semi","span":{"lo":0,"hi":0}}]},"NonJoint"]]}}],"inline":true},"attrs":[{"kind":{"variant":"Normal","fields":[{"path":{"span":{"lo":0,"hi":0},"segments":[{"ident":{"name":"crate_type","span":{"lo":0,"hi":0}},"id":0,"args":null}]},"args":{"variant":"Eq","fields":[{"lo":0,"hi":0},{"_field0":[[{"variant":"Token","fields":[{"kind":{"variant":"Literal","fields":[{"kind":"Str","symbol":"lib","suffix":null}]},"span":{"lo":0,"hi":0}}]},"NonJoint"]]}]}}]},"id":null,"style":"Inner","span":{"lo":0,"hi":0}}],"span":{"lo":0,"hi":0},"proc_macros":[]}

0 commit comments

Comments
 (0)
Please sign in to comment.