Skip to content

Commit 860d169

Browse files
committed
Auto merge of #52014 - pietroalbini:rollup, r=pietroalbini
Rollup of 13 pull requests Successful merges: - #51548 (Initialize LLVM's AMDGPU target machine, if available.) - #51809 (Add read_exact_at and write_all_at methods to FileExt on unix) - #51914 (add outlives annotations to `BTreeMap`) - #51958 (Show known meta items in unknown meta items error) - #51973 (Make Stdio handle UnwindSafe) - #51977 (bootstrap: tests should use rustc from config.toml) - #51978 (Do not suggest changes to str literal if it isn't one) - #51979 (Get rid of `TyImplTraitExistential`) - #51980 (Emit column info in debuginfo for non msvc like targets) - #51982 (incr.comp.: Take names of children into account when computing the ICH of a module's HIR.) - #51997 (add entry for cargo-metadata feature to RELEASES) - #52004 (toolstate: Fixed detection of changed submodule, and other fixes.) - #52006 ( Change --keep-stage to apply more often) Failed merges: r? @ghost
2 parents 64f8ae0 + 492518f commit 860d169

File tree

33 files changed

+1259
-921
lines changed

33 files changed

+1259
-921
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ matrix:
169169
- env: IMAGE=x86_64-gnu-aux
170170
if: branch = auto
171171
- env: IMAGE=x86_64-gnu-tools
172-
if: branch = auto
172+
if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri)\b)/)
173173
- env: IMAGE=x86_64-gnu-debug
174174
if: branch = auto
175175
- env: IMAGE=x86_64-gnu-nopt

