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 23 pull requests #35747

Merged
merged 51 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2ed052d
Clarify type declaration language
urschrei Aug 11, 2016
31da7f6
More clarification
urschrei Aug 11, 2016
91a2c25
Add note to docs for &str that example is to demo internals only
JessRudder Aug 11, 2016
d652639
run rustfmt on libsyntax_ext folder
srinivasreddy Jun 6, 2016
4e4d8ba
Add doc example for `std::ffi::CString::from_vec_unchecked`.
frewsxcv Aug 12, 2016
758aff7
Update note to include recommendation to use `.as_slice()`
JessRudder Aug 12, 2016
e173ead
provide additional justification for array interface design
matthew-piziak Aug 11, 2016
19a3337
Update E0207 label to report parameter type
terrynsun Aug 14, 2016
e586d21
Improve `No stdlib` and related Documentation
CryZe Aug 14, 2016
5286a5a
Update E0322 to new format
yossi-k Aug 14, 2016
a026e2c
Update error E0365 to new format
Xinayder Aug 14, 2016
6d998d6
Update E0392 to new error format
canova Aug 14, 2016
fa61f82
Update compiler error 0030 to use new error format.
silenuss Aug 15, 2016
9e39861
Fix spacing in code of closures.md
Rufflewind Jul 11, 2016
85bbbad
A disclaimer about keywords.
steveklabnik Jun 19, 2016
349f10a
update E0375 to new format
mikhail-m1 Aug 15, 2016
18edae4
expound on limitations of Rust's trait-based operator overloading
matthew-piziak Aug 15, 2016
c9f2055
accumulate into vector and assert, instead of printing
matthew-piziak Aug 15, 2016
2c9a1d9
remove `.take(10)` from `Range` example
matthew-piziak Aug 15, 2016
bc52bdc
Implement `Debug` for `std::vec::IntoIter`.
frewsxcv Aug 16, 2016
d52eb1a
RUST_NEW_ERROR_FORMAT is no more
sanxiyn Aug 16, 2016
3aa6340
Use UI test to test spans, instead of forced line break
sanxiyn Aug 16, 2016
16fc025
Bump version to 1.13
brson Aug 16, 2016
d2e7895
Updated E0422 to new error message
Aug 16, 2016
3caa451
Updated E0394 to new error message
Aug 16, 2016
193b9ae
update to new error format E0409
mikhail-m1 Aug 16, 2016
1fc18aa
Update E0005 to use a label
pythoneer Aug 16, 2016
4cfdf63
Update E0005 Unit-Test
pythoneer Aug 16, 2016
e83bff9
Rollup merge of #34370 - steveklabnik:keyword-ref-mention, r=Manishearth
Aug 17, 2016
d3f55e1
Rollup merge of #35415 - silenuss:e0030-formatting, r=jonathandturner
Aug 17, 2016
b8859f6
Rollup merge of #35595 - urschrei:associated_types_docfix, r=stevekla…
Aug 17, 2016
997a248
Rollup merge of #35610 - JessRudder:33637-doc-update-for-str-represen…
Aug 17, 2016
559bfd6
Rollup merge of #35613 - matthew-piziak:array-docs-trait-justificatio…
Aug 17, 2016
74549f8
Rollup merge of #35614 - srinivasreddy:syntax_ext_rustfmt, r=nikomats…
Aug 17, 2016
b444ac6
Rollup merge of #35621 - frewsxcv:cstring-from-vec-doc, r=peschkaj
Aug 17, 2016
a9e3cff
Rollup merge of #35660 - terrynsun:e0207, r=jonathandturner
Aug 17, 2016
ea09b7d
Rollup merge of #35663 - CryZe:no-stdlib, r=Manishearth
Aug 17, 2016
02a8e2c
Rollup merge of #35670 - RockyTV:e0365, r=jonathandturner
Aug 17, 2016
8ff8f77
Rollup merge of #35671 - canaltinova:E0392, r=jonathandturner
Aug 17, 2016
eac17f1
Rollup merge of #35672 - yossi-k:issue/35323, r=GuillaumeGomez
Aug 17, 2016
eb91d33
Rollup merge of #35681 - Rufflewind:patch-1, r=apasel422
Aug 17, 2016
f0f12d9
Rollup merge of #35686 - mikhail-m1:master, r=jonathandturner
Aug 17, 2016
49a2873
Rollup merge of #35690 - matthew-piziak:op-overloading-limited, r=ste…
Aug 17, 2016
c1e9ea0
Rollup merge of #35695 - matthew-piziak:vec-assert-over-println, r=Gu…
Aug 17, 2016
3dd060f
Rollup merge of #35707 - frewsxcv:vec-into-iter-debug, r=alexcrichton
Aug 17, 2016
6193b1f
Rollup merge of #35708 - sanxiyn:new-error-format, r=nikomatsakis
Aug 17, 2016
75454f7
Rollup merge of #35713 - sanxiyn:ui-test, r=nikomatsakis
Aug 17, 2016
5fc58dc
Rollup merge of #35722 - knight42:update-error-msg, r=jonathandturner
Aug 17, 2016
e20a7e3
Rollup merge of #35725 - brson:bump, r=alexcrichton
Aug 17, 2016
fbc62af
Rollup merge of #35726 - mikhail-m1:master2, r=jonathandturner
Aug 17, 2016
c216617
Rollup merge of #35731 - pythoneer:fix-35192, r=jonathandturner
Aug 17, 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
2 changes: 1 addition & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
######################################################################

