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 18 pull requests #35397

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
c622a42
Update the man page rustc.1
dns2utf8 Aug 4, 2016
91f9704
Update rustdoc version
dns2utf8 Aug 4, 2016
625fc29
Update error format for E0130
trixnz Aug 4, 2016
8787237
Add E0254 error explanation
GuillaumeGomez Aug 4, 2016
8641bc2
Updated E0081 to new format
Aug 5, 2016
c61cfb0
Update E0106 error message to new format.
Tiwalun Aug 5, 2016
764d5cf
Update E0379 to new format #35338
kc1212 Aug 5, 2016
4c672e0
Fixed no-pattern-in-args test for new E0130 format
trixnz Aug 5, 2016
7cd1779
Add new error code tests
GuillaumeGomez Aug 5, 2016
bc25879
Update E0207 to use struct_span_err, add span_label
shantanuraj Aug 5, 2016
eaa2697
Updated error message E0282
Aug 5, 2016
5eebb92
Update error message for E0166
Aug 5, 2016
b7468fa
Updated E0306 to new format.
razielgn Aug 5, 2016
40b7ace
Update E0229 to new format
Aug 5, 2016
2f5294e
Fixes #35304
mikhail-m1 Aug 5, 2016
e7e5cfe
Merge branch 'master' of https://github.com/rust-lang/rust
mikhail-m1 Aug 5, 2016
3575812
Update E0107 message to new format
ojsheikh Aug 5, 2016
00179a7
Updated style of unit test
Aug 5, 2016
7eca647
Update error format for E0373
trixnz Aug 5, 2016
2061d65
Add E0107 tests for multiple lifetime params
ojsheikh Aug 5, 2016
802b543
Update error format for E0326
trixnz Aug 5, 2016
51a270f
Fix E0229 unit tests
Aug 5, 2016
291b6f1
Comment on the casts in the `seek` implementations on files
tbu- Jul 18, 2016
58b618e
Update unit tests to accord for label in E0207
shantanuraj Aug 5, 2016
422e0d5
Update E0004 to use labels
TheZoq2 Aug 5, 2016
e0035c9
Update error message for E0323, E0324 and E0325
Aug 5, 2016
ff96b56
Updated E0282 to new requirements
Aug 5, 2016
e36be6e
Rollup merge of #34916 - tbu-:pr_comment_on_seek_cast, r=GuillaumeGomez
Aug 5, 2016
bf19adc
Rollup merge of #35287 - dns2utf8:man_page_rustc, r=nikomatsakis
Aug 5, 2016
6556ffd
Rollup merge of #35288 - Roybie:35271-E0166-update-error-format, r=Gu…
Aug 5, 2016
843a3e9
Rollup merge of #35331 - trixnz:update-error-130, r=jonathandturner
Aug 5, 2016
c3c287c
Rollup merge of #35353 - poveda-ruiz:master, r=jonathandturner
Aug 5, 2016
39a1a25
Rollup merge of #35356 - Tiwalun:fix-err-msg-e0106, r=jonathandturner
Aug 5, 2016
71b8958
Rollup merge of #35363 - GuillaumeGomez:err_codes, r=jonathandturner
Aug 5, 2016
431eeb0
Rollup merge of #35364 - kc1212:e0379, r=jonathandturner
Aug 5, 2016
2139a0a
Rollup merge of #35366 - medzin:E0282, r=jonathandturner
Aug 5, 2016
320e3dc
Rollup merge of #35368 - shantanuraj:master, r=jonathandturner
Aug 5, 2016
3dd50b5
Rollup merge of #35370 - razielgn:updated-e0306-to-new-format, r=jona…
Aug 5, 2016
8d881d6
Rollup merge of #35372 - Keats:err-323, r=jonathandturner
Aug 5, 2016
7f5d263
Rollup merge of #35373 - oijazsh:E0107, r=jonathandturner
Aug 5, 2016
dbe7af7
Rollup merge of #35374 - mrabault:e0229_format, r=jonathandturner
Aug 5, 2016
36af476
Rollup merge of #35375 - trixnz:update-error-326, r=jonathandturner
Aug 5, 2016
9834224
Rollup merge of #35376 - trixnz:update-error-373, r=jonathandturner
Aug 5, 2016
3e1fe82
Rollup merge of #35380 - TheZoq2:master, r=jonathandturner
Aug 5, 2016
9154cc9
Rollup merge of #35394 - mikhail-m1:master, r=jonathandturner
Aug 5, 2016
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
4 changes: 2 additions & 2 deletions man/rustc.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH RUSTC "1" "August 2015" "rustc 1.2.0" "User Commands"
.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands"
.SH NAME
rustc \- The Rust compiler
.SH SYNOPSIS
Expand Down Expand Up @@ -299,7 +299,7 @@ To build an executable with debug info:
See https://github.com/rust\-lang/rust/issues for issues.

