Skip to content

Commit 444ff9f

Browse files
authored
Auto merge of #35407 - eddyb:rollup, r=eddyb
Rollup of 21 pull requests - Successful merges: #33951, #34916, #35287, #35288, #35351, #35353, #35356, #35362, #35363, #35364, #35366, #35368, #35370, #35372, #35373, #35374, #35375, #35376, #35380, #35393, #35394 - Failed merges: #35331, #35395
2 parents ecdd51b + 67f0822 commit 444ff9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+701
-260
lines changed

man/rustc.1

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTC "1" "August 2015" "rustc 1.2.0" "User Commands"
1+
.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands"
22
.SH NAME
33
rustc \- The Rust compiler
44
.SH SYNOPSIS
@@ -299,7 +299,7 @@ To build an executable with debug info:
299299
See https://github.com/rust\-lang/rust/issues for issues.
300300

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

304304
.SH "COPYRIGHT"
305305
This work is dual\[hy]licensed under Apache\ 2.0 and MIT terms.

man/rustdoc.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTDOC "1" "August 2015" "rustdoc 1.2.0" "User Commands"
1+
.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
22
.SH NAME
33
rustdoc \- generate documentation from Rust source code
44
.SH SYNOPSIS

src/libcore/raw.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
/// only designed to be used by unsafe code that needs to manipulate
3535
/// the low-level details.
3636
///
37-
/// There is no `Repr` implementation for `TraitObject` because there
38-
/// is no way to refer to all trait objects generically, so the only
37+
/// There is no way to refer to all trait objects generically, so the only
3938
/// way to create values of this type is with functions like
40-
/// `std::mem::transmute`. Similarly, the only way to create a true
39+
/// [`std::mem::transmute`][transmute]. Similarly, the only way to create a true
4140
/// trait object from a `TraitObject` value is with `transmute`.
4241
///
42+
/// [transmute]: ../intrinsics/fn.transmute.html
43+
///
4344
/// Synthesizing a trait object with mismatched types—one where the
4445
/// vtable does not correspond to the type of the value to which the
4546
/// data pointer points—is highly likely to lead to undefined
@@ -50,13 +51,13 @@
5051
/// ```
5152
/// #![feature(raw)]
5253
///
53-
/// use std::mem;
54-
/// use std::raw;
54+
/// use std::{mem, raw};
5555
///
5656
/// // an example trait
5757
/// trait Foo {
5858
/// fn bar(&self) -> i32;
5959
/// }
60+
///
6061
/// impl Foo for i32 {
6162
/// fn bar(&self) -> i32 {
6263
/// *self + 1
@@ -74,19 +75,18 @@
7475
/// // the data pointer is the address of `value`
7576
/// assert_eq!(raw_object.data as *const i32, &value as *const _);
7677
///
77-
///
7878
/// let other_value: i32 = 456;
7979
///
8080
/// // construct a new object, pointing to a different `i32`, being
8181
/// // careful to use the `i32` vtable from `object`
8282
/// let synthesized: &Foo = unsafe {
8383
/// mem::transmute(raw::TraitObject {
8484
/// data: &other_value as *const _ as *mut (),
85-
/// vtable: raw_object.vtable
85+
/// vtable: raw_object.vtable,
8686
/// })
8787
/// };
8888
///
89-
/// // it should work just like we constructed a trait object out of
89+
/// // it should work just as if we had constructed a trait object out of
9090
/// // `other_value` directly
9191
/// assert_eq!(synthesized.bar(), 457);
9292
/// ```

src/librustc/middle/astconv_util.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
4747

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

5455
pub fn prim_ty_to_ty(self,

src/librustc_borrowck/borrowck/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -942,9 +942,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
942942
but it borrows {}, \
943943
which is owned by the current function",
944944
cmt_path_or_string)
945-
.span_note(capture_span,
945+
.span_label(capture_span,
946946
&format!("{} is borrowed here",
947947
cmt_path_or_string))
948+
.span_label(err.span,
949+
&format!("may outlive borrowed value {}",
950+
cmt_path_or_string))
948951
.span_suggestion(err.span,
949952
&format!("to force the closure to take ownership of {} \
950953
(and any other referenced variables), \

src/librustc_const_eval/check_match.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,15 @@ fn check_exhaustive<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>,
424424
format!("`{}` and {} more", head.join("`, `"), tail.len())
425425
}
426426
};
427-
span_err!(cx.tcx.sess, sp, E0004,
427+
428+
let label_text = match pattern_strings.len(){
429+
1 => format!("pattern {} not covered", joined_patterns),
430+
_ => format!("patterns {} not covered", joined_patterns)
431+
};
432+
struct_span_err!(cx.tcx.sess, sp, E0004,
428433
"non-exhaustive patterns: {} not covered",
429434
joined_patterns
430-
);
435+
).span_label(sp, &label_text).emit();
431436
},
432437
}
433438
}

