Skip to content

Commit 55a61a1

Browse files
authored
Auto merge of #36536 - jonathandturner:rollup, r=jonathandturner
Rollup of 8 pull requests - Successful merges: #36383, #36424, #36480, #36484, #36505, #36509, #36519, #36521 - Failed merges:
2 parents c6673db + ab7425d commit 55a61a1

File tree

10 files changed

+332
-168
lines changed

10 files changed

+332
-168
lines changed

src/bootstrap/bootstrap.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,16 @@ def run(self, args, env):
269269
sys.exit(ret)
270270

271271
def build_triple(self):
272+
default_encoding = sys.getdefaultencoding()
272273
config = self.get_toml('build')
273274
if config:
274275
return config
275276
config = self.get_mk('CFG_BUILD')
276277
if config:
277278
return config
278279
try:
279-
ostype = subprocess.check_output(['uname', '-s']).strip()
280-
cputype = subprocess.check_output(['uname', '-m']).strip()
280+
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
281+
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
281282
except (subprocess.CalledProcessError, WindowsError):
282283
if sys.platform == 'win32':
283284
return 'x86_64-pc-windows-msvc'
@@ -289,7 +290,8 @@ def build_triple(self):
289290
# Darwin's `uname -s` lies and always returns i386. We have to use
290291
# sysctl instead.
291292
if ostype == 'Darwin' and cputype == 'i686':
292-
sysctl = subprocess.check_output(['sysctl', 'hw.optional.x86_64'])
293+
args = ['sysctl', 'hw.optional.x86_64']
294+
sysctl = subprocess.check_output(args).decode(default_encoding)
293295
if ': 1' in sysctl:
294296
cputype = 'x86_64'
295297

src/doc/book/traits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ let result = f.write(buf);
291291

292292
We need to `use` the `Write` trait first:
293293

294-
```rust,ignore
294+
```rust,no_run
295295
use std::io::Write;
296296
297297
let mut f = std::fs::File::create("foo.txt").expect("Couldn’t create foo.txt");

src/libcore/convert.rs

+16
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ pub trait AsRef<T: ?Sized> {
9292
/// [`Option<T>`]: ../../std/option/enum.Option.html
9393
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
9494
///
95+
/// # Examples
96+
///
97+
/// [`Box<T>`] implements `AsMut<T>`:
98+
///
99+
/// [`Box<T>`]: ../../std/boxed/struct.Box.html
100+
///
101+
/// ```
102+
/// fn add_one<T: AsMut<u64>>(num: &mut T) {
103+
/// *num.as_mut() += 1;
104+
/// }
105+
///
106+
/// let mut boxed_num = Box::new(0);
107+
/// add_one(&mut boxed_num);
108+
/// assert_eq!(*boxed_num, 1);
109+
/// ```
110+
///
95111
/// # Generic Impls
96112
///
97113
/// - `AsMut` auto-dereferences if the inner type is a reference or a mutable

0 commit comments

Comments
 (0)