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 20 pull requests #27209

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
fc16c3e
Improve the expected constant integer error message
jawline Jul 4, 2015
3a009cb
Merge branch 'master' of https://github.com/mmjack/rust
jawline Jul 4, 2015
f395b2b
Make the message slightly clearer
jawline Jul 4, 2015
8c5ffd3
Reduce line length
jawline Jul 4, 2015
02dd732
Self.sess -> txc.sess
jawline Jul 5, 2015
4872463
Remove 'valid' from error
jawline Jul 5, 2015
affbc72
Modified to add 'found' to error message instead
jawline Jul 19, 2015
b684826
add test for #20162
apasel422 Jul 19, 2015
871ccfb
Add a test for #26468
dotdash Jul 20, 2015
9bb6545
add test for #14229
apasel422 Jul 20, 2015
4c73dbd
add test for #19404
apasel422 Jul 20, 2015
31a62d3
s/has gained/has not gained/g
pfalabella Jul 20, 2015
a7e5c63
add test for #10436
apasel422 Jul 20, 2015
3ae7b72
Fix wording nit for E0253
AlisdairO Jul 20, 2015
27fc0f2
Document iterators in std::io
steveklabnik Jul 20, 2015
686d326
Add diagnostics for E0172, fix inline error message for E0139
AlisdairO Jul 19, 2015
7e7ec6b
Document structures in std::io::utils
steveklabnik Jul 20, 2015
9e18326
Update docs for take and broadcast
steveklabnik Jul 20, 2015
a29c834
Add travis config to TRPL: release channels
steveklabnik Jul 21, 2015
0eb7303
Add E0403 error explanation
GuillaumeGomez Jul 17, 2015
cd385cb
Add E0405 error explanation
GuillaumeGomez Jul 17, 2015
bc79f20
Add E0404 error explanation
GuillaumeGomez Jul 17, 2015
9581154
Add E0407 error explanation
GuillaumeGomez Jul 17, 2015
c13295b
Add E0428 error explanation
GuillaumeGomez Jul 17, 2015
d2aee95
Expand documentation for IntoInnerError
steveklabnik Jul 20, 2015
94b8f28
Improve documentation for std::io::LineWriter
steveklabnik Jul 20, 2015
2e919b4
Add E0433 error explanation
GuillaumeGomez Jul 17, 2015
e6d8434
add test for #14382
apasel422 Jul 20, 2015
a5c7b96
Add info about usage of 'unsafe' keyword in bindings to foreign inter…
Jul 21, 2015
48870d4
rust -> Rust
Jul 21, 2015
cf1e078
Klabnik nit-picks ;)
ticki Jul 21, 2015
18f115c
update compile-fail test for #21174 to account for #27127
apasel422 Jul 21, 2015
e22c6f7
Improve documentation for std::io::BufWriter
steveklabnik Jul 20, 2015
08f9001
Rollup merge of #26778 - jawline:master, r=pnkfelix
steveklabnik Jul 22, 2015
e6b5c96
Rollup merge of #27084 - GuillaumeGomez:patch-2, r=brson
steveklabnik Jul 22, 2015
9e11d4f
Rollup merge of #27127 - AlisdairO:diagnostics172, r=Manishearth
steveklabnik Jul 22, 2015
a7590e3
Rollup merge of #27131 - apasel422:issue-20162, r=arielb1
steveklabnik Jul 22, 2015
4c66f1a
Rollup merge of #27140 - dotdash:test-26468, r=luqmana
steveklabnik Jul 22, 2015
7d5587a
Rollup merge of #27146 - apasel422:issue-14229, r=alexcrichton
steveklabnik Jul 22, 2015
760365d
Rollup merge of #27147 - apasel422:issue-19404, r=alexcrichton
steveklabnik Jul 22, 2015
c7f1ae5
Rollup merge of #27151 - pfalabella:patch-2, r=steveklabnik
steveklabnik Jul 22, 2015
3d9a966
Rollup merge of #27154 - apasel422:issue-10436, r=Gankro
steveklabnik Jul 22, 2015
4ee25be
Rollup merge of #27155 - steveklabnik:doc_std_io_buf_writer, r=alexcr…
steveklabnik Jul 22, 2015
f3bffc4
Rollup merge of #27156 - AlisdairO:diagnostics253, r=Manishearth
steveklabnik Jul 22, 2015
d02c001
Rollup merge of #27157 - steveklabnik:doc_std_io_iterators, r=alexcri…
steveklabnik Jul 22, 2015
ac241dd
Rollup merge of #27158 - apasel422:issue-14382, r=alexcrichton
steveklabnik Jul 22, 2015
2af8ea2
Rollup merge of #27164 - steveklabnik:doc_io_utils, r=alexcrichton
steveklabnik Jul 22, 2015
3fc7be4
Rollup merge of #27166 - steveklabnik:doc_std_io_linewriter, r=alexcr…
steveklabnik Jul 22, 2015
18e0146
Rollup merge of #27167 - steveklabnik:doc_std_io_take, r=alexcrichton
steveklabnik Jul 22, 2015
4ac5308
Rollup merge of #27170 - steveklabnik:doc_std_io_intoinnererror, r=al…
steveklabnik Jul 22, 2015
9b98166
Rollup merge of #27175 - steveklabnik:channels_plus_travis, r=alexcri…
steveklabnik Jul 22, 2015
c38024d
Rollup merge of #27201 - Ticki:master, r=steveklabnik
steveklabnik Jul 22, 2015
9c8a0d9
Rollup merge of #27202 - apasel422:issue-21174, r=alexcrichton
steveklabnik Jul 22, 2015
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
8 changes: 4 additions & 4 deletions src/doc/trpl/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ libraries:
Note that frameworks are only available on OSX targets.

