Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4b3e620

Browse files
committedFeb 8, 2018
Auto merge of #48077 - kennytm:rollup, r=kennytm
Rollup of 7 pull requests - Successful merges: #47835, #47854, #48015, #48047, #48051, #48058, #48064 - Failed merges:
2 parents 932c736 + e4fb971 commit 4b3e620

File tree

16 files changed

+148
-469
lines changed

16 files changed

+148
-469
lines changed
 

‎config.toml.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@
151151
# default.
152152
#extended = false
153153

154+
# Installs choosen set of extended tools if enables. By default builds all.
155+
# If choosen tool failed to build the installation fails.
156+
#tools = ["cargo", "rls", "rustfmt", "analysis", "src"]
157+
154158
# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
155159
#verbose = 0
156160

‎src/bootstrap/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! This module implements parsing `config.toml` configuration files to tweak
1414
//! how the build runs.
1515
16-
use std::collections::HashMap;
16+
use std::collections::{HashMap, HashSet};
1717
use std::env;
1818
use std::fs::File;
1919
use std::io::prelude::*;
@@ -52,6 +52,7 @@ pub struct Config {
5252
pub target_config: HashMap<Interned<String>, Target>,
5353
pub full_bootstrap: bool,
5454
pub extended: bool,
55+
pub tools: Option<HashSet<String>>,
5556
pub sanitizers: bool,
5657
pub profiler: bool,
5758
pub ignore_git: bool,
@@ -191,6 +192,7 @@ struct Build {
191192
python: Option<String>,
192193
full_bootstrap: Option<bool>,
193194
extended: Option<bool>,
195+
tools: Option<HashSet<String>>,
194196
verbose: Option<usize>,
195197
sanitizers: Option<bool>,
196198
profiler: Option<bool>,
@@ -395,6 +397,7 @@ impl Config {
395397
set(&mut config.vendor, build.vendor);
396398
set(&mut config.full_bootstrap, build.full_bootstrap);
397399
set(&mut config.extended, build.extended);
400+
config.tools = build.tools;
398401
set(&mut config.verbose, build.verbose);
399402
set(&mut config.sanitizers, build.sanitizers);
400403
set(&mut config.profiler, build.profiler);

‎src/bootstrap/configure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def v(*args):
144144
o("full-bootstrap", "build.full-bootstrap", "build three compilers instead of two")
145145
o("extended", "build.extended", "build an extended rust tool set")
146146

147+
v("tools", "build.tools", "List of extended tools will be installed")
147148
v("build", "build.build", "GNUs ./configure syntax LLVM build triple")
148149
v("host", None, "GNUs ./configure syntax LLVM host triples")
149150
v("target", None, "GNUs ./configure syntax LLVM target triples")

‎src/bootstrap/install.rs

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use dist::{self, pkgname, sanitize_sh, tmpdir};
2222

2323
use builder::{Builder, RunConfig, ShouldRun, Step};
2424
use cache::Interned;
25+
use config::Config;
2526

2627
pub fn install_docs(builder: &Builder, stage: u32, host: Interned<String>) {
2728
install_sh(builder, "docs", "rust-docs", stage, Some(host));
@@ -144,6 +145,19 @@ macro_rules! install {
144145
pub host: Interned<String>,
145146
}
146147

148+
impl $name {
149+
#[allow(dead_code)]
150+
fn should_build(config: &Config) -> bool {
151+
config.extended && config.tools.as_ref()
152+
.map_or(true, |t| t.contains($path))
153+
}
154+
155+
#[allow(dead_code)]
156+
fn should_install(builder: &Builder) -> bool {
157+
builder.config.tools.as_ref().map_or(false, |t| t.contains($path))
158+
}
159+
}
160+
147161
impl Step for $name {
148162
type Output = ();
149163
const DEFAULT: bool = true;
@@ -185,32 +199,34 @@ install!((self, builder, _config),
185199
install_std(builder, self.stage, *target);
186200
}
187201
};
188-
Cargo, "cargo", _config.extended, only_hosts: true, {
202+
Cargo, "cargo", Self::should_build(_config), only_hosts: true, {
189203
builder.ensure(dist::Cargo { stage: self.stage, target: self.target });
190204
install_cargo(builder, self.stage, self.target);
191205
};
192-
Rls, "rls", _config.extended, only_hosts: true, {
193-
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() {
206+
Rls, "rls", Self::should_build(_config), only_hosts: true, {
207+
if builder.ensure(dist::Rls { stage: self.stage, target: self.target }).is_some() ||
208+
Self::should_install(builder) {
194209
install_rls(builder, self.stage, self.target);
195210
} else {
196211
println!("skipping Install RLS stage{} ({})", self.stage, self.target);
197212
}
198213
};
199-
Rustfmt, "rustfmt", _config.extended, only_hosts: true, {
200-
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() {
214+
Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, {
215+
if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() ||
216+
Self::should_install(builder) {
201217
install_rustfmt(builder, self.stage, self.target);
202218
} else {
203219
println!("skipping Install Rustfmt stage{} ({})", self.stage, self.target);
204220
}
205221
};
206-
Analysis, "analysis", _config.extended, only_hosts: false, {
222+
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
207223
builder.ensure(dist::Analysis {
208224
compiler: builder.compiler(self.stage, self.host),
209225
target: self.target
210226
});
211227
install_analysis(builder, self.stage, self.target);
212228
};
213-
Src, "src", _config.extended, only_hosts: true, {
229+
Src, "src", Self::should_build(_config) , only_hosts: true, {
214230
builder.ensure(dist::Src);
215231
install_src(builder, self.stage);
216232
}, ONLY_BUILD;

‎src/librustc/traits/error_reporting.rs

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -764,8 +764,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
764764
} else {
765765
let (closure_span, found) = found_did
766766
.and_then(|did| self.tcx.hir.get_if_local(did))
767-
.map(|node| self.get_fn_like_arguments(node))
768-
.unwrap_or((found_span.unwrap(), found));
767+
.map(|node| {
768+
let (found_span, found) = self.get_fn_like_arguments(node);
769+
(Some(found_span), found)
770+
}).unwrap_or((found_span, found));
769771

770772
self.report_arg_count_mismatch(span,
771773
closure_span,
@@ -875,7 +877,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
875877
fn report_arg_count_mismatch(
876878
&self,
877879
span: Span,
878-
found_span: Span,
880+
found_span: Option<Span>,
879881
expected_args: Vec<ArgKind>,
880882
found_args: Vec<ArgKind>,
881883
is_closure: bool,
@@ -913,48 +915,51 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
913915
);
914916

915917
err.span_label(span, format!( "expected {} that takes {}", kind, expected_str));
916-
err.span_label(found_span, format!("takes {}", found_str));
917-
918-
if let &[ArgKind::Tuple(_, ref fields)] = &found_args[..] {
919-
if fields.len() == expected_args.len() {
920-
let sugg = fields.iter()
921-
.map(|(name, _)| name.to_owned())
922-
.collect::<Vec<String>>().join(", ");
923-
err.span_suggestion(found_span,
924-
"change the closure to take multiple arguments instead of \
925-
a single tuple",
926-
format!("|{}|", sugg));
918+
919+
if let Some(found_span) = found_span {
920+
err.span_label(found_span, format!("takes {}", found_str));
921+
922+
if let &[ArgKind::Tuple(_, ref fields)] = &found_args[..] {
923+
if fields.len() == expected_args.len() {
924+
let sugg = fields.iter()
925+
.map(|(name, _)| name.to_owned())
926+
.collect::<Vec<String>>().join(", ");
927+
err.span_suggestion(found_span,
928+
"change the closure to take multiple arguments instead of \
929+
a single tuple",
930+
format!("|{}|", sugg));
931+
}
927932
}
928-
}
929-
if let &[ArgKind::Tuple(_, ref fields)] = &expected_args[..] {
930-
if fields.len() == found_args.len() && is_closure {
931-
let sugg = format!(
932-
"|({}){}|",
933-
found_args.iter()
934-
.map(|arg| match arg {
935-
ArgKind::Arg(name, _) => name.to_owned(),
936-
_ => "_".to_owned(),
937-
})
938-
.collect::<Vec<String>>()
939-
.join(", "),
940-
// add type annotations if available
941-
if found_args.iter().any(|arg| match arg {
942-
ArgKind::Arg(_, ty) => ty != "_",
943-
_ => false,
944-
}) {
945-
format!(": ({})",
946-
fields.iter()
947-
.map(|(_, ty)| ty.to_owned())
948-
.collect::<Vec<String>>()
949-
.join(", "))
950-
} else {
951-
"".to_owned()
952-
},
953-
);
954-
err.span_suggestion(found_span,
955-
"change the closure to accept a tuple instead of individual \
956-
arguments",
957-
sugg);
933+
if let &[ArgKind::Tuple(_, ref fields)] = &expected_args[..] {
934+
if fields.len() == found_args.len() && is_closure {
935+
let sugg = format!(
936+
"|({}){}|",
937+
found_args.iter()
938+
.map(|arg| match arg {
939+
ArgKind::Arg(name, _) => name.to_owned(),
940+
_ => "_".to_owned(),
941+
})
942+
.collect::<Vec<String>>()
943+
.join(", "),
944+
// add type annotations if available
945+
if found_args.iter().any(|arg| match arg {
946+
ArgKind::Arg(_, ty) => ty != "_",
947+
_ => false,
948+
}) {
949+
format!(": ({})",
950+
fields.iter()
951+
.map(|(_, ty)| ty.to_owned())
952+
.collect::<Vec<String>>()
953+
.join(", "))
954+
} else {
955+
"".to_owned()
956+
},
957+
);
958+
err.span_suggestion(found_span,
959+
"change the closure to accept a tuple instead of \
960+
individual arguments",
961+
sugg);
962+
}
958963
}
959964
}
960965

‎src/librustc_data_structures/blake2b.rs

Lines changed: 0 additions & 363 deletions
This file was deleted.

‎src/librustc_data_structures/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub mod small_vec;
5757
pub mod base_n;
5858
pub mod bitslice;
5959
pub mod bitvec;
60-
pub mod blake2b;
6160
pub mod graph;
6261
pub mod indexed_set;
6362
pub mod indexed_vec;
@@ -70,7 +69,6 @@ pub mod transitive_relation;
7069
pub mod unify;
7170
pub mod fx;
7271
pub mod tuple_slice;
73-
pub mod veccell;
7472
pub mod control_flow_graph;
7573
pub mod flock;
7674
pub mod sync;

‎src/librustc_data_structures/veccell/mod.rs

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎src/librustc_driver/driver.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ pub fn compile_input(trans: Box<TransCrate>,
170170
return Ok(())
171171
}
172172

173+
if let &Some(ref dir) = outdir {
174+
if fs::create_dir_all(dir).is_err() {
175+
sess.err("failed to find or create the directory specified by --out-dir");
176+
return Err(CompileIncomplete::Stopped);
177+
}
178+
}
179+
173180
let arenas = AllArenas::new();
174181

175182
// Construct the HIR map

‎src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,10 @@ impl Clean<Attributes> for [ast::Attribute] {
10511051
if UnstableFeatures::from_environment().is_nightly_build() {
10521052
let dox = attrs.collapsed_doc_value().unwrap_or_else(String::new);
10531053
for link in markdown_links(&dox, cx.render_type) {
1054+
// bail early for real links
1055+
if link.contains('/') {
1056+
continue;
1057+
}
10541058
let (def, fragment) = {
10551059
let mut kind = PathKind::Unknown;
10561060
let path_str = if let Some(prefix) =

‎src/librustdoc/clean/simplify.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ pub fn where_clauses(cx: &DocContext, clauses: Vec<WP>) -> Vec<WP> {
106106
}
107107
PP::Parenthesized { ref mut output, .. } => {
108108
assert!(output.is_none());
109-
*output = Some(rhs.clone());
109+
if *rhs != clean::Type::Tuple(Vec::new()) {
110+
*output = Some(rhs.clone());
111+
}
110112
}
111113
};
112114
true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub fn f2<F: FnMut(u32) + Clone>(f: F) {}
12+
13+
pub fn f3<F: FnMut(u64) -> () + Clone>(f: F) {}

‎src/test/rustdoc/unit-return.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// aux-build:unit-return.rs
12+
13+
#![crate_name = "foo"]
14+
15+
extern crate unit_return;
16+
17+
// @has 'foo/fn.f0.html' '//*[@class="rust fn"]' 'F: FnMut(u8) + Clone'
18+
pub fn f0<F: FnMut(u8) + Clone>(f: F) {}
19+
20+
// @has 'foo/fn.f1.html' '//*[@class="rust fn"]' 'F: FnMut(u16) + Clone'
21+
pub fn f1<F: FnMut(u16) -> () + Clone>(f: F) {}
22+
23+
// @has 'foo/fn.f2.html' '//*[@class="rust fn"]' 'F: FnMut(u32) + Clone'
24+
pub use unit_return::f2;
25+
26+
// @has 'foo/fn.f3.html' '//*[@class="rust fn"]' 'F: FnMut(u64) + Clone'
27+
pub use unit_return::f3;

‎src/test/ui/mismatched_types/closure-arg-count.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ fn main() {
3636
//~^ ERROR closure is expected to take
3737
let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
3838
//~^ ERROR function is expected to take
39+
40+
let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
41+
//~^ ERROR function is expected to take
3942
}
4043

4144
fn foo() {}

‎src/test/ui/mismatched_types/closure-arg-count.stderr

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ error[E0593]: function is expected to take a single 2-tuple as argument, but it
9090
32 | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
9191
| ^^^ expected function that takes a single 2-tuple as argument
9292
...
93-
41 | fn foo() {}
93+
44 | fn foo() {}
9494
| -------- takes 0 arguments
9595

9696
error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments
@@ -107,8 +107,14 @@ error[E0593]: function is expected to take a single 2-tuple as argument, but it
107107
37 | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
108108
| ^^^ expected function that takes a single 2-tuple as argument
109109
...
110-
42 | fn qux(x: usize, y: usize) {}
110+
45 | fn qux(x: usize, y: usize) {}
111111
| -------------------------- takes 2 distinct arguments
112112

113-
error: aborting due to 11 previous errors
113+
error[E0593]: function is expected to take 1 argument, but it takes 2 arguments
114+
--> $DIR/closure-arg-count.rs:40:41
115+
|
116+
40 | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
117+
| ^^^ expected function that takes 1 argument
118+
119+
error: aborting due to 12 previous errors
114120

0 commit comments

Comments
 (0)
Please sign in to comment.