# The version number
CFG_RELEASE_NUM=1.12.0
CFG_RELEASE_NUM=1.13.0

# An optional number to put after the label, e.g. '.2' -> '-beta.2'
# NB Make sure it starts with a dot to conform to semver pre-release
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/associated-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ trait Graph {
Simple enough. Associated types use the `type` keyword, and go inside the body
of the trait, with the functions.

These `type` declarations can have all the same thing as functions do. For example,
These type declarations work the same way as those for functions. For example,
if we wanted our `N` type to implement `Display`, so we can print the nodes out,
we could do this:

Expand Down
6 changes: 3 additions & 3 deletions src/doc/book/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ the result:

```rust
fn call_with_one<F>(some_closure: F) -> i32
where F : Fn(i32) -> i32 {
where F: Fn(i32) -> i32 {

some_closure(1)
}
Expand All @@ -279,7 +279,7 @@ Let’s examine the signature of `call_with_one` in more depth:

```rust
fn call_with_one<F>(some_closure: F) -> i32
# where F : Fn(i32) -> i32 {
# where F: Fn(i32) -> i32 {
# some_closure(1) }
```

Expand All @@ -288,7 +288,7 @@ isn’t interesting. The next part is:

```rust
# fn call_with_one<F>(some_closure: F) -> i32
where F : Fn(i32) -> i32 {
where F: Fn(i32) -> i32 {
# some_closure(1) }
```

Expand Down
8 changes: 4 additions & 4 deletions src/doc/book/lang-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ fn main(argc: isize, argv: *const *const u8) -> isize {
0
}

#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
#[lang = "eh_personality"] extern fn rust_eh_personality() {}
#[lang = "panic_fmt"] extern fn rust_begin_panic() -> ! { loop {} }
# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
# #[no_mangle] pub extern fn rust_eh_register_frames () {}
# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
Expand All @@ -73,8 +73,8 @@ Other features provided by lang items include:
`==`, `<`, dereferencing (`*`) and `+` (etc.) operators are all
marked with lang items; those specific four are `eq`, `ord`,
`deref`, and `add` respectively.
- stack unwinding and general failure; the `eh_personality`, `fail`
and `fail_bounds_checks` lang items.
- stack unwinding and general failure; the `eh_personality`,
`eh_unwind_resume`, `fail` and `fail_bounds_checks` lang items.
- the traits in `std::marker` used to indicate types of
various kinds; lang items `send`, `sync` and `copy`.
- the marker types and variance indicators found in
Expand Down
33 changes: 25 additions & 8 deletions src/doc/book/no-stdlib.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
// provided by libstd.
#[lang = "eh_personality"]
#[no_mangle]
pub extern fn eh_personality() {
pub extern fn rust_eh_personality() {
}

// This function may be needed based on the compilation target.
#[lang = "eh_unwind_resume"]
#[no_mangle]
pub extern fn rust_eh_unwind_resume() {
}

#[lang = "panic_fmt"]
Expand Down Expand Up @@ -87,12 +93,18 @@ pub extern fn main(_argc: i32, _argv: *const *const u8) -> i32 {
0
}

// These functions and traits are used by the compiler, but not
// These functions are used by the compiler, but not
// for a bare-bones hello world. These are normally
// provided by libstd.
#[lang = "eh_personality"]
#[no_mangle]
pub extern fn eh_personality() {
pub extern fn rust_eh_personality() {
}

// This function may be needed based on the compilation target.
#[lang = "eh_unwind_resume"]
#[no_mangle]
pub extern fn rust_eh_unwind_resume() {
}

#[lang = "panic_fmt"]
Expand All @@ -104,23 +116,28 @@ pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
}
```

## More about the langauge items
## More about the language items

The compiler currently makes a few assumptions about symbols which are
available in the executable to call. Normally these functions are provided by
the standard library, but without it you must define your own. These symbols
are called "language items", and they each have an internal name, and then a
signature that an implementation must conform to.

The first of these two functions, `eh_personality`, is used by the failure
The first of these functions, `rust_eh_personality`, is used by the failure
mechanisms of the compiler. This is often mapped to GCC's personality function
(see the [libstd implementation][unwind] for more information), but crates
which do not trigger a panic can be assured that this function is never
called. Both the language item and the symbol name are `eh_personality`.
called. The language item's name is `eh_personality`.

[unwind]: https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/gcc.rs

The second function, `panic_fmt`, is also used by the failure mechanisms of the
The second function, `rust_begin_panic`, is also used by the failure mechanisms of the
compiler. When a panic happens, this controls the message that's displayed on
the screen. While the language item's name is `panic_fmt`, the symbol name is
`rust_begin_panic`.

A third function, `rust_eh_unwind_resume`, is also needed if the `custom_unwind_resume`
flag is set in the options of the compilation target. It allows customizing the
process of resuming unwind at the end of the landing pads. The language item's name
is `eh_unwind_resume`.
5 changes: 5 additions & 0 deletions src/doc/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ token : simple_token | ident | literal | symbol | whitespace token ;
Each of these keywords has special meaning in its grammar, and all of them are
excluded from the `ident` rule.

Not all of these keywords are used by the language. Some of them were used
before Rust 1.0, and were left reserved once their implementations were
removed. Some of them were reserved before 1.0 to make space for possible
future features.

### Literals

```antlr
Expand Down
9 changes: 9 additions & 0 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,15 @@ pub struct IntoIter<T> {
end: *const T,
}

#[stable(feature = "vec_intoiter_debug", since = "")]
impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("IntoIter")
.field(&self.as_slice())
.finish()
}
}

impl<T> IntoIter<T> {
/// Returns the remaining items of this iterator as a slice.
///
Expand Down
8 changes: 8 additions & 0 deletions src/libcollectionstest/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,14 @@ fn test_into_iter_as_mut_slice() {
assert_eq!(into_iter.as_slice(), &['y', 'c']);
}

#[test]
fn test_into_iter_debug() {
let vec = vec!['a', 'b', 'c'];
let into_iter = vec.into_iter();
let debug = format!("{:?}", into_iter);
assert_eq!(debug, "IntoIter(['a', 'b', 'c'])");
}

#[test]
fn test_into_iter_count() {
assert_eq!(vec![1, 2, 3].into_iter().count(), 3);
Expand Down
17 changes: 2 additions & 15 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,20 +295,8 @@ impl<A: Step> ops::Range<A> {
///
/// ```
/// #![feature(step_by)]
///
/// for i in (0..10).step_by(2) {
/// println!("{}", i);
/// }
/// ```
///
/// This prints:
///
/// ```text
/// 0
/// 2
/// 4
/// 6
/// 8
/// let result: Vec<_> = (0..10).step_by(2).collect();
/// assert_eq!(result, vec![0, 2, 4, 6, 8]);
/// ```
#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
Expand Down Expand Up @@ -650,4 +638,3 @@ impl<A: Step> DoubleEndedIterator for ops::RangeInclusive<A> where
n
}
}

5 changes: 5 additions & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
//! line. It is up to consumers of this core library to define this panic
//! function; it is only required to never return. This requires a `lang`
//! attribute named `panic_fmt`.
//!
//! * `rust_eh_personality` - is used by the failure mechanisms of the
//! compiler. This is often mapped to GCC's personality function, but crates
//! which do not trigger a panic can be assured that this function is never
//! called. The `lang` attribute is called `eh_personality`.

// Since libcore defines many fundamental lang items, all tests live in a
// separate crate, libcoretest, to avoid bizarre issues.
Expand Down
11 changes: 8 additions & 3 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@

//! Overloadable operators.
//!
//! Implementing these traits allows you to get an effect similar to
//! overloading operators.
//! Implementing these traits allows you to overload certain operators.
//!
//! Some of these traits are imported by the prelude, so they are available in
//! every Rust program.
//! every Rust program. Only operators backed by traits can be overloaded. For
//! example, the addition operator (`+`) can be overloaded through the `Add`
//! trait, but since the assignment operator (`=`) has no backing trait, there
//! is no way of overloading its semantics. Additionally, this module does not
//! provide any mechanism to create new operators. If traitless overloading or
//! custom operators are required, you should look toward macros or compiler
//! plugins to extend Rust's syntax.
//!
//! Many of the operators take their operands by value. In non-generic
//! contexts involving built-in types, this is usually not a problem.
Expand Down
7 changes: 4 additions & 3 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1073,11 +1073,12 @@ fn check_irrefutable(cx: &MatchCheckCtxt, pat: &Pat, is_fn_arg: bool) {
};

is_refutable(cx, pat, |uncovered_pat| {
span_err!(cx.tcx.sess, pat.span, E0005,
let pattern_string = pat_to_string(uncovered_pat);
struct_span_err!(cx.tcx.sess, pat.span, E0005,
"refutable pattern in {}: `{}` not covered",
origin,
pat_to_string(uncovered_pat),
);
pattern_string,
).span_label(pat.span, &format!("pattern `{}` not covered", pattern_string)).emit();
});
}