The different `kind` values are meant to differentiate how the native library
participates in linkage. From a linkage perspective, the rust compiler creates
participates in linkage. From a linkage perspective, the Rust compiler creates
two flavors of artifacts: partial (rlib/staticlib) and final (dylib/binary).
Native dynamic library and framework dependencies are propagated to the final
artifact boundary, while static library dependencies are not propagated at
Expand All @@ -350,9 +350,9 @@ artifact.
A few examples of how this model can be used are:

* A native build dependency. Sometimes some C/C++ glue is needed when writing
some rust code, but distribution of the C/C++ code in a library format is just
some Rust code, but distribution of the C/C++ code in a library format is just
a burden. In this case, the code will be archived into `libfoo.a` and then the
rust crate would declare a dependency via `#[link(name = "foo", kind =
Rust crate would declare a dependency via `#[link(name = "foo", kind =
"static")]`.

Regardless of the flavor of output for the crate, the native static library
Expand All @@ -361,7 +361,7 @@ A few examples of how this model can be used are:

* A normal dynamic dependency. Common system libraries (like `readline`) are
available on a large number of systems, and often a static copy of these
libraries cannot be found. When this dependency is included in a rust crate,
libraries cannot be found. When this dependency is included in a Rust crate,
partial targets (like rlibs) will not link to the library, but when the rlib
is included in a final target (like a binary), the native library will be
linked in.
Expand Down
23 changes: 23 additions & 0 deletions src/doc/trpl/release-channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,26 @@ This will help alert the team in case there’s an accidental regression.
Additionally, testing against nightly can catch regressions even sooner, and so
if you don’t mind a third build, we’d appreciate testing against all channels.

As an example, many Rust programmers use [Travis](https://travis-ci.org/) to
test their crates, which is free for open source projects. Travis [supports
Rust directly][travis], and you can use a `.travis.yml` file like this to
test on all channels:

```yaml
language: rust
rust:
- nightly
- beta
- stable