.SH "AUTHOR"
See \fIAUTHORS.txt\fR in the Rust source distribution.
See https://github.com/rust\-lang/rust/graphs/contributors or use `git log --all --format='%cN <%cE>' | sort -u` in the rust source distribution.

.SH "COPYRIGHT"
This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.
Expand Down
2 changes: 1 addition & 1 deletion man/rustdoc.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH RUSTDOC "1" "August 2015" "rustdoc 1.2.0" "User Commands"
.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
.SH NAME
rustdoc \- generate documentation from Rust source code
.SH SYNOPSIS
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/middle/astconv_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {

pub fn prohibit_projection(self, span: Span)
{
span_err!(self.sess, span, E0229,
"associated type bindings are not allowed here");
let mut err = struct_span_err!(self.sess, span, E0229,
"associated type bindings are not allowed here");
err.span_label(span, &format!("associate type not allowed here")).emit();
}

pub fn prim_ty_to_ty(self,
Expand Down
10 changes: 6 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {


fn need_type_info(&self, span: Span, ty: Ty<'tcx>) {
span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`; \
type annotations or generic parameter binding required",
ty);
let mut err = struct_span_err!(self.tcx.sess, span, E0282,
"unable to infer enough type information about `{}`",
ty);
err.note("type annotations or generic parameter binding required");
err.span_label(span, &format!("cannot infer type for `{}`", ty));
err.emit()
}

fn note_obligation_cause<T>(&self,
Expand Down
5 changes: 4 additions & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
but it borrows {}, \
which is owned by the current function",
cmt_path_or_string)
.span_note(capture_span,
.span_label(capture_span,
&format!("{} is borrowed here",
cmt_path_or_string))
.span_label(err.span,
&format!("may outlive borrowed value {}",
cmt_path_or_string))
.span_suggestion(err.span,
&format!("to force the closure to take ownership of {} \
(and any other referenced variables), \
Expand Down
9 changes: 7 additions & 2 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,10 +424,15 @@ fn check_exhaustive<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>,
format!("`{}` and {} more", head.join("`, `"), tail.len())
}
};
span_err!(cx.tcx.sess, sp, E0004,

let label_text = match pattern_strings.len(){
1 => format!("pattern {} not covered", joined_patterns),
_ => format!("patterns {} not covered", joined_patterns)
};
struct_span_err!(cx.tcx.sess, sp, E0004,
"non-exhaustive patterns: {} not covered",
joined_patterns
);
).span_label(sp, &label_text).emit();
},
}
}
Expand Down
11 changes: 7 additions & 4 deletions src/librustc_const_eval/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,10 +1337,13 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
Ok(val as usize)
},
Ok(const_val) => {
span_err!(tcx.sess, count_expr.span, E0306,
"expected usize for {}, found {}",
reason,
const_val.description());
struct_span_err!(tcx.sess, count_expr.span, E0306,
"expected `usize` for {}, found {}",
reason,
const_val.description())
.span_label(count_expr.span, &format!("expected `usize`"))
.emit();

Err(ErrorReported)
}
Err(err) => {
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ impl<'a> Visitor for AstValidator<'a> {
self.check_decl_no_pat(decl, |span, is_recent| {
let mut err = struct_span_err!(self.session, span, E0130,
"patterns aren't allowed in foreign function declarations");
err.span_label(span, &format!("pattern not allowed in foreign function"));

if is_recent {
err.span_note(span, "this is a recent error, see \
issue #35203 for more details");
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_passes/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ All statics and constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```compile_fail
```compile_fail,E0265
const X: u32 = X;
```

```compile_fail
```compile_fail,E0265
const X: u32 = Y;
const Y: u32 = X;
```
Expand All @@ -135,7 +135,7 @@ E0267: r##"
This error indicates the use of a loop keyword (`break` or `continue`) inside a
closure but outside of any loop. Erroneous code example:

```compile_fail
```compile_fail,E0267
let w = || { break; }; // error: `break` inside of a closure
```

Expand All @@ -159,7 +159,7 @@ This error indicates the use of a loop keyword (`break` or `continue`) outside
of a loop. Without a loop to break out of or continue in, no sensible action can
be taken. Erroneous code example:

```compile_fail
```compile_fail,E0268
fn some_func() {
break; // error: `break` outside of loop
}
Expand Down
41 changes: 40 additions & 1 deletion src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,53 @@ mod foo {
}

use foo::MyTrait::do_something;
// error: `do_something` is not directly importable

fn main() {}
```

It's invalid to directly import methods belonging to a trait or concrete type.
"##,

E0254: r##"
Attempt was made to import an item whereas an extern crate with this name has
already been imported.

Erroneous code example:

```compile_fail,E0254
extern crate collections;

mod foo {
pub trait collections {
fn do_something();
}
}

use foo::collections; // error: an extern crate named `collections` has already
// been imported in this module

fn main() {}
```

To fix issue issue, you have to rename at least one of the two imports.
Example:

```ignore
extern crate collections as libcollections; // ok!

mod foo {
pub trait collections {
fn do_something();
}
}

use foo::collections;

fn main() {}
```
"##,

E0255: r##"
You can't import a value whose name is the same as another value defined in the
module.
Expand Down Expand Up @@ -1237,7 +1277,6 @@ impl Foo for i32 {}
register_diagnostics! {
// E0153, unused error code
// E0157, unused error code
E0254, // import conflicts with imported crate in this module
// E0257,
// E0258,
E0402, // cannot use an outer type parameter in this context
Expand Down
30 changes: 25 additions & 5 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
None => match rscope.anon_regions(default_span, 1) {
Ok(rs) => rs[0],
Err(params) => {
let mut err = struct_span_err!(self.tcx().sess, default_span, E0106,
"missing lifetime specifier");
let ampersand_span = Span { hi: default_span.lo, ..default_span};

let mut err = struct_span_err!(self.tcx().sess, ampersand_span, E0106,
"missing lifetime specifier");
err.span_label(ampersand_span, &format!("expected lifetime parameter"));

if let Some(params) = params {
report_elision_failure(&mut err, params);
}
Expand Down Expand Up @@ -2269,9 +2273,25 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
}

fn report_lifetime_number_error(tcx: TyCtxt, span: Span, number: usize, expected: usize) {
span_err!(tcx.sess, span, E0107,
"wrong number of lifetime parameters: expected {}, found {}",
expected, number);
let label = if number < expected {
if expected == 1 {
format!("expected {} lifetime parameter", expected)
} else {
format!("expected {} lifetime parameters", expected)
}
} else {
let additional = number - expected;
if additional == 1 {
"unexpected lifetime parameter".to_string()
} else {
format!("{} unexpected lifetime parameters", additional)
}
};
struct_span_err!(tcx.sess, span, E0107,
"wrong number of lifetime parameters: expected {}, found {}",
expected, number)
.span_label(span, &label)
.emit();
}

// A helper struct for conveniently grouping a set of bounds which we pass to
Expand Down
24 changes: 23 additions & 1 deletion src/librustc_typeck/check/compare_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use rustc::ty;
use rustc::traits::{self, ProjectionMode};
use rustc::ty::error::ExpectedFound;
use rustc::ty::subst::{self, Subst, Substs, VecPerParamSpace};
use rustc::hir::map::Node;
use rustc::hir::{ImplItemKind, TraitItem_};

use syntax::ast;
use syntax_pos::Span;
Expand Down Expand Up @@ -447,7 +449,7 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
// Compute skolemized form of impl and trait const tys.
let impl_ty = impl_c.ty.subst(tcx, impl_to_skol_substs);
let trait_ty = trait_c.ty.subst(tcx, &trait_to_skol_substs);
let origin = TypeOrigin::Misc(impl_c_span);
let mut origin = TypeOrigin::Misc(impl_c_span);

let err = infcx.commit_if_ok(|_| {
// There is no "body" here, so just pass dummy id.
Expand Down Expand Up @@ -482,11 +484,31 @@ pub fn compare_const_impl<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
debug!("checking associated const for compatibility: impl ty {:?}, trait ty {:?}",
impl_ty,
trait_ty);

// Locate the Span containing just the type of the offending impl
if let Some(impl_trait_node) = tcx.map.get_if_local(impl_c.def_id) {
if let Node::NodeImplItem(impl_trait_item) = impl_trait_node {
if let ImplItemKind::Const(ref ty, _) = impl_trait_item.node {
origin = TypeOrigin::Misc(ty.span);
}
}
}

let mut diag = struct_span_err!(
tcx.sess, origin.span(), E0326,
"implemented const `{}` has an incompatible type for trait",
trait_c.name
);

// Add a label to the Span containing just the type of the item
if let Some(orig_trait_node) = tcx.map.get_if_local(trait_c.def_id) {
if let Node::NodeTraitItem(orig_trait_item) = orig_trait_node {
if let TraitItem_::ConstTraitItem(ref ty, _) = orig_trait_item.node {
diag.span_label(ty.span, &format!("original trait requirement"));
}
}
}

infcx.note_type_err(
&mut diag, origin,
Some(infer::ValuePairs::Types(ExpectedFound {
Expand Down
Loading