Skip to content

Commit 2f5ae25

Browse files
committed
Auto merge of #45513 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #45361, #45461, #45465, #45486, #45502 - Failed merges:
2 parents f764eaf + 94c8618 commit 2f5ae25

File tree

5 files changed

+257
-3
lines changed

5 files changed

+257
-3
lines changed

src/bootstrap/native.rs

+1
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ impl Step for Openssl {
446446
"powerpc64-unknown-linux-gnu" => "linux-ppc64",
447447
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
448448
"s390x-unknown-linux-gnu" => "linux64-s390x",
449+
"sparc64-unknown-linux-gnu" => "linux64-sparcv9",
449450
"sparc64-unknown-netbsd" => "BSD-sparc64",
450451
"x86_64-apple-darwin" => "darwin64-x86_64-cc",
451452
"x86_64-linux-android" => "linux-x86_64",

src/libcore/intrinsics.rs

+7
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ extern "rust-intrinsic" {
676676
pub fn min_align_of<T>() -> usize;
677677
pub fn pref_align_of<T>() -> usize;
678678

679+
/// The size of the referenced value in bytes.
680+
///
681+
/// The stabilized version of this intrinsic is
682+
/// [`std::mem::size_of_val`](../../std/mem/fn.size_of_val.html).
679683
pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
680684
pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
681685

@@ -921,6 +925,9 @@ extern "rust-intrinsic" {
921925
///
922926
/// If the actual type neither requires drop glue nor implements
923927
/// `Copy`, then may return `true` or `false`.
928+
///
929+
/// The stabilized version of this intrinsic is
930+
/// [`std::mem::needs_drop`](../../std/mem/fn.needs_drop.html).
924931
pub fn needs_drop<T>() -> bool;
925932

926933
/// Calculates the offset from a pointer.

src/librustc_errors/diagnostic.rs

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ impl Diagnostic {
229229
/// "try adding parentheses: `(tup.0).1`"
230230
///
231231
/// The message
232+
///
232233
/// * should not end in any punctuation (a `:` is added automatically)
233234
/// * should not be a question
234235
/// * should not contain any parts like "the following", "as shown"
@@ -248,6 +249,7 @@ impl Diagnostic {
248249
self
249250
}
250251

252+
/// Prints out a message with multiple suggested edits of the code.
251253
pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec<String>) -> &mut Self {
252254
self.suggestions.push(CodeSuggestion {
253255
substitution_parts: vec![Substitution {

src/librustdoc/html/static/rustdoc.css

+6-2
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,8 @@ span.since {
820820
width: 100%;
821821
}
822822

823-
.content .out-of-band {
824-
display: none;
823+
.content h4 > .out-of-band {
824+
position: inherit;
825825
}
826826

827827
.toggle-wrapper > .collapse-toggle {
@@ -835,6 +835,10 @@ span.since {
835835
#search {
836836
margin-left: 0;
837837
}
838+
839+
.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant {
840+
display: flex;
841+
}
838842
}
839843

840844
@media print {

src/libstd/os/linux/fs.rs

+241-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,25 @@ pub trait MetadataExt {
2424
/// Gain a reference to the underlying `stat` structure which contains
2525
/// the raw information returned by the OS.
2626
///
27-
/// The contents of the returned `stat` are **not** consistent across
27+
/// The contents of the returned [`stat`] are **not** consistent across
2828
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
2929
/// cross-Unix abstractions contained within the raw stat.
30+
///
31+
/// [`stat`]: ../../../../std/os/linux/raw/struct.stat.html
32+
///
33+
/// # Examples
34+
///
35+
/// ```
36+
/// use std::fs;
37+
/// use std::os::linux::fs::MetadataExt;
38+
///
39+
/// # use std::io;
40+
/// # fn f() -> io::Result<()> {
41+
/// let meta = fs::metadata("some_file")?;
42+
/// let stat = meta.as_raw_stat();
43+
/// # Ok(())
44+
/// # }
45+
/// ```
3046
#[stable(feature = "metadata_ext", since = "1.1.0")]
3147
#[rustc_deprecated(since = "1.8.0",
3248
reason = "deprecated in favor of the accessor \
@@ -35,54 +51,278 @@ pub trait MetadataExt {
3551
fn as_raw_stat(&self) -> &raw::stat;
3652

3753
/// Returns the device ID on which this file resides.
54+
///
55+
/// # Examples
56+
///
57+
/// ```
58+
/// use std::fs;
59+
/// use std::os::linux::fs::MetadataExt;
60+
///
61+
/// # use std::io;
62+
/// # fn f() -> io::Result<()> {
63+
/// let meta = fs::metadata("some_file")?;
64+
/// println!("{}", meta.st_dev());
65+
/// # Ok(())
66+
/// # }
67+
/// ```
3868
#[stable(feature = "metadata_ext2", since = "1.8.0")]
3969
fn st_dev(&self) -> u64;
4070
/// Returns the inode number.
71+
///
72+
/// # Examples
73+
///
74+
/// ```
75+
/// use std::fs;
76+
/// use std::os::linux::fs::MetadataExt;
77+
///
78+
/// # use std::io;
79+
/// # fn f() -> io::Result<()> {
80+
/// let meta = fs::metadata("some_file")?;
81+
/// println!("{}", meta.st_ino());
82+
/// # Ok(())
83+
/// # }
84+
/// ```
4185
#[stable(feature = "metadata_ext2", since = "1.8.0")]
4286
fn st_ino(&self) -> u64;
4387
/// Returns the file type and mode.
88+
///
89+
/// # Examples
90+
///
91+
/// ```
92+
/// use std::fs;
93+
/// use std::os::linux::fs::MetadataExt;
94+
///
95+
/// # use std::io;
96+
/// # fn f() -> io::Result<()> {
97+
/// let meta = fs::metadata("some_file")?;
98+
/// println!("{}", meta.st_mode());
99+
/// # Ok(())
100+
/// # }
101+
/// ```
44102
#[stable(feature = "metadata_ext2", since = "1.8.0")]
45103
fn st_mode(&self) -> u32;
46104
/// Returns the number of hard links to file.
105+
///
106+
/// # Examples
107+
///
108+
/// ```
109+
/// use std::fs;
110+
/// use std::os::linux::fs::MetadataExt;
111+
///
112+
/// # use std::io;
113+
/// # fn f() -> io::Result<()> {
114+
/// let meta = fs::metadata("some_file")?;
115+
/// println!("{}", meta.st_nlink());
116+
/// # Ok(())
117+
/// # }
118+
/// ```
47119
#[stable(feature = "metadata_ext2", since = "1.8.0")]
48120
fn st_nlink(&self) -> u64;
49121
/// Returns the user ID of the file owner.
122+
///
123+
/// # Examples
124+
///
125+
/// ```
126+
/// use std::fs;
127+
/// use std::os::linux::fs::MetadataExt;
128+
///
129+
/// # use std::io;
130+
/// # fn f() -> io::Result<()> {
131+
/// let meta = fs::metadata("some_file")?;
132+
/// println!("{}", meta.st_uid());
133+
/// # Ok(())
134+
/// # }
135+
/// ```
50136
#[stable(feature = "metadata_ext2", since = "1.8.0")]
51137
fn st_uid(&self) -> u32;
52138
/// Returns the group ID of the file owner.
139+
///
140+
/// # Examples
141+
///
142+
/// ```
143+
/// use std::fs;
144+
/// use std::os::linux::fs::MetadataExt;
145+
///
146+
/// # use std::io;
147+
/// # fn f() -> io::Result<()> {
148+
/// let meta = fs::metadata("some_file")?;
149+
/// println!("{}", meta.st_gid());
150+
/// # Ok(())
151+
/// # }
152+
/// ```
53153
#[stable(feature = "metadata_ext2", since = "1.8.0")]
54154
fn st_gid(&self) -> u32;
55155
/// Returns the device ID that this file represents. Only relevant for special file.
156+
///
157+
/// # Examples
158+
///
159+
/// ```
160+
/// use std::fs;
161+
/// use std::os::linux::fs::MetadataExt;
162+
///
163+
/// # use std::io;
164+
/// # fn f() -> io::Result<()> {
165+
/// let meta = fs::metadata("some_file")?;
166+
/// println!("{}", meta.st_rdev());
167+
/// # Ok(())
168+
/// # }
169+
/// ```
56170
#[stable(feature = "metadata_ext2", since = "1.8.0")]
57171
fn st_rdev(&self) -> u64;
58172
/// Returns the size of the file (if it is a regular file or a symbolic link) in bytes.
59173
///
60174
/// The size of a symbolic link is the length of the pathname it contains,
61175
/// without a terminating null byte.
176+
///
177+
/// # Examples
178+
///
179+
/// ```
180+
/// use std::fs;
181+
/// use std::os::linux::fs::MetadataExt;
182+
///
183+
/// # use std::io;
184+
/// # fn f() -> io::Result<()> {
185+
/// let meta = fs::metadata("some_file")?;
186+
/// println!("{}", meta.st_size());
187+
/// # Ok(())
188+
/// # }
189+
/// ```
62190
#[stable(feature = "metadata_ext2", since = "1.8.0")]
63191
fn st_size(&self) -> u64;
64192
/// Returns the last access time.
193+
///
194+
/// # Examples
195+
///
196+
/// ```
197+
/// use std::fs;
198+
/// use std::os::linux::fs::MetadataExt;
199+
///
200+
/// # use std::io;
201+
/// # fn f() -> io::Result<()> {
202+
/// let meta = fs::metadata("some_file")?;
203+
/// println!("{}", meta.st_atime());
204+
/// # Ok(())
205+
/// # }
206+
/// ```
65207
#[stable(feature = "metadata_ext2", since = "1.8.0")]
66208
fn st_atime(&self) -> i64;
67209
/// Returns the last access time, nano seconds part.
210+
///
211+
/// # Examples
212+
///
213+
/// ```
214+
/// use std::fs;
215+
/// use std::os::linux::fs::MetadataExt;
216+
///
217+
/// # use std::io;
218+
/// # fn f() -> io::Result<()> {
219+
/// let meta = fs::metadata("some_file")?;
220+
/// println!("{}", meta.st_atime_nsec());
221+
/// # Ok(())
222+
/// # }
223+
/// ```
68224
#[stable(feature = "metadata_ext2", since = "1.8.0")]
69225
fn st_atime_nsec(&self) -> i64;
70226
/// Returns the last modification time.
227+
///
228+
/// # Examples
229+
///
230+
/// ```
231+
/// use std::fs;
232+
/// use std::os::linux::fs::MetadataExt;
233+
///
234+
/// # use std::io;
235+
/// # fn f() -> io::Result<()> {
236+
/// let meta = fs::metadata("some_file")?;
237+
/// println!("{}", meta.st_mtime());
238+
/// # Ok(())
239+
/// # }
240+
/// ```
71241
#[stable(feature = "metadata_ext2", since = "1.8.0")]
72242
fn st_mtime(&self) -> i64;
73243
/// Returns the last modification time, nano seconds part.
244+
///
245+
/// # Examples
246+
///
247+
/// ```
248+
/// use std::fs;
249+
/// use std::os::linux::fs::MetadataExt;
250+
///
251+
/// # use std::io;
252+
/// # fn f() -> io::Result<()> {
253+
/// let meta = fs::metadata("some_file")?;
254+
/// println!("{}", meta.st_mtime_nsec());
255+
/// # Ok(())
256+
/// # }
257+
/// ```
74258
#[stable(feature = "metadata_ext2", since = "1.8.0")]
75259
fn st_mtime_nsec(&self) -> i64;
76260
/// Returns the last status change time.
261+
///
262+
/// # Examples
263+
///
264+
/// ```
265+
/// use std::fs;
266+
/// use std::os::linux::fs::MetadataExt;
267+
///
268+
/// # use std::io;
269+
/// # fn f() -> io::Result<()> {
270+
/// let meta = fs::metadata("some_file")?;
271+
/// println!("{}", meta.st_ctime());
272+
/// # Ok(())
273+
/// # }
274+
/// ```
77275
#[stable(feature = "metadata_ext2", since = "1.8.0")]
78276
fn st_ctime(&self) -> i64;
79277
/// Returns the last status change time, nano seconds part.
278+
///
279+
/// # Examples
280+
///
281+
/// ```
282+
/// use std::fs;
283+
/// use std::os::linux::fs::MetadataExt;
284+
///
285+
/// # use std::io;
286+
/// # fn f() -> io::Result<()> {
287+
/// let meta = fs::metadata("some_file")?;
288+
/// println!("{}", meta.st_ctime_nsec());
289+
/// # Ok(())
290+
/// # }
291+
/// ```
80292
#[stable(feature = "metadata_ext2", since = "1.8.0")]
81293
fn st_ctime_nsec(&self) -> i64;
82294
/// Returns the "preferred" blocksize for efficient filesystem I/O.
295+
///
296+
/// # Examples
297+
///
298+
/// ```
299+
/// use std::fs;
300+
/// use std::os::linux::fs::MetadataExt;
301+
///
302+
/// # use std::io;
303+
/// # fn f() -> io::Result<()> {
304+
/// let meta = fs::metadata("some_file")?;
305+
/// println!("{}", meta.st_blksize());
306+
/// # Ok(())
307+
/// # }
308+
/// ```
83309
#[stable(feature = "metadata_ext2", since = "1.8.0")]
84310
fn st_blksize(&self) -> u64;
85311
/// Returns the number of blocks allocated to the file, 512-byte units.
312+
///
313+
/// # Examples
314+
///
315+
/// ```
316+
/// use std::fs;
317+
/// use std::os::linux::fs::MetadataExt;
318+
///
319+
/// # use std::io;
320+
/// # fn f() -> io::Result<()> {
321+
/// let meta = fs::metadata("some_file")?;
322+
/// println!("{}", meta.st_blocks());
323+
/// # Ok(())
324+
/// # }
325+
/// ```
86326
#[stable(feature = "metadata_ext2", since = "1.8.0")]
87327
fn st_blocks(&self) -> u64;
88328
}

0 commit comments

Comments
 (0)