RELEASES.md

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Cargo
6565
-----
6666
- [`cargo-metadata` now includes `authors`, `categories`, `keywords`,
6767
`readme`, and `repository` fields.][cargo/5386]
68+
- [`cargo-metadata` now includes a package's `metadata` table.][cargo/5360]
6869
- [Added the `--target-dir` optional argument.][cargo/5393] This allows you to specify
6970
a different directory than `target` for placing compilation artifacts.
7071
- [Cargo will be adding automatic target inference for binaries, benchmarks,
@@ -114,6 +115,7 @@ Compatibility Notes
114115
[cargo/5203]: https://github.com/rust-lang/cargo/pull/5203/
115116
[cargo/5335]: https://github.com/rust-lang/cargo/pull/5335/
116117
[cargo/5359]: https://github.com/rust-lang/cargo/pull/5359/
118+
[cargo/5360]: https://github.com/rust-lang/cargo/pull/5360/
117119
[cargo/5386]: https://github.com/rust-lang/cargo/pull/5386/
118120
[cargo/5393]: https://github.com/rust-lang/cargo/pull/5393/
119121
[`DoubleEndedIterator::rfind`]: https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html#method.rfind

src/bootstrap/bootstrap.py

+2
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ def bootstrap(help_triggered):
816816
env["BOOTSTRAP_PYTHON"] = sys.executable
817817
env["BUILD_DIR"] = build.build_dir
818818
env["RUSTC_BOOTSTRAP"] = '1'
819+
env["CARGO"] = build.cargo()
820+
env["RUSTC"] = build.rustc()
819821
run(args, env=env, verbose=build.verbose)
820822

821823

src/bootstrap/compile.rs

+44-21
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::io::prelude::*;
2424
use std::path::{Path, PathBuf};
2525
use std::process::{Command, Stdio};
2626
use std::str;
27-
use std::cmp::min;
2827

2928
use build_helper::{output, mtime, up_to_date};
3029
use filetime::FileTime;
@@ -68,6 +67,18 @@ impl Step for Std {
6867
let target = self.target;
6968
let compiler = self.compiler;
7069

70+
if let Some(keep_stage) = builder.config.keep_stage {
71+
if keep_stage <= compiler.stage {
72+
println!("Warning: Using a potentially old libstd. This may not behave well.");
73+
builder.ensure(StdLink {
74+
compiler: compiler,
75+
target_compiler: compiler,
76+
target,
77+
});
78+
return;
79+
}
80+
}
81+
7182
builder.ensure(StartupObjects { compiler, target });
7283

7384
if builder.force_use_stage1(compiler, target) {
@@ -351,6 +362,18 @@ impl Step for Test {
351362
let target = self.target;
352363
let compiler = self.compiler;
353364

365+
if let Some(keep_stage) = builder.config.keep_stage {
366+
if keep_stage <= compiler.stage {
367+
println!("Warning: Using a potentially old libtest. This may not behave well.");
368+
builder.ensure(TestLink {
369+
compiler: compiler,
370+
target_compiler: compiler,
371+
target,
372+
});
373+
return;
374+
}
375+
}
376+
354377
builder.ensure(Std { compiler, target });
355378

356379
if builder.force_use_stage1(compiler, target) {
@@ -467,6 +490,18 @@ impl Step for Rustc {
467490
let compiler = self.compiler;
468491
let target = self.target;
469492

493+
if let Some(keep_stage) = builder.config.keep_stage {
494+
if keep_stage <= compiler.stage {
495+
println!("Warning: Using a potentially old librustc. This may not behave well.");
496+
builder.ensure(RustcLink {
497+
compiler: compiler,
498+
target_compiler: compiler,
499+
target,
500+
});
501+
return;
502+
}
503+
}
504+
470505
builder.ensure(Test { compiler, target });
471506

472507
if builder.force_use_stage1(compiler, target) {
@@ -873,7 +908,7 @@ impl Step for Assemble {
873908
type Output = Compiler;
874909

875910
fn should_run(run: ShouldRun) -> ShouldRun {
876-
run.all_krates("rustc-main")
911+
run.never()
877912
}
878913

879914
/// Prepare a new compiler from the artifacts in `stage`
@@ -915,28 +950,16 @@ impl Step for Assemble {
915950
// link to these. (FIXME: Is that correct? It seems to be correct most
916951
// of the time but I think we do link to these for stage2/bin compilers
917952
// when not performing a full bootstrap).
918-
if builder.config.keep_stage.map_or(false, |s| target_compiler.stage <= s) {
919-
builder.verbose("skipping compilation of compiler due to --keep-stage");
920-
let compiler = build_compiler;
921-
for stage in 0..min(target_compiler.stage, builder.config.keep_stage.unwrap()) {
922-
let target_compiler = builder.compiler(stage, target_compiler.host);
923-
let target = target_compiler.host;
924-
builder.ensure(StdLink { compiler, target_compiler, target });
925-
builder.ensure(TestLink { compiler, target_compiler, target });
926-
builder.ensure(RustcLink { compiler, target_compiler, target });
927-
}
928-
} else {
929-
builder.ensure(Rustc {
953+
builder.ensure(Rustc {
954+
compiler: build_compiler,
955+
target: target_compiler.host,
956+
});
957+
for &backend in builder.config.rust_codegen_backends.iter() {
958+
builder.ensure(CodegenBackend {
930959
compiler: build_compiler,
931960
target: target_compiler.host,
961+
backend,
932962
});
933-
for &backend in builder.config.rust_codegen_backends.iter() {
934-
builder.ensure(CodegenBackend {
935-
compiler: build_compiler,
936-
target: target_compiler.host,
937-
backend,
938-
});
939-
}
940963
}
941964

942965
let lld_install = if builder.config.lld_enabled {

src/bootstrap/config.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use std::cmp;
2323

2424
use num_cpus;
2525
use toml;
26-
use util::exe;
2726
use cache::{INTERNER, Interned};
2827
use flags::Flags;
2928
pub use flags::Subcommand;
@@ -367,9 +366,8 @@ impl Config {
367366
config.src = Config::path_from_python("SRC");
368367
config.out = Config::path_from_python("BUILD_DIR");
369368

370-
let stage0_root = config.out.join(&config.build).join("stage0/bin");
371-
config.initial_rustc = stage0_root.join(exe("rustc", &config.build));
372-
config.initial_cargo = stage0_root.join(exe("cargo", &config.build));
369+
config.initial_rustc = Config::path_from_python("RUSTC");
370+
config.initial_cargo = Config::path_from_python("CARGO");
373371

374372
config
375373
}

src/bootstrap/test.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1269,17 +1269,15 @@ impl Step for DocTest {
12691269

12701270
files.sort();
12711271

1272+
let mut toolstate = ToolState::TestPass;
12721273
for file in files {
1273-
let test_result = markdown_test(builder, compiler, &file);
1274-
if self.is_ext_doc {
1275-
let toolstate = if test_result {
1276-
ToolState::TestPass
1277-
} else {
1278-
ToolState::TestFail
1279-
};
1280-
builder.save_toolstate(self.name, toolstate);
1274+
if !markdown_test(builder, compiler, &file) {
1275+
toolstate = ToolState::TestFail;
12811276
}
12821277
}
1278+
if self.is_ext_doc {
1279+
builder.save_toolstate(self.name, toolstate);
1280+
}
12831281
}
12841282
}
12851283

src/ci/docker/x86_64-gnu-tools/checktools.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ status_check() {
7979
check_dispatch $1 beta nomicon src/doc/nomicon
8080
check_dispatch $1 beta reference src/doc/reference
8181
check_dispatch $1 beta rust-by-example src/doc/rust-by-example
82-
check_dispatch $1 beta rls src/tool/rls
83-
check_dispatch $1 beta rustfmt src/tool/rustfmt
82+
check_dispatch $1 beta rls src/tools/rls
83+
check_dispatch $1 beta rustfmt src/tools/rustfmt
8484
# these tools are not required for beta to successfully branch
85-
check_dispatch $1 nightly clippy-driver src/tool/clippy
86-
check_dispatch $1 nightly miri src/tool/miri
85+
check_dispatch $1 nightly clippy-driver src/tools/clippy
86+
check_dispatch $1 nightly miri src/tools/miri
8787
}
8888

8989
# If this PR is intended to update one of these tools, do not let the build pass

src/liballoc/collections/btree/map.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,11 @@ unsafe impl<#[may_dangle] K, #[may_dangle] V> Drop for BTreeMap<K, V> {
149149
#[stable(feature = "rust1", since = "1.0.0")]
150150
impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
151151
fn clone(&self) -> BTreeMap<K, V> {
152-
fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153-
K,
154-
V,
155-
marker::LeafOrInternal>)
156-
-> BTreeMap<K, V> {
157-
152+
fn clone_subtree<'a, K: Clone, V: Clone>(
153+
node: node::NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
154+
) -> BTreeMap<K, V>
155+
where K: 'a, V: 'a,
156+
{
158157
match node.force() {
159158
Leaf(leaf) => {
160159
let mut out_tree = BTreeMap {
@@ -1080,7 +1079,11 @@ impl<K: Ord, V> BTreeMap<K, V> {
10801079

10811080
/// Calculates the number of elements if it is incorrect.
10821081
fn recalc_length(&mut self) {
1083-
fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
1082+
fn dfs<'a, K, V>(
1083+
node: NodeRef<marker::Immut<'a>, K, V, marker::LeafOrInternal>
1084+
) -> usize
1085+
where K: 'a, V: 'a
1086+
{
10841087
let mut res = node.len();
10851088

10861089
if let Internal(node) = node.force() {

src/librustc/hir/intravisit.rs

-7
Original file line numberDiff line numberDiff line change
@@ -607,13 +607,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
607607
}
608608
visitor.visit_lifetime(lifetime);
609609
}
610-
TyImplTraitExistential(_, def_id, ref lifetimes) => {
611-
// we are not recursing into the `existential` item, because it is already being visited
612-
// as part of the surrounding module. The `NodeId` just exists so we don't have to look
613-
// it up everywhere else in the compiler
614-
visitor.visit_def_mention(Def::Existential(def_id));
615-
walk_list!(visitor, visit_lifetime, lifetimes);
616-
}
617610
TyTypeof(ref expression) => {
618611
visitor.visit_anon_const(expression)
619612
}

src/librustc/hir/lowering.rs

+18-11
Original file line numberDiff line numberDiff line change
@@ -1306,13 +1306,20 @@ impl<'a> LoweringContext<'a> {
13061306
lctx.items.insert(exist_ty_id.node_id, exist_ty_item);
13071307

13081308
// `impl Trait` now just becomes `Foo<'a, 'b, ..>`
1309-
hir::TyImplTraitExistential(
1310-
hir::ItemId {
1311-
id: exist_ty_id.node_id
1312-
},
1313-
DefId::local(exist_ty_def_index),
1314-
lifetimes,
1315-
)
1309+
let path = P(hir::Path {
1310+
span: exist_ty_span,
1311+
def: Def::Existential(DefId::local(exist_ty_def_index)),
1312+
segments: hir_vec![hir::PathSegment {
1313+
infer_types: false,
1314+
ident: Ident::new(keywords::Invalid.name(), exist_ty_span),
1315+
args: Some(P(hir::GenericArgs {
1316+
parenthesized: false,
1317+
bindings: HirVec::new(),
1318+
args: lifetimes,
1319+
}))
1320+
}],
1321+
});
1322+
hir::TyPath(hir::QPath::Resolved(None, path))
13161323
})
13171324
}
13181325

@@ -1321,7 +1328,7 @@ impl<'a> LoweringContext<'a> {
13211328
exist_ty_id: NodeId,
13221329
parent_index: DefIndex,
13231330
bounds: &hir::GenericBounds,
1324-
) -> (HirVec<hir::Lifetime>, HirVec<hir::GenericParam>) {
1331+
) -> (HirVec<hir::GenericArg>, HirVec<hir::GenericParam>) {
13251332
// This visitor walks over impl trait bounds and creates defs for all lifetimes which
13261333
// appear in the bounds, excluding lifetimes that are created within the bounds.
13271334
// e.g. 'a, 'b, but not 'c in `impl for<'c> SomeTrait<'a, 'b, 'c>`
@@ -1332,7 +1339,7 @@ impl<'a> LoweringContext<'a> {
13321339
collect_elided_lifetimes: bool,
13331340
currently_bound_lifetimes: Vec<hir::LifetimeName>,
13341341
already_defined_lifetimes: HashSet<hir::LifetimeName>,
1335-
output_lifetimes: Vec<hir::Lifetime>,
1342+
output_lifetimes: Vec<hir::GenericArg>,
13361343
output_lifetime_params: Vec<hir::GenericParam>,
13371344
}
13381345

@@ -1416,11 +1423,11 @@ impl<'a> LoweringContext<'a> {
14161423
&& !self.already_defined_lifetimes.contains(&name) {
14171424
self.already_defined_lifetimes.insert(name);
14181425

1419-
self.output_lifetimes.push(hir::Lifetime {
1426+
self.output_lifetimes.push(hir::GenericArg::Lifetime(hir::Lifetime {
14201427
id: self.context.next_id().node_id,
14211428
span: lifetime.span,
14221429
name,
1423-
});
1430+
}));
14241431

14251432
// We need to manually create the ids here, because the
14261433
// definitions will go into the explicit `existential type`

src/librustc/hir/map/definitions.rs

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use rustc_data_structures::indexed_vec::{IndexVec};
2323
use rustc_data_structures::stable_hasher::StableHasher;
2424
use serialize::{Encodable, Decodable, Encoder, Decoder};
2525
use session::CrateDisambiguator;
26+
use std::borrow::Borrow;
2627
use std::fmt::Write;
2728
use std::hash::Hash;
2829
use syntax::ast;
@@ -389,6 +390,13 @@ pub struct DefPathHash(pub Fingerprint);
389390

390391
impl_stable_hash_for!(tuple_struct DefPathHash { fingerprint });
391392

393+
impl Borrow<Fingerprint> for DefPathHash {
394+
#[inline]
395+
fn borrow(&self) -> &Fingerprint {
396+
&self.0
397+
}
398+
}
399+
392400
impl Definitions {
393401
/// Create new empty definition map.
394402
pub fn new() -> Definitions {

src/librustc/hir/mod.rs

-12
Original file line numberDiff line numberDiff line change
@@ -1692,18 +1692,6 @@ pub enum Ty_ {
16921692
/// A trait object type `Bound1 + Bound2 + Bound3`
16931693
/// where `Bound` is a trait or a lifetime.
16941694
TyTraitObject(HirVec<PolyTraitRef>, Lifetime),
1695-
/// An existentially quantified (there exists a type satisfying) `impl
1696-
/// Bound1 + Bound2 + Bound3` type where `Bound` is a trait or a lifetime.
1697-
///
1698-
/// The `Item` is the generated
1699-
/// `existential type Foo<'a, 'b>: MyTrait<'a, 'b>;`.
1700-
///
1701-
/// The `HirVec<Lifetime>` is the list of lifetimes applied as parameters
1702-
/// to the `abstract type`, e.g. the `'c` and `'d` in `-> Foo<'c, 'd>`.
1703-
/// This list is only a list of lifetimes and not type parameters
1704-
/// because all in-scope type parameters are captured by `impl Trait`,
1705-
/// so they are resolved directly through the parent `Generics`.
1706-
TyImplTraitExistential(ItemId, DefId, HirVec<Lifetime>),
17071695
/// Unused for now
17081696
TyTypeof(AnonConst),
17091697
/// TyInfer means the type should be inferred instead of it having been

src/librustc/hir/print.rs

-9
Original file line numberDiff line numberDiff line change
@@ -420,15 +420,6 @@ impl<'a> State<'a> {
420420
self.print_lifetime(lifetime)?;
421421
}
422422
}
423-
hir::TyImplTraitExistential(hir_id, _def_id, ref _lifetimes) => {
424-
match self.ann.try_fetch_item(hir_id.id).map(|it| &it.node) {
425-
None => self.word_space("impl {{Trait}}")?,
426-
Some(&hir::ItemExistential(ref exist_ty)) => {
427-
self.print_bounds("impl", &exist_ty.bounds)?;
428-
},
429-
other => bug!("impl Trait pointed to {:#?}", other),
430-
}
431-
}
432423
hir::TyArray(ref ty, ref length) => {
433424
self.s.word("[")?;
434425
self.print_type(&ty)?;

src/librustc/ich/fingerprint.rs

+12
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ impl Fingerprint {
4545
)
4646
}
4747

48+
// Combines two hashes in an order independent way. Make sure this is what
49+
// you want.
50+
#[inline]
51+
pub fn combine_commutative(self, other: Fingerprint) -> Fingerprint {
52+
let a = (self.1 as u128) << 64 | self.0 as u128;
53+
let b = (other.1 as u128) << 64 | other.0 as u128;
54+
55+
let c = a.wrapping_add(b);
56+
57+
Fingerprint((c >> 64) as u64, c as u64)
58+
}
59+
4860
pub fn to_hex(&self) -> String {
4961
format!("{:x}{:x}", self.0, self.1)
5062
}

0 commit comments

Comments
 (0)