matrix:
allow_failures:
- rust: nightly
```

[travis]: http://docs.travis-ci.com/user/languages/rust/

With this configuration, Travis will test all three channels, but if something
breaks on nightly, it won’t fail your build. A similar configuration is
recommended for any CI system, check the documentation of the one you’re
using for more details.
10 changes: 7 additions & 3 deletions src/doc/trpl/unsafe.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ that you normally can not do. Just three. Here they are:

That’s it. It’s important that `unsafe` does not, for example, ‘turn off the
borrow checker’. Adding `unsafe` to some random Rust code doesn’t change its
semantics, it won’t just start accepting anything.
semantics, it won’t just start accepting anything. But it will let you write
things that _do_ break some of the rules.

But it will let you write things that _do_ break some of the rules. Let’s go
over these three abilities in order.
You will also encounter the `unsafe` keyword when writing bindings to foreign
(non-Rust) interfaces. You're encouraged to write a safe, native Rust interface
around the methods provided by the library.

Let’s go over the basic three abilities listed, in order.

## Access or update a `static mut`

Expand Down
8 changes: 4 additions & 4 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
#[unstable(feature = "iter_unfold")]
#[derive(Clone)]
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
reason = "has not gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub struct Unfold<St, F> {
Expand All @@ -2567,7 +2567,7 @@ pub struct Unfold<St, F> {

#[unstable(feature = "iter_unfold")]
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
reason = "has not gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
Expand Down Expand Up @@ -3018,7 +3018,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
/// from a given seed value.
#[unstable(feature = "iter_iterate")]
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
reason = "has not gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
Expand All @@ -3027,7 +3027,7 @@ pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>)
/// repeated applications of the given function `f`.
#[unstable(feature = "iter_iterate")]
#[deprecated(since = "1.2.0",
reason = "has gained enough traction to retain its position \
reason = "has not gained enough traction to retain its position \
in the standard library")]
#[allow(deprecated)]
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
if from_tc.interior_param() || to_tc.interior_param() {
span_err!(self.tcx.sess, span, E0139,
"cannot transmute to or from a type that contains \
type parameters in its interior");
unsubstituted type parameters");
return;
}

Expand Down
16 changes: 8 additions & 8 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use metadata::csearch;
use middle;
use middle::cast;
use middle::check_const;
use middle::const_eval::{self, ConstVal};
use middle::const_eval::{self, ConstVal, ErrKind};
use middle::def::{self, DefMap, ExportMap};
use middle::dependency_format;
use middle::fast_reject;
Expand Down Expand Up @@ -6098,20 +6098,20 @@ impl<'tcx> ctxt<'tcx> {
found);
}
Err(err) => {
let err_description = err.description();
let found = match count_expr.node {
let err_msg = match count_expr.node {
ast::ExprPath(None, ast::Path {
global: false,
ref segments,
..
}) if segments.len() == 1 =>
format!("{}", "found variable"),
_ =>
format!("but {}", err_description),
format!("found variable"),
_ => match err.kind {
ErrKind::MiscCatchAll => format!("but found {}", err.description()),
_ => format!("but {}", err.description())
}
};
span_err!(self.sess, count_expr.span, E0307,
"expected constant integer for repeat count, {}",
found);
"expected constant integer for repeat count, {}", err_msg);
}
}
0
Expand Down
164 changes: 155 additions & 9 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ mod foo {
use foo::MyTrait::do_something;
```

In general, it's not legal to directly import methods belonging to a
trait or concrete type.
It's illegal to directly import methods belonging to a trait or concrete type.
"##,

E0255: r##"
Expand Down Expand Up @@ -272,7 +271,160 @@ See the 'Use Declarations' section of the reference for more information
on this topic:

http://doc.rust-lang.org/reference.html#use-declarations
"##
"##,

E0403: r##"
Some type parameters have the same name. Example of erroneous code:

```
fn foo<T, T>(s: T, u: T) {} // error: the name `T` is already used for a type
// parameter in this type parameter list
```

Please verify that none of the type parameterss are misspelled, and rename any
clashing parameters. Example:

```
fn foo<T, Y>(s: T, u: Y) {} // ok!
```
"##,

E0404: r##"
You tried to implement something which was not a trait on an object. Example of
erroneous code:

```
struct Foo;
struct Bar;

impl Foo for Bar {} // error: `Foo` is not a trait
```

Please verify that you didn't misspell the trait's name or otherwise use the
wrong identifier. Example:

```
trait Foo {
// some functions
}
struct Bar;

impl Foo for Bar { // ok!
// functions implementation
}
```
"##,

E0405: r##"
An unknown trait was implemented. Example of erroneous code:

```
struct Foo;

impl SomeTrait for Foo {} // error: use of undeclared trait name `SomeTrait`
```

Please verify that the name of the trait wasn't misspelled and ensure that it
was imported. Example:

```
// solution 1:
use some_file::SomeTrait;

// solution 2:
trait SomeTrait {
// some functions
}

struct Foo;

impl SomeTrait for Foo { // ok!
// implements functions
}
```
"##,

E0407: r##"
A definition of a method not in the implemented trait was given in a trait
implementation. Example of erroneous code:

```
trait Foo {
fn a();
}

struct Bar;

impl Foo for Bar {
fn a() {}
fn b() {} // error: method `b` is not a member of trait `Foo`
}
```

Please verify you didn't misspell the method name and you used the correct
trait. First example:

```
trait Foo {
fn a();
fn b();
}

struct Bar;

impl Foo for Bar {
fn a() {}
fn b() {} // ok!
}
```

Second example:

```
trait Foo {
fn a();
}

struct Bar;

impl Foo for Bar {
fn a() {}
}

impl Bar {
fn b() {}
}
```
"##,

E0428: r##"
A type or module has been defined more than once. Example of erroneous
code:

```
struct Bar;
struct Bar; // error: duplicate definition of value `Bar`
```

Please verify you didn't misspell the type/module's name or remove/rename the
duplicated one. Example:

```
struct Bar;
struct Bar2; // ok!
```
"##,

E0433: r##"
Invalid import. Example of erroneous code:

```
use something_which_doesnt_exist;
// error: unresolved import `something_which_doesnt_exist`
```

Please verify you didn't misspell the import's name.
"##,

}

Expand All @@ -284,11 +436,7 @@ register_diagnostics! {
E0258,
E0401, // can't use type parameters from outer function
E0402, // cannot use an outer type parameter in this context
E0403, // the name `{}` is already used
E0404, // is not a trait
E0405, // use of undeclared trait name
E0406, // undeclared associated type
E0407, // method is not a member of trait
E0408, // variable from pattern #1 is not bound in pattern #
E0409, // variable is bound with different mode in pattern # than in
// pattern #1
Expand All @@ -313,13 +461,11 @@ register_diagnostics! {
E0425, // unresolved name
E0426, // use of undeclared label
E0427, // cannot use `ref` binding mode with ...
E0428, // duplicate definition of ...
E0429, // `self` imports are only allowed within a { } list
E0430, // `self` import can only appear once in the list
E0431, // `self` import can only appear in an import list with a non-empty
// prefix
E0432, // unresolved import
E0433, // failed to resolve
E0434, // can't capture dynamic environment in a fn item
E0435, // attempt to use a non-constant value in a constant
E0437, // type is not a member of trait
Expand Down
28 changes: 27 additions & 1 deletion src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,33 @@ return, for example with a `loop` that never breaks or a call to another
diverging function (such as `panic!()`).
"##,

E0172: r##"
This error means that an attempt was made to specify the type of a variable with
a combination of a concrete type and a trait. Consider the following example:

```
fn foo(bar: i32+std::fmt::Display) {}
```

The code is trying to specify that we want to receive a signed 32-bit integer
which also implements `Display`. This doesn't make sense: when we pass `i32`, a
concrete type, it implicitly includes all of the traits that it implements.
This includes `Display`, `Debug`, `Clone`, and a host of others.

If `i32` implements the trait we desire, there's no need to specify the trait
separately. If it does not, then we need to `impl` the trait for `i32` before
passing it into `foo`. Either way, a fixed definition for `foo` will look like
the following:

```
fn foo(bar: i32) {}
```

To learn more about traits, take a look at the Book:

https://doc.rust-lang.org/book/traits.html
"##,

E0178: r##"
In types, the `+` type operator has low precedence, so it is often necessary
to use parentheses.
Expand Down Expand Up @@ -2196,7 +2223,6 @@ register_diagnostics! {
E0164,
E0167,
E0168,
E0172,
E0173, // manual implementations of unboxed closure traits are experimental
E0174, // explicit use of unboxed closure methods are experimental
E0182,
Expand Down
Loading