Skip to content

Commit 6f8b325

Browse files
committed
Auto merge of #45233 - kennytm:rollup, r=<try>
[WIP] Rollup of 10 pull requests - Successful merges: #44989, #45005, #45049, #45105, #45121, #45163, #45166, #45172, #45190, #45231 - Failed merges: #45138
2 parents 1807f27 + 14546f1 commit 6f8b325

32 files changed

+243
-76
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ matrix:
1313
include:
1414
# Images used in testing PR and try-build should be run first.
1515
- env: IMAGE=x86_64-gnu-llvm-3.7 RUST_BACKTRACE=1
16-
if: type = pull_request OR branch = auto
16+
if: type = pull_request AND branch = auto
1717

1818
- env: IMAGE=dist-x86_64-linux DEPLOY=1
19-
if: branch = try OR branch = auto
19+
if: branch = auto OR branch = auto
2020

2121
# "alternate" deployments, these are "nightlies" but don't have assertions
2222
# turned on, they're deployed to a different location primarily for projects
@@ -110,7 +110,7 @@ matrix:
110110
111111
# Linux builders, remaining docker images
112112
- env: IMAGE=arm-android
113-
if: branch = auto
113+
if: branch = try OR branch = auto
114114
- env: IMAGE=armhf-gnu
115115
if: branch = auto
116116
- env: IMAGE=cross DEPLOY=1

src/Cargo.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/bin/rustdoc.rs

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ fn main() {
4848
cmd.arg("-Z").arg("force-unstable-if-unmarked");
4949
}
5050

51+
// Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
52+
// it up so we can make rustdoc print this into the docs
53+
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
54+
// This "unstable-options" can be removed when `--crate-version` is stabilized
55+
cmd.arg("-Z").arg("unstable-options")
56+
.arg("--crate-version").arg(version);
57+
}
58+
5159
std::process::exit(match cmd.status() {
5260
Ok(s) => s.code().unwrap_or(1),
5361
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),

src/bootstrap/bootstrap.py

+1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def default_build_triple():
302302

303303
return "{}-{}".format(cputype, ostype)
304304

305+
305306
class RustBuild(object):
306307
"""Provide all the methods required to build Rust"""
307308
def __init__(self):

src/bootstrap/builder.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ impl<'a> Builder<'a> {
418418
.env("RUSTC_SYSROOT", self.sysroot(compiler))
419419
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
420420
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
421-
.env("RUSTDOC_REAL", self.rustdoc(host));
421+
.env("RUSTDOC_REAL", self.rustdoc(host))
422+
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
422423
cmd
423424
}
424425

@@ -574,6 +575,9 @@ impl<'a> Builder<'a> {
574575
cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string());
575576
}
576577

578+
// For `cargo doc` invocations, make rustdoc print the Rust version into the docs
579+
cargo.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
580+
577581
// Environment variables *required* throughout the build
578582
//
579583
// FIXME: should update code to not require this env var

src/bootstrap/configure.py

+31-17
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,26 @@
1919
sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
2020
import bootstrap
2121

22+
2223
class Option:
2324
def __init__(self, name, rustbuild, desc, value):
2425
self.name = name
2526
self.rustbuild = rustbuild
2627
self.desc = desc
2728
self.value = value
2829

30+
2931
options = []
3032

33+
3134
def o(*args):
3235
options.append(Option(*args, value=False))
3336

37+
3438
def v(*args):
3539
options.append(Option(*args, value=True))
3640

41+
3742
o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
3843
o("docs", "build.docs", "build standard library documentation")
3944
o("compiler-docs", "build.compiler-docs", "build compiler documentation")
@@ -136,13 +141,16 @@ def v(*args):
136141

137142
v("set", None, "set arbitrary key/value pairs in TOML configuration")
138143

144+
139145
def p(msg):
140146
print("configure: " + msg)
141147

148+
142149
def err(msg):
143150
print("configure: error: " + msg)
144151
sys.exit(1)
145152

153+
146154
if '--help' in sys.argv or '-h' in sys.argv:
147155
print('Usage: ./configure [options]')
148156
print('')
@@ -208,7 +216,7 @@ def err(msg):
208216
continue
209217

210218
found = True
211-
if not option.name in known_args:
219+
if option.name not in known_args:
212220
known_args[option.name] = []
213221
known_args[option.name].append((option, value))
214222
break
@@ -227,27 +235,30 @@ def err(msg):
227235
# TOML we're going to write out
228236
config = {}
229237

238+
230239
def build():
231240
if 'build' in known_args:
232241
return known_args['build'][0][1]
233242
return bootstrap.default_build_triple()
234243

244+
235245
def set(key, value):
236-
s = "{:20} := {}".format(key, value)
237-
if len(s) < 70:
238-
p(s)
239-
else:
240-
p(s[:70] + " ...")
241-
242-
arr = config
243-
parts = key.split('.')
244-
for i, part in enumerate(parts):
245-
if i == len(parts) - 1:
246-
arr[part] = value
247-
else:
248-
if not part in arr:
249-
arr[part] = {}
250-
arr = arr[part]
246+
s = "{:20} := {}".format(key, value)
247+
if len(s) < 70:
248+
p(s)
249+
else:
250+
p(s[:70] + " ...")
251+
252+
arr = config
253+
parts = key.split('.')
254+
for i, part in enumerate(parts):
255+
if i == len(parts) - 1:
256+
arr[part] = value
257+
else:
258+
if part not in arr:
259+
arr[part] = {}
260+
arr = arr[part]
261+
251262

252263
for key in known_args:
253264
# The `set` option is special and can be passed a bunch of times
@@ -345,6 +356,7 @@ def set(key, value):
345356
targets[target] = sections['target'][:]
346357
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
347358