src/librustc_const_eval/eval.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1337,10 +1337,13 @@ pub fn eval_length<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
13371337
Ok(val as usize)
13381338
},
13391339
Ok(const_val) => {
1340-
span_err!(tcx.sess, count_expr.span, E0306,
1341-
"expected usize for {}, found {}",
1342-
reason,
1343-
const_val.description());
1340+
struct_span_err!(tcx.sess, count_expr.span, E0306,
1341+
"expected `usize` for {}, found {}",
1342+
reason,
1343+
const_val.description())
1344+
.span_label(count_expr.span, &format!("expected `usize`"))
1345+
.emit();
1346+
13441347
Err(ErrorReported)
13451348
}
13461349
Err(err) => {

src/librustc_passes/ast_validation.rs

+60-41
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,18 @@ impl<'a> AstValidator<'a> {
3838
self.err_handler().span_err(span, &format!("invalid label name `{}`", label.name));
3939
}
4040
if label.name.as_str() == "'_" {
41-
self.session.add_lint(
42-
lint::builtin::LIFETIME_UNDERSCORE, id, span,
43-
format!("invalid label name `{}`", label.name)
44-
);
41+
self.session.add_lint(lint::builtin::LIFETIME_UNDERSCORE,
42+
id,
43+
span,
44+
format!("invalid label name `{}`", label.name));
4545
}
4646
}
4747

