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 33 pull requests #35571

Closed
wants to merge 74 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
15be66d
Provide a cleaner documentation for 'write!'
cengizio Aug 4, 2016
800aa92
Use consistent spelling for word 'implementor'
cengizio Aug 4, 2016
c630bea
Be more explicit about duck typing
cengizio Aug 4, 2016
751d43a
Ignore VS Code settings directory
vadimcn Aug 5, 2016
2683e84
Update HashMap docs regarding DoS protection
mgattozzi Aug 4, 2016
b79e15d
Update E0191 to the new error format
munyari Aug 5, 2016
2c563c6
Update E0023 to the new format
pcn Aug 7, 2016
abe1cc7
run rustfmt on compiletest folder in src/tools/ folder
srinivasreddy Jun 11, 2016
7c1bb9a
Finish fixing the operator precedence tables
ubsan Aug 7, 2016
56eba5a
Add run-pass test for issue 33498
GuillaumeGomez Aug 7, 2016
ec1ef79
Updated the messages for E0017
pcn Aug 7, 2016
98c6770
Fix formatting of module layout example
Aug 7, 2016
f07f093
Update E0214 to the new error format
munyari Aug 7, 2016
8b111a7
Updated E0087 to new format
Aug 7, 2016
e40df1c
Fix E0132 error display
GuillaumeGomez Aug 7, 2016
e28521e
Remove unnecessary `main` functions in doc examples.
frewsxcv Aug 8, 2016
c6e17ec
Shrink E0205 span label to the trait being implemented
KiChjang Aug 8, 2016
18565c6
book: update example patterns to be more clear
cardoe Aug 7, 2016
bd2bd6c
Shrink span to variant discriminant expression for E0081
KiChjang Aug 8, 2016
a403ddf
Updated E0221 message to new format!
hank-der-hafenarbeiter Aug 8, 2016
6eb0218
updated unit test!
hank-der-hafenarbeiter Aug 8, 2016
ee38609
Updated E0026 to new format.
razielgn Aug 8, 2016
3c04ba2
add test for issue #29053
Aug 8, 2016
daf7c60
Update E0162 to the new format
krzysztofgarczynski Aug 8, 2016
40b2e51
Update E0033 to the new error format
munyari Aug 8, 2016
156c822
Update error messages for E0091 and E0092
stephen-lazaro Aug 8, 2016
da8fed5
Update unit test for E0092
stephen-lazaro Aug 8, 2016
0cb8439
Update E0008 to new format
Aug 8, 2016
0a98d73
Do not span across nodes for E0004
KiChjang Aug 8, 2016
ee076dd
Updated E0433 to new error message. (no bonus)
hank-der-hafenarbeiter Aug 8, 2016
ae9c09d
Updated error for E0045 (no bonus)
hank-der-hafenarbeiter Aug 8, 2016
b5ead00
updated unit test
hank-der-hafenarbeiter Aug 9, 2016
2adc07f
added unit test
hank-der-hafenarbeiter Aug 9, 2016
0e8ec43
Update error message E0384 to new format
theypsilon Aug 9, 2016
71a34d7
Merge branch 'master' of github.com:theypsilon/rust
theypsilon Aug 9, 2016
20ea8cb
Update E0038 to the new error format
munyari Aug 8, 2016
0a3564a
Add tracking issue for `String::insert_str`
murarth Aug 9, 2016
aa40ec7
Update E0007 to new format
Aug 9, 2016
766a0ab
E0128 update error format
circuitfox Aug 9, 2016
46265a0
E0263 updated to new format. rust-lang/rust#35518
Aug 9, 2016
70e760f
Remove redundant `&mut ref mut` in doc for Result::as_mut()
birkenfeld Aug 10, 2016
96c39d2
Rollup merge of #35279 - cengizIO:master, r=brson
steveklabnik Aug 10, 2016
0996264
Rollup merge of #35358 - vadimcn:vscode, r=steveklabnik
steveklabnik Aug 10, 2016
192c8b0
Rollup merge of #35371 - mgattozzi:master, r=steveklabnik
steveklabnik Aug 10, 2016
1bad68b
Rollup merge of #35396 - munyari:e0191, r=jonathandturner
steveklabnik Aug 10, 2016
52258c7
Rollup merge of #35445 - pcn:update-E0017-to-new-format, r=arielb1
steveklabnik Aug 10, 2016
c867f6c
Rollup merge of #35446 - pcn:update-E0023-to-new-format, r=jonathandt…
steveklabnik Aug 10, 2016
7a1015e
Rollup merge of #35448 - srinivasreddy:rf_compiletest, r=nikomatsakis
steveklabnik Aug 10, 2016
41b00f1
Rollup merge of #35449 - poveda-ruiz:master, r=jonathandturner
steveklabnik Aug 10, 2016
7316d22
Rollup merge of #35452 - ubsan:precedence, r=steveklabnik
steveklabnik Aug 10, 2016
4ac3a9d
Rollup merge of #35458 - GuillaumeGomez:test_string_ICE, r=alexcrichton
steveklabnik Aug 10, 2016
2c7a05b
Rollup merge of #35465 - cardoe:pattern-book-update, r=steveklabnik
steveklabnik Aug 10, 2016
7377583
Rollup merge of #35466 - xitep:master, r=steveklabnik
steveklabnik Aug 10, 2016
9c1e4cb
Rollup merge of #35470 - munyari:e0214, r=jonathandturner
steveklabnik Aug 10, 2016
2c78c42
Rollup merge of #35477 - GuillaumeGomez:fix_E0132, r=jonathandturner
steveklabnik Aug 10, 2016
3d5fe6b
Rollup merge of #35482 - frewsxcv:patch-31, r=GuillaumeGomez
steveklabnik Aug 10, 2016
a8d123b
Rollup merge of #35484 - KiChjang:e0205-bonus, r=GuillaumeGomez
steveklabnik Aug 10, 2016
1a96a6d
Rollup merge of #35486 - KiChjang:e0081-bonus, r=jonathandturner
steveklabnik Aug 10, 2016
e44c7ed
Rollup merge of #35504 - razielgn:updated-e0026-to-new-format, r=jona…
steveklabnik Aug 10, 2016
10cbe14
Rollup merge of #35505 - futile:test_29053, r=nikomatsakis
steveklabnik Aug 10, 2016
d021df3
Rollup merge of #35507 - hank-der-hafenarbeiter:master, r=jonathandtu…
steveklabnik Aug 10, 2016
8a0d0a6
Rollup merge of #35524 - garekkream:update-E0162-new-error-format, r=…
steveklabnik Aug 10, 2016
dddc8d5
Rollup merge of #35526 - munyari:e0033, r=jonathandturner
steveklabnik Aug 10, 2016
5847faa
Rollup merge of #35528 - Vassah:master, r=jonathandturner
steveklabnik Aug 10, 2016
c65f1a5
Rollup merge of #35530 - srdja:master, r=jonathandturner
steveklabnik Aug 10, 2016
ecbb3e3
Rollup merge of #35532 - KiChjang:e0004-follow-up, r=jonathandturner
steveklabnik Aug 10, 2016
61915b4
Rollup merge of #35536 - hank-der-hafenarbeiter:E0433, r=jonathandturner
steveklabnik Aug 10, 2016
0e71e44
Rollup merge of #35537 - munyari:e0038, r=jonathandturner
steveklabnik Aug 10, 2016
01d61a1
Rollup merge of #35541 - hank-der-hafenarbeiter:E0045, r=jonathandturner
steveklabnik Aug 10, 2016
785d0f5
Rollup merge of #35552 - theypsilon:master, r=jonathandturner
steveklabnik Aug 10, 2016
928d105
Rollup merge of #35554 - murarth:insert-str-issue, r=apasel422
steveklabnik Aug 10, 2016
5506990
Rollup merge of #35555 - circuitfox:E0128-update-error-format, r=jona…
steveklabnik Aug 10, 2016
11a6619
Rollup merge of #35557 - Limeth:master, r=jonathandturner
steveklabnik Aug 10, 2016
0db7846
Rollup merge of #35562 - birkenfeld:as-mut-doc, r=steveklabnik
steveklabnik Aug 10, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ __pycache__/
.project
.settings/
.valgrindrc
.vscode/
/*-*-*-*/
/*-*-*/
/Makefile
Expand Down
1 change: 1 addition & 0 deletions src/doc/book/crates-and-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ As an example, let’s make a *phrases* crate, which will give us various phrase
in different languages. To keep things simple, we’ll stick to ‘greetings’ and
‘farewells’ as two kinds of phrases, and use English and Japanese (日本語) as
two languages for those phrases to be in. We’ll use this module layout:

```text
+-----------+
+---| greetings |
Expand Down
12 changes: 6 additions & 6 deletions src/doc/book/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ struct Point {
y: i32,
}

let origin = Point { x: 0, y: 0 };
let point = Point { x: 2, y: 3 };

match origin {
match point {
Point { x, .. } => println!("x is {}", x),
}
```

This prints `x is 0`.
This prints `x is 2`.

You can do this kind of match on any member, not only the first:

Expand All @@ -126,14 +126,14 @@ struct Point {
y: i32,
}

let origin = Point { x: 0, y: 0 };
let point = Point { x: 2, y: 3 };

match origin {
match point {
Point { y, .. } => println!("y is {}", y),
}
```

This prints `y is 0`.
This prints `y is 3`.

This ‘destructuring’ behavior works on any compound data type, like
[tuples][tuples] or [enums][enums].
Expand Down
3 changes: 2 additions & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3039,7 +3039,7 @@ The precedence of Rust binary operators is ordered as follows, going from
strong to weak:

```{.text .precedence}
as
as :
* / %
+ -
<< >>
Expand All @@ -3050,6 +3050,7 @@ as
&&
||
.. ...
<-
=
```

Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ impl String {
#[inline]
#[unstable(feature = "insert_str",
reason = "recent addition",
issue = "0")]
issue = "35553")]
pub fn insert_str(&mut self, idx: usize, string: &str) {
let len = self.len();
assert!(idx <= len);
Expand Down
45 changes: 37 additions & 8 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,28 @@ macro_rules! try {
})
}

/// Use the `format!` syntax to write data into a buffer.
/// Write formatted data into a buffer
///
/// This macro is typically used with a buffer of `&mut `[`Write`][write].
/// This macro accepts any value with `write_fmt` method as a writer, a format string, and a list
/// of arguments to format.
///
/// `write_fmt` method usually comes from an implementation of [`std::fmt::Write`][fmt_write] or
/// [`std::io::Write`][io_write] traits. These are sometimes called 'writers'.
///
/// Passed arguments will be formatted according to the specified format string and the resulting
/// string will be passed to the writer.
///
/// See [`std::fmt`][fmt] for more information on format syntax.
///
/// Return value is completely dependent on the 'write_fmt' method.
///
/// Common return values are: [`Result`][enum_result], [`io::Result`][type_result]
///
/// [fmt]: ../std/fmt/index.html
/// [write]: ../std/io/trait.Write.html
/// [fmt_write]: ../std/fmt/trait.Write.html
/// [io_write]: ../std/io/trait.Write.html
/// [enum_result]: ../std/result/enum.Result.html
/// [type_result]: ../std/io/type.Result.html
///
/// # Examples
///
Expand All @@ -255,16 +269,31 @@ macro_rules! write {
($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*)))
}

/// Use the `format!` syntax to write data into a buffer, appending a newline.
/// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`)
/// alone (no additional CARRIAGE RETURN (`\r`/`U+000D`).
/// Write formatted data into a buffer, with appending a newline.
///
/// On all platforms, the newline is the LINE FEED character (`\n`/`U+000A`) alone
/// (no additional CARRIAGE RETURN (`\r`/`U+000D`).
///
/// This macro is typically used with a buffer of `&mut `[`Write`][write].
/// This macro accepts any value with `write_fmt` method as a writer, a format string, and a list
/// of arguments to format.
///
/// `write_fmt` method usually comes from an implementation of [`std::fmt::Write`][fmt_write] or
/// [`std::io::Write`][io_write] traits. These are sometimes called 'writers'.
///
/// Passed arguments will be formatted according to the specified format string and the resulting
/// string will be passed to the writer.
///
/// See [`std::fmt`][fmt] for more information on format syntax.
///
/// Return value is completely dependent on the 'write_fmt' method.
///
/// Common return values are: [`Result`][enum_result], [`io::Result`][type_result]
///
/// [fmt]: ../std/fmt/index.html
/// [write]: ../std/io/trait.Write.html
/// [fmt_write]: ../std/fmt/trait.Write.html
/// [io_write]: ../std/io/trait.Write.html
/// [enum_result]: ../std/result/enum.Result.html
/// [type_result]: ../std/io/type.Result.html
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ impl<T, E> Result<T, E> {
/// ```
/// fn mutate(r: &mut Result<i32, i32>) {
/// match r.as_mut() {
/// Ok(&mut ref mut v) => *v = 42,
/// Err(&mut ref mut e) => *e = 0,
/// Ok(v) => *v = 42,
/// Err(e) => *e = 0,
/// }
/// }
///
Expand Down
12 changes: 8 additions & 4 deletions src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
let lifetime_j = &lifetimes[j];

if lifetime_i.lifetime.name == lifetime_j.lifetime.name {
span_err!(self.sess, lifetime_j.lifetime.span, E0263,
"lifetime name `{}` declared twice in \
the same scope",
lifetime_j.lifetime.name);
struct_span_err!(self.sess, lifetime_j.lifetime.span, E0263,
"lifetime name `{}` declared twice in the same scope",
lifetime_j.lifetime.name)
.span_label(lifetime_j.lifetime.span,
&format!("declared twice"))
.span_label(lifetime_i.lifetime.span,
&format!("previous declaration here"))
.emit();
}
}

