Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #42992

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
71252d9
Document possible `io::ErrorKind`s of `fs::open`
tbu- Jun 27, 2017
3dad197
Update RLS submodule
nrc Jun 26, 2017
2783d0f
Add links to the `ErrorKind` variants in errors of `open`
tbu- Jun 28, 2017
176225c
Adding diagnostic code 0611 for lifetime errors with one named, one a…
gaurikholkar Jun 12, 2017
5df7a2c
Adding new ui test for trait impl
gaurikholkar Jun 15, 2017
4bed5f0
update reference for test
nikomatsakis Jun 15, 2017
ae92bd0
Interchange ^ and -
gaurikholkar Jun 15, 2017
8fb6f74
Enabling E0611 for inherent functions
gaurikholkar Jun 17, 2017
2d99ffd
track anonymous regions in return types, fix tidy errors
gaurikholkar Jun 20, 2017
a851e1e
Adding changes to track anonymous region in self
gaurikholkar Jun 21, 2017
82f25b3
code review fixes
gaurikholkar Jun 22, 2017
aebc4e0
Changing the error code to E0621
gaurikholkar Jun 26, 2017
9540901
remove `fn main() { }` from extended errors
nikomatsakis Jun 27, 2017
e8b8f30
Code review fixes
gaurikholkar Jun 27, 2017
5841021
conflict fixes
gaurikholkar Jun 28, 2017
5be4fa8
code fixes for error code use warning
gaurikholkar Jun 29, 2017
76d54c0
Add E0619 error explanation
GuillaumeGomez Jun 28, 2017
2c86ff4
Fix error codes mixup
GuillaumeGomez Jun 29, 2017
4abcf28
adding compile-fail test
gaurikholkar Jun 29, 2017
cb26a25
tweak comments in E0495.rs
nikomatsakis Jun 29, 2017
a433777
move ERROR line
nikomatsakis Jun 30, 2017
37a88f4
rename compile-fail test
gaurikholkar Jun 30, 2017
401614b
rustc_llvm: re-run build script when env var LLVM_CONFIG changes
venkatagiri Jun 30, 2017
741dc2b
Track `iterator_for_each` in #42986
cuviper Jun 30, 2017
4f13da7
rustc_{a,l,m,t}san: re-run build script if env var LLVM_CONFIG changes
venkatagiri Jun 30, 2017
f14a366
Rollup merge of #42669 - gaurikholkar:master, r=nikomatsakis
GuillaumeGomez Jun 30, 2017
3502801
Rollup merge of #42911 - nrc:rls-update, r=brson
GuillaumeGomez Jun 30, 2017
995f063
Rollup merge of #42925 - tbu-:pr_document_file_open_errors, r=Guillau…
GuillaumeGomez Jun 30, 2017
ad914f2
Rollup merge of #42957 - GuillaumeGomez:add-e0619, r=nikomatsakis
GuillaumeGomez Jun 30, 2017
209281e
Rollup merge of #42985 - venkatagiri:issue_42444, r=Mark-Simulacrum
GuillaumeGomez Jun 30, 2017
ed22c81
Rollup merge of #42987 - cuviper:iterator_for_each, r=Mark-Simulacrum
GuillaumeGomez Jun 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 20 additions & 40 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,6 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
if build.is_rust_llvm(target) {
cargo.env("LLVM_RUSTLLVM", "1");
}
if let Some(ref cfg_file) = build.flags.config {
let cfg_path = t!(PathBuf::from(cfg_file).canonicalize());
cargo.env("CFG_LLVM_TOML", cfg_path.into_os_string());
}
cargo.env("LLVM_CONFIG", build.llvm_config(target));
let target_config = build.config.target_config.get(target);
if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `iterator_for_each`

The tracking issue for this feature is: [#TBD]
The tracking issue for this feature is: [#42986]

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

------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ pub trait Iterator {
/// .for_each(|(i, x)| println!("{}:{}", i, x));
/// ```
#[inline]
#[unstable(feature = "iterator_for_each", issue = "0")]
#[unstable(feature = "iterator_for_each", issue = "42986")]
fn for_each<F>(self, mut f: F) where
Self: Sized, F: FnMut(Self::Item),
{
Expand Down
38 changes: 38 additions & 0 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,6 +1946,44 @@ Maybe you just misspelled the lint name or the lint doesn't exist anymore.
Either way, try to update/remove it in order to fix the error.
"##,

E0621: r##"
This error code indicates a mismatch between the function signature (i.e.,
the parameter types and the return type) and the function body. Most of
the time, this indicates that the function signature needs to be changed to
match the body, but it may be that the body needs to be changed to match
the signature.

Specifically, one or more of the parameters contain borrowed data that
needs to have a named lifetime in order for the body to type-check. Most of
the time, this is because the borrowed data is being returned from the
function, as in this example:

```compile_fail,E0621
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { // explicit lifetime required
// in the type of `y`
if x > y { x } else { y }
}
```

Here, the function is returning data borrowed from either x or y, but the
'a annotation indicates that it is returning data only from x. We can make
the signature match the body by changing the type of y to &'a i32, like so:

```
fn foo<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
if x > y { x } else { y }
}
```

Alternatively, you could change the body not to return data from y:

```
fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
x
}
```
"##,

}


Expand Down
44 changes: 30 additions & 14 deletions src/librustc/infer/error_reporting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ use ty::error::TypeError;
use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::{Pos, Span};
use errors::{DiagnosticBuilder, DiagnosticStyledString};

mod note;

mod need_type_info;
mod named_anon_conflict;


impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
pub fn note_and_explain_region(self,
Expand Down Expand Up @@ -255,34 +257,48 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
}

impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
pub fn report_region_errors(&self,
errors: &Vec<RegionResolutionError<'tcx>>) {

pub fn report_region_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>) {
debug!("report_region_errors(): {} errors to start", errors.len());

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

debug!("report_region_errors: {} errors after preprocessing", errors.len());
debug!("report_region_errors: {} errors after preprocessing",
errors.len());

for error in errors {

debug!("report_region_errors: error = {:?}", error);
match error.clone() {
ConcreteFailure(origin, sub, sup) => {
self.report_concrete_failure(origin, sub, sup).emit();
}

GenericBoundFailure(kind, param_ty, sub) => {
self.report_generic_bound_failure(kind, param_ty, sub);
}
if !self.try_report_named_anon_conflict(&error){

match error.clone() {
// These errors could indicate all manner of different
// problems with many different solutions. Rather
// than generate a "one size fits all" error, what we
// attempt to do is go through a number of specific
// scenarios and try to find the best way to present
// the error. If all of these fails, we fall back to a rather
// general bit of code that displays the error information
ConcreteFailure(origin, sub, sup) => {

self.report_concrete_failure(origin, sub, sup).emit();
}

SubSupConflict(var_origin,
GenericBoundFailure(kind, param_ty, sub) => {
self.report_generic_bound_failure(kind, param_ty, sub);
}

SubSupConflict(var_origin,
sub_origin, sub_r,
sup_origin, sup_r) => {
self.report_sub_sup_conflict(var_origin,
self.report_sub_sup_conflict(var_origin,
sub_origin, sub_r,
sup_origin, sup_r);
}
}
}
}
}
}
Expand Down
Loading