Expand Down
5 changes: 4 additions & 1 deletion src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
} else {
"cannot refer to statics by value, use a constant instead"
};
span_err!(self.tcx.sess, self.span, E0394, "{}", msg);
struct_span_err!(self.tcx.sess, self.span, E0394, "{}", msg)
.span_label(self.span, &format!("referring to another static by value"))
.note(&format!("use the address-of operator or a constant instead"))
.emit();

// Replace STATIC with NOT_CONST to avoid further errors.
self.qualif = self.qualif - Qualif::STATIC;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_passes/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckCrateVisitor<'a, 'tcx> {
Ok(Ordering::Less) |
Ok(Ordering::Equal) => {}
Ok(Ordering::Greater) => {
span_err!(self.tcx.sess,
start.span,
E0030,
"lower range bound must be less than or equal to upper");
struct_span_err!(self.tcx.sess, start.span, E0030,
"lower range bound must be less than or equal to upper")
.span_label(start.span, &format!("lower bound larger than upper bound"))
.emit();
}
Err(ErrorReported) => {}
}
Expand Down
25 changes: 17 additions & 8 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ enum ResolutionError<'a> {
/// error E0408: variable `{}` from pattern #{} is not bound in pattern #{}
VariableNotBoundInPattern(Name, usize, usize),
/// error E0409: variable is bound with different mode in pattern #{} than in pattern #1
VariableBoundWithDifferentMode(Name, usize),
VariableBoundWithDifferentMode(Name, usize, Span),
/// error E0411: use of `Self` outside of an impl or trait
SelfUsedOutsideImplOrTrait,
/// error E0412: use of undeclared
Expand Down Expand Up @@ -269,14 +269,19 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
from,
to)
}
ResolutionError::VariableBoundWithDifferentMode(variable_name, pattern_number) => {
struct_span_err!(resolver.session,
ResolutionError::VariableBoundWithDifferentMode(variable_name,
pattern_number,
first_binding_span) => {
let mut err = struct_span_err!(resolver.session,
span,
E0409,
"variable `{}` is bound with different mode in pattern #{} than in \
pattern #1",
variable_name,
pattern_number)
pattern_number);
err.span_label(span, &format!("bound in different ways"));
err.span_label(first_binding_span, &format!("first binding"));
err
}
ResolutionError::SelfUsedOutsideImplOrTrait => {
let mut err = struct_span_err!(resolver.session,
Expand Down Expand Up @@ -316,11 +321,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
err
}
ResolutionError::DoesNotNameAStruct(name) => {
struct_span_err!(resolver.session,
let mut err = struct_span_err!(resolver.session,
span,
E0422,
"`{}` does not name a structure",
name)
name);
err.span_label(span, &format!("not a structure"));
err
}
ResolutionError::StructVariantUsedAsFunction(path_name) => {
struct_span_err!(resolver.session,
Expand Down Expand Up @@ -2028,8 +2035,10 @@ impl<'a> Resolver<'a> {
if binding_0.binding_mode != binding_i.binding_mode {
resolve_error(self,
binding_i.span,
ResolutionError::VariableBoundWithDifferentMode(key.name,
i + 1));
ResolutionError::VariableBoundWithDifferentMode(
key.name,
i + 1,
binding_0.span));
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
source);
self.session.add_lint(PRIVATE_IN_PUBLIC, directive.id, directive.span, msg);
} else {
let msg = format!("`{}` is private, and cannot be reexported", source);
let note_msg =
format!("consider declaring type or module `{}` with `pub`", source);
struct_span_err!(self.session, directive.span, E0365, "{}", &msg)
.span_note(directive.span, &note_msg)
.emit();
let mut err = struct_span_err!(self.session, directive.span, E0365,
"`{}` is private, and cannot be reexported",
source);
err.span_label(directive.span, &format!("reexport of private `{}`", source));
err.note(&format!("consider declaring type or module `{}` with `pub`", source));
err.emit();
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/librustc_typeck/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,10 @@ fn error_380(ccx: &CrateCtxt, span: Span) {

fn error_392<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, span: Span, param_name: ast::Name)
-> DiagnosticBuilder<'tcx> {
struct_span_err!(ccx.tcx.sess, span, E0392,
"parameter `{}` is never used", param_name)
let mut err = struct_span_err!(ccx.tcx.sess, span, E0392,
"parameter `{}` is never used", param_name);
err.span_label(span, &format!("unused type parameter"));
err
}

fn error_194(tcx: TyCtxt, span: Span, name: ast::Name) {
Expand Down
Loading