4848
fn invalid_visibility(&self, vis: &Visibility, span: Span, note: Option<&str>) {
4949
if vis != &Visibility::Inherited {
50-
let mut err = struct_span_err!(self.session, span, E0449,
50+
let mut err = struct_span_err!(self.session,
51+
span,
52+
E0449,
5153
"unnecessary visibility qualifier");
5254
if let Some(note) = note {
5355
err.span_note(span, note);
@@ -71,20 +73,23 @@ impl<'a> AstValidator<'a> {
7173
impl<'a> Visitor for AstValidator<'a> {
7274
fn visit_lifetime(&mut self, lt: &Lifetime) {
7375
if lt.name.as_str() == "'_" {
74-
self.session.add_lint(
75-
lint::builtin::LIFETIME_UNDERSCORE, lt.id, lt.span,
76-
format!("invalid lifetime name `{}`", lt.name)
77-
);
76+
self.session.add_lint(lint::builtin::LIFETIME_UNDERSCORE,
77+
lt.id,
78+
lt.span,
79+
format!("invalid lifetime name `{}`", lt.name));
7880
}
7981

8082
visit::walk_lifetime(self, lt)
8183
}
8284

8385
fn visit_expr(&mut self, expr: &Expr) {
8486
match expr.node {
85-
ExprKind::While(_, _, Some(ident)) | ExprKind::Loop(_, Some(ident)) |
86-
ExprKind::WhileLet(_, _, _, Some(ident)) | ExprKind::ForLoop(_, _, _, Some(ident)) |
87-
ExprKind::Break(Some(ident)) | ExprKind::Continue(Some(ident)) => {
87+
ExprKind::While(_, _, Some(ident)) |
88+
ExprKind::Loop(_, Some(ident)) |
89+
ExprKind::WhileLet(_, _, _, Some(ident)) |
90+
ExprKind::ForLoop(_, _, _, Some(ident)) |
91+
ExprKind::Break(Some(ident)) |
92+
ExprKind::Continue(Some(ident)) => {
8893
self.check_label(ident.node, ident.span, expr.id);
8994
}
9095
_ => {}
@@ -97,10 +102,13 @@ impl<'a> Visitor for AstValidator<'a> {
97102
match ty.node {
98103
TyKind::BareFn(ref bfty) => {
99104
self.check_decl_no_pat(&bfty.decl, |span, _| {
100-
let mut err = struct_span_err!(self.session, span, E0561,
101-
"patterns aren't allowed in function pointer types");
102-
err.span_note(span, "this is a recent error, see \
103-
issue #35203 for more details");
105+
let mut err = struct_span_err!(self.session,
106+
span,
107+
E0561,
108+
"patterns aren't allowed in function pointer \
109+
types");
110+
err.span_note(span,
111+
"this is a recent error, see issue #35203 for more details");
104112
err.emit();
105113
});
106114
}
@@ -114,10 +122,10 @@ impl<'a> Visitor for AstValidator<'a> {
114122
if path.global && path.segments.len() > 0 {
115123
let ident = path.segments[0].identifier;
116124
if token::Ident(ident).is_path_segment_keyword() {
117-
self.session.add_lint(
118-
lint::builtin::SUPER_OR_SELF_IN_GLOBAL_PATH, id, path.span,
119-
format!("global paths cannot start with `{}`", ident)
120-
);
125+
self.session.add_lint(lint::builtin::SUPER_OR_SELF_IN_GLOBAL_PATH,
126+
id,
127+
path.span,
128+
format!("global paths cannot start with `{}`", ident));
121129
}
122130
}
123131

@@ -129,8 +137,8 @@ impl<'a> Visitor for AstValidator<'a> {
129137
ItemKind::Use(ref view_path) => {
130138
let path = view_path.node.path();
131139
if !path.segments.iter().all(|segment| segment.parameters.is_empty()) {
132-
self.err_handler().span_err(path.span, "type or lifetime parameters \
133-
in import path");
140+
self.err_handler()
141+
.span_err(path.span, "type or lifetime parameters in import path");
134142
}
135143
}
136144
ItemKind::Impl(_, _, _, Some(..), _, ref impl_items) => {
@@ -140,15 +148,18 @@ impl<'a> Visitor for AstValidator<'a> {
140148
}
141149
}
142150
ItemKind::Impl(_, _, _, None, _, _) => {
143-
self.invalid_visibility(&item.vis, item.span, Some("place qualifiers on individual \
144-
impl items instead"));
151+
self.invalid_visibility(&item.vis,
152+
item.span,
153+
Some("place qualifiers on individual impl items instead"));
145154
}
146155
ItemKind::DefaultImpl(..) => {
147156
self.invalid_visibility(&item.vis, item.span, None);
148157
}
149158
ItemKind::ForeignMod(..) => {
150-
self.invalid_visibility(&item.vis, item.span, Some("place qualifiers on individual \
151-
foreign items instead"));
159+
self.invalid_visibility(&item.vis,
160+
item.span,
161+
Some("place qualifiers on individual foreign items \
162+
instead"));
152163
}
153164
ItemKind::Enum(ref def, _) => {
154165
for variant in &def.variants {
@@ -167,11 +178,14 @@ impl<'a> Visitor for AstValidator<'a> {
167178
match fi.node {
168179
ForeignItemKind::Fn(ref decl, _) => {
169180
self.check_decl_no_pat(decl, |span, is_recent| {
170-
let mut err = struct_span_err!(self.session, span, E0130,
171-
"patterns aren't allowed in foreign function declarations");
181+
let mut err = struct_span_err!(self.session,
182+
span,
183+
E0130,
184+
"patterns aren't allowed in foreign function \
185+
declarations");
172186
if is_recent {
173-
err.span_note(span, "this is a recent error, see \
174-
issue #35203 for more details");
187+
err.span_note(span,
188+
"this is a recent error, see issue #35203 for more details");
175189
}
176190
err.emit();
177191
});
@@ -182,16 +196,21 @@ impl<'a> Visitor for AstValidator<'a> {
182196
visit::walk_foreign_item(self, fi)
183197
}
184198

185-
fn visit_variant_data(&mut self, vdata: &VariantData, _: Ident,
186-
_: &Generics, _: NodeId, span: Span) {
199+
fn visit_variant_data(&mut self,
200+
vdata: &VariantData,
201+
_: Ident,
202+
_: &Generics,
203+
_: NodeId,
204+
span: Span) {
187205
if vdata.fields().is_empty() {
188206
if vdata.is_tuple() {
189-
self.err_handler().struct_span_err(span, "empty tuple structs and enum variants \
190-
are not allowed, use unit structs and \
191-
enum variants instead")
192-
.span_help(span, "remove trailing `()` to make a unit \
193-
struct or unit enum variant")
194-
.emit();
207+
self.err_handler()
208+
.struct_span_err(span,
209+
"empty tuple structs and enum variants are not allowed, use \
210+
unit structs and enum variants instead")
211+
.span_help(span,
212+
"remove trailing `()` to make a unit struct or unit enum variant")
213+
.emit();
195214
}
196215
}
197216

@@ -200,10 +219,10 @@ impl<'a> Visitor for AstValidator<'a> {
200219

201220
fn visit_vis(&mut self, vis: &Visibility) {
202221
match *vis {
203-
Visibility::Restricted{ref path, ..} => {
222+
Visibility::Restricted { ref path, .. } => {
204223
if !path.segments.iter().all(|segment| segment.parameters.is_empty()) {
205-
self.err_handler().span_err(path.span, "type or lifetime parameters \
206-
in visibility path");
224+
self.err_handler()
225+
.span_err(path.span, "type or lifetime parameters in visibility path");
207226
}
208227
}
209228
_ => {}

0 commit comments

Comments
 (0)