Expand Down
13 changes: 9 additions & 4 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
let mut err = match warning_node_id {
Some(_) => None,
None => {
Some(struct_span_err!(
self.sess, span, E0038,
"the trait `{}` cannot be made into an object",
self.item_path_str(trait_def_id)))
let trait_str = self.item_path_str(trait_def_id);
let mut db = struct_span_err!(
self.sess, span, E0038,
"the trait `{}` cannot be made into an object",
trait_str);
db.span_label(span,
&format!("the trait `{}` cannot be made \
into an object", trait_str));
Some(db)
}
};

Expand Down
12 changes: 8 additions & 4 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,12 +760,16 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
lp: &LoanPath<'tcx>,
assign:
&move_data::Assignment) {
struct_span_err!(
let mut err = struct_span_err!(
self.tcx.sess, span, E0384,
"re-assignment of immutable variable `{}`",
self.loan_path_to_string(lp))
.span_note(assign.span, "prior assignment occurs here")
.emit();
self.loan_path_to_string(lp));
err.span_label(span, &format!("re-assignment of immutable variable"));
if span != assign.span {
err.span_label(assign.span, &format!("first assignment to `{}`",
self.loan_path_to_string(lp)));
}
err.emit();
}

pub fn span_err(&self, s: Span, m: &str) {
Expand Down
22 changes: 13 additions & 9 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &hir::Expr) {
.flat_map(|arm| &arm.0)
.map(|pat| vec![wrap_pat(cx, &pat)])
.collect();
let match_span = Span {
lo: ex.span.lo,
hi: scrut.span.hi,
expn_id: ex.span.expn_id
};
check_exhaustive(cx, match_span, &matrix, source);
check_exhaustive(cx, scrut.span, &matrix, source);
},
_ => ()
}
Expand Down Expand Up @@ -316,7 +311,10 @@ fn check_arms(cx: &MatchCheckCtxt,
let &(ref first_arm_pats, _) = &arms[0];
let first_pat = &first_arm_pats[0];
let span = first_pat.span;
span_err!(cx.tcx.sess, span, E0162, "irrefutable if-let pattern");
struct_span_err!(cx.tcx.sess, span, E0162,
"irrefutable if-let pattern")
.span_label(span, &format!("irrefutable pattern"))
.emit();
printed_if_let_err = true;
}
},
Expand Down Expand Up @@ -1112,9 +1110,15 @@ fn check_legality_of_move_bindings(cx: &MatchCheckCtxt,

// x @ Foo(..) is legal, but x @ Foo(y) isn't.
if sub.map_or(false, |p| pat_contains_bindings(&p)) {
span_err!(cx.tcx.sess, p.span, E0007, "cannot bind by-move with sub-bindings");
struct_span_err!(cx.tcx.sess, p.span, E0007,
"cannot bind by-move with sub-bindings")
.span_label(p.span, &format!("binds an already bound by-move value by moving it"))
.emit();
} else if has_guard {
span_err!(cx.tcx.sess, p.span, E0008, "cannot bind by-move into a pattern guard");
struct_span_err!(cx.tcx.sess, p.span, E0008,
"cannot bind by-move into a pattern guard")
.span_label(p.span, &format!("moves value into pattern guard"))
.emit();
} else if by_ref_span.is_some() {
let mut err = struct_span_err!(cx.tcx.sess, p.span, E0009,
"cannot bind by-move and by-ref in the same pattern");
Expand Down
9 changes: 6 additions & 3 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
if !allow {
self.add(Qualif::NOT_CONST);
if self.mode != Mode::Fn {
span_err!(self.tcx.sess, self.span, E0017,
"references in {}s may only refer \
to immutable values", self.mode);
struct_span_err!(self.tcx.sess, self.span, E0017,
"references in {}s may only refer \
to immutable values", self.mode)
.span_label(self.span, &format!("{}s require immutable values",
self.mode))
.emit();
}
}
} else {
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
struct_span_err!(resolver.session, span, E0432, "{}", msg)
}
ResolutionError::FailedToResolve(msg) => {
struct_span_err!(resolver.session, span, E0433, "failed to resolve. {}", msg)
let mut err = struct_span_err!(resolver.session, span, E0433, "failed to resolve. {}", msg);
err.span_label(span, &msg);
err
}
ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => {
struct_span_err!(resolver.session,
Expand Down
24 changes: 16 additions & 8 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
self.convert_angle_bracketed_parameters(rscope, span, decl_generics, data)
}
hir::ParenthesizedParameters(..) => {
span_err!(tcx.sess, span, E0214,
"parenthesized parameters may only be used with a trait");
struct_span_err!(tcx.sess, span, E0214,
"parenthesized parameters may only be used with a trait")
.span_label(span, &format!("only traits may use parentheses"))
.emit();

let ty_param_defs = decl_generics.types.get_slice(TypeSpace);
(Substs::empty(),
ty_param_defs.iter().map(|_| tcx.types.err).collect(),
Expand Down Expand Up @@ -1201,10 +1204,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
}

for (trait_def_id, name) in associated_types {
span_err!(tcx.sess, span, E0191,
struct_span_err!(tcx.sess, span, E0191,
"the value of the associated type `{}` (from the trait `{}`) must be specified",
name,
tcx.item_path_str(trait_def_id));
tcx.item_path_str(trait_def_id))
.span_label(span, &format!(
"missing associated type `{}` value", name))
.emit();
}

tcx.mk_trait(object.principal, object.bounds)
Expand Down Expand Up @@ -1281,10 +1287,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
}

if bounds.len() > 1 {
let mut err = struct_span_err!(self.tcx().sess, span, E0221,
"ambiguous associated type `{}` in bounds of `{}`",
assoc_name,
ty_param_name);
let mut err = struct_span_err!(
self.tcx().sess, span, E0221,
"ambiguous associated type `{}` in bounds of `{}`",
assoc_name,
ty_param_name);
err.span_label(span, &format!("ambiguous associated type `{}`", assoc_name));

for bound in &bounds {
span_note!(&mut err, span,
Expand Down
43 changes: 32 additions & 11 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let ty::TyTrait(..) = mt.ty.sty {
// This is "x = SomeTrait" being reduced from
// "let &x = &SomeTrait" or "let box x = Box<SomeTrait>", an error.
span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced",
self.ty_to_string(expected));
let type_str = self.ty_to_string(expected);
struct_span_err!(self.tcx.sess, span, E0033,
"type `{}` cannot be dereferenced", type_str)
.span_label(span, &format!("type `{}` cannot be dereferenced", type_str))
.emit();
return false
}
}
Expand Down Expand Up @@ -633,10 +635,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.check_pat(&subpat, field_ty);
}
} else {
span_err!(tcx.sess, pat.span, E0023,
"this pattern has {} field{s}, but the corresponding {} has {} field{s}",
subpats.len(), def.kind_name(), variant.fields.len(),
s = if variant.fields.len() == 1 {""} else {"s"});
let subpats_ending = if subpats.len() == 1 {
""
} else {
"s"
};
let fields_ending = if variant.fields.len() == 1 {
""
} else {
"s"
};
struct_span_err!(tcx.sess, pat.span, E0023,
"this pattern has {} field{}, but the corresponding {} has {} field{}",
subpats.len(), subpats_ending, def.kind_name(),
variant.fields.len(), fields_ending)
.span_label(pat.span, &format!("expected {} field{}, found {}",
variant.fields.len(), fields_ending, subpats.len()))
.emit();
on_error();
}
}
Expand Down Expand Up @@ -682,10 +697,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
field_map.get(&field.name)
.map(|f| self.field_ty(span, f, substs))
.unwrap_or_else(|| {
span_err!(tcx.sess, span, E0026,
"struct `{}` does not have a field named `{}`",
tcx.item_path_str(variant.did),
field.name);
struct_span_err!(tcx.sess, span, E0026,
"struct `{}` does not have a field named `{}`",
tcx.item_path_str(variant.did),
field.name)
.span_label(span,
&format!("struct `{}` does not have field `{}`",
tcx.item_path_str(variant.did),
field.name))
.emit();

tcx.types.err
})
}
Expand Down
Loading