359+
348360
# Here we walk through the constructed configuration we have from the parsed
349361
# command line arguments. We then apply each piece of configuration by
350362
# basically just doing a `sed` to change the various configuration line to what
@@ -362,6 +374,7 @@ def to_toml(value):
362374
else:
363375
raise RuntimeError('no toml')
364376

377+
365378
def configure_section(lines, config):
366379
for key in config:
367380
value = config[key]
@@ -375,9 +388,10 @@ def configure_section(lines, config):
375388
if not found:
376389
raise RuntimeError("failed to find config line for {}".format(key))
377390

391+
378392
for section_key in config:
379393
section_config = config[section_key]
380-
if not section_key in sections:
394+
if section_key not in sections:
381395
raise RuntimeError("config key {} not in sections".format(section_key))
382396

383397
if section_key == 'target':
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# `optin_builtin_traits`
2+
3+
The tracking issue for this feature is [#13231]
4+
5+
[#13231]: https://github.com/rust-lang/rust/issues/13231
6+
7+
----
8+
9+
The `optin_builtin_traits` feature gate allows you to define auto traits.
10+
11+
Auto traits, like [`Send`] or [`Sync`] in the standard library, are marker traits
12+
that are automatically implemented for every type, unless the type, or a type it contains,
13+
has explictly opted out via a negative impl.
14+
15+
[`Send`]: https://doc.rust-lang.org/std/marker/trait.Send.html
16+
[`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html
17+
18+
```rust,ignore
19+
impl !Type for Trait
20+
```
21+
22+
Example:
23+
24+
```rust
25+
#![feature(optin_builtin_traits)]
26+
27+
trait Valid {}
28+
29+
impl Valid for .. {}
30+
31+
struct True;
32+
struct False;
33+
34+
impl !Valid for False {}
35+
36+
struct MaybeValid<T>(T);
37+
38+
fn must_be_valid<T: Valid>(_t: T) { }
39+
40+
fn main() {
41+
// works
42+
must_be_valid( MaybeValid(True) );
43+
44+
// compiler error - trait bound not satisfied
45+
// must_be_valid( MaybeValid(False) );
46+
}
47+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# `unboxed_closures`
2+
3+
The tracking issue for this feature is [#29625]
4+
5+
See Also: [`fn_traits`](library-features/fn-traits.html)
6+
7+
[#29625]: https://github.com/rust-lang/rust/issues/29625
8+
9+
----
10+
11+
The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI,
12+
required for implmenting the [`Fn*`] family of traits. `"rust-call"` functions must have
13+
exactly one (non self) argument, a tuple representing the argument list.
14+
15+
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
16+
17+
```rust
18+
#![feature(unboxed_closures)]
19+
20+
extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
21+
args.0 + args.1
22+
}
23+
24+
fn main() {}
25+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# `fn_traits`
2+
3+
The tracking issue for this feature is [#29625]
4+
5+
See Also: [`unboxed_closures`](language-features/unboxed-closures.html)
6+
7+
[#29625]: https://github.com/rust-lang/rust/issues/29625
8+
9+
----
10+
11+
The `fn_traits` feature allows for implementation of the [`Fn*`] traits
12+
for creating custom closure-like types.
13+
14+
[`Fn*`]: https://doc.rust-lang.org/std/ops/trait.Fn.html
15+
16+
```rust
17+
#![feature(unboxed_closures)]
18+
#![feature(fn_traits)]
19+
20+
struct Adder {
21+
a: u32
22+
}
23+
24+
impl FnOnce<(u32, )> for Adder {
25+
type Output = u32;
26+
extern "rust-call" fn call_once(self, b: (u32, )) -> Self::Output {
27+
self.a + b.0
28+
}
29+
}
30+
31+
fn main() {
32+
let adder = Adder { a: 3 };
33+
assert_eq!(adder(2), 5);
34+
}
35+
```

src/libcore/str/mod.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -1405,16 +1405,6 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> {
14051405
#[allow(deprecated)]
14061406
impl<'a> FusedIterator for LinesAny<'a> {}
14071407

1408-
/*
1409-
Section: Comparing strings
1410-
*/
1411-
1412-
/// Bytewise slice equality
1413-
#[inline]
1414-
fn eq_slice(a: &str, b: &str) -> bool {
1415-
a.as_bytes() == b.as_bytes()
1416-
}
1417-
14181408
/*
14191409
Section: UTF-8 validation
14201410
*/
@@ -1590,7 +1580,6 @@ mod traits {
15901580
use cmp::Ordering;
15911581
use ops;
15921582
use slice::{self, SliceIndex};
1593-
use str::eq_slice;
15941583

15951584
/// Implements ordering of strings.
15961585
///
@@ -1611,7 +1600,7 @@ mod traits {
16111600
impl PartialEq for str {
16121601
#[inline]
16131602
fn eq(&self, other: &str) -> bool {
1614-
eq_slice(self, other)
1603+
self.as_bytes() == other.as_bytes()
16151604
}
16161605
#[inline]
16171606
fn ne(&self, other: &str) -> bool { !(*self).eq(other) }

src/librustc/hir/itemlikevisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use super::intravisit::Visitor;
4141
/// - Example: Lifetime resolution, which wants to bring lifetimes declared on the
4242
/// impl into scope while visiting the impl-items, and then back out again.
4343
/// - How: Implement `intravisit::Visitor` and override the
44-
/// `visit_nested_map()` methods to return
44+
/// `nested_visit_map()` methods to return
4545
/// `NestedVisitorMap::All`. Walk your crate with
4646
/// `intravisit::walk_crate()` invoked on `tcx.hir.krate()`.
4747
/// - Pro: Visitor methods for any kind of HIR node, not just item-like things.

0 commit comments

Comments
 (0)