Skip to content

Commit 7d89b20

Browse files
committed
Auto merge of #42995 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests - Successful merges: #42669, #42911, #42925, #42957, #42985, #42987 - Failed merges: #42936
2 parents 37849a0 + bda06de commit 7d89b20

39 files changed

+697
-115
lines changed

src/Cargo.lock

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

src/bootstrap/compile.rs

-4
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,6 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
276276
if build.is_rust_llvm(target) {
277277
cargo.env("LLVM_RUSTLLVM", "1");
278278
}
279-
if let Some(ref cfg_file) = build.flags.config {
280-
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
281-
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
282-
}
283279
cargo.env("LLVM_CONFIG", build.llvm_config(target));
284280
let target_config = build.config.target_config.get(target);
285281
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {

src/doc/unstable-book/src/library-features/iterator-for-each.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# `iterator_for_each`
22

3-
The tracking issue for this feature is: [#TBD]
3+
The tracking issue for this feature is: [#42986]
44

5-
[#TBD]: https://github.com/rust-lang/rust/issues/TBD
5+
[#42986]: https://github.com/rust-lang/rust/issues/42986
66

77
------------------------
88

src/libcore/iter/iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ pub trait Iterator {
522522
/// .for_each(|(i, x)| println!("{}:{}", i, x));
523523
/// ```
524524
#[inline]
525-
#[unstable(feature = "iterator_for_each", issue = "0")]
525+
#[unstable(feature = "iterator_for_each", issue = "42986")]
526526
fn for_each<F>(self, mut f: F) where
527527
Self: Sized, F: FnMut(Self::Item),
528528
{

src/librustc/diagnostics.rs

+38
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,44 @@ Maybe you just misspelled the lint name or the lint doesn't exist anymore.
19461946
Either way, try to update/remove it in order to fix the error.
19471947
"##,
19481948

1949+
E0621: r##"
1950+
This error code indicates a mismatch between the function signature (i.e.,
1951+
the parameter types and the return type) and the function body. Most of
1952+
the time, this indicates that the function signature needs to be changed to
1953+
match the body, but it may be that the body needs to be changed to match
1954+
the signature.
1955+
1956+
Specifically, one or more of the parameters contain borrowed data that
1957+
needs to have a named lifetime in order for the body to type-check. Most of
1958+
the time, this is because the borrowed data is being returned from the
1959+
function, as in this example:
1960+
1961+
```compile_fail,E0621
1962+
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { // explicit lifetime required
1963+
// in the type of `y`
1964+
if x > y { x } else { y }
1965+
}
1966+
```
1967+
1968+
Here, the function is returning data borrowed from either x or y, but the
1969+
'a annotation indicates that it is returning data only from x. We can make
1970+
the signature match the body by changing the type of y to &'a i32, like so:
1971+
1972+
```
1973+
fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
1974+
if x > y { x } else { y }
1975+
}
1976+
```
1977+
1978+
Alternatively, you could change the body not to return data from y:
1979+
1980+
```
1981+
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
1982+
x
1983+
}
1984+
```
1985+
"##,
1986+
19491987
}
19501988

19511989

src/librustc/infer/error_reporting/mod.rs

+30-14
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ use ty::error::TypeError;
7272
use syntax::ast::DUMMY_NODE_ID;
7373
use syntax_pos::{Pos, Span};
7474
use errors::{DiagnosticBuilder, DiagnosticStyledString};
75-
7675
mod note;
76+
7777
mod need_type_info;
78+
mod named_anon_conflict;
79+
7880

7981
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
8082
pub fn note_and_explain_region(self,
@@ -255,34 +257,48 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
255257
}
256258

257259
impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
258-
pub fn report_region_errors(&self,
259-
errors: &Vec<RegionResolutionError<'tcx>>) {
260+
261+
pub fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>) {
260262
debug!("report_region_errors(): {} errors to start", errors.len());
261263

262264
// try to pre-process the errors, which will group some of them
263265
// together into a `ProcessedErrors` group:
264266
let errors = self.process_errors(errors);
265267

266-
debug!("report_region_errors: {} errors after preprocessing", errors.len());
268+
debug!("report_region_errors: {} errors after preprocessing",
269+
errors.len());
267270

268271
for error in errors {
272+
269273
debug!("report_region_errors: error = {:?}", error);
270-
match error.clone() {
271-
ConcreteFailure(origin, sub, sup) => {
272-
self.report_concrete_failure(origin, sub, sup).emit();
273-
}
274274

275-
GenericBoundFailure(kind, param_ty, sub) => {
276-
self.report_generic_bound_failure(kind, param_ty, sub);
277-
}
275+
if !self.try_report_named_anon_conflict(&error){
276+
277+
match error.clone() {
278+
// These errors could indicate all manner of different
279+
// problems with many different solutions. Rather
280+
// than generate a "one size fits all" error, what we
281+
// attempt to do is go through a number of specific
282+
// scenarios and try to find the best way to present
283+
// the error. If all of these fails, we fall back to a rather
284+
// general bit of code that displays the error information
285+
ConcreteFailure(origin, sub, sup) => {
286+
287+
self.report_concrete_failure(origin, sub, sup).emit();
288+
}
278289

279-
SubSupConflict(var_origin,
290+
GenericBoundFailure(kind, param_ty, sub) => {
291+
self.report_generic_bound_failure(kind, param_ty, sub);
292+
}
293+
294+
SubSupConflict(var_origin,
280295
sub_origin, sub_r,
281296
sup_origin, sup_r) => {
282-
self.report_sub_sup_conflict(var_origin,
297+
self.report_sub_sup_conflict(var_origin,
283298
sub_origin, sub_r,
284299
sup_origin, sup_r);
285-
}
300+
}
301+
}
286302
}
287303
}
288304
}

0 commit comments

Comments
 (0)