Skip to content

Commit 5542830

Browse files
committed
Auto merge of #27219 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27084, #27127, #27131, #27140, #27146, #27147, #27151, #27154, #27155, #27156, #27157, #27158, #27163, #27164, #27166, #27167, #27170, #27175, #27183, #27201, #27202 - Failed merges: #26778
2 parents d4d4206 + 5f04b1b commit 5542830

File tree

19 files changed

+893
-57
lines changed

19 files changed

+893
-57
lines changed

src/doc/trpl/ffi.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ libraries:
340340
Note that frameworks are only available on OSX targets.
341341
342342
The different `kind` values are meant to differentiate how the native library
343-
participates in linkage. From a linkage perspective, the rust compiler creates
343+
participates in linkage. From a linkage perspective, the Rust compiler creates
344344
two flavors of artifacts: partial (rlib/staticlib) and final (dylib/binary).
345345
Native dynamic library and framework dependencies are propagated to the final
346346
artifact boundary, while static library dependencies are not propagated at
@@ -350,9 +350,9 @@ artifact.
350350
A few examples of how this model can be used are:
351351
352352
* A native build dependency. Sometimes some C/C++ glue is needed when writing
353-
some rust code, but distribution of the C/C++ code in a library format is just
353+
some Rust code, but distribution of the C/C++ code in a library format is just
354354
a burden. In this case, the code will be archived into `libfoo.a` and then the
355-
rust crate would declare a dependency via `#[link(name = "foo", kind =
355+
Rust crate would declare a dependency via `#[link(name = "foo", kind =
356356
"static")]`.
357357
358358
Regardless of the flavor of output for the crate, the native static library
@@ -361,7 +361,7 @@ A few examples of how this model can be used are:
361361
362362
* A normal dynamic dependency. Common system libraries (like `readline`) are
363363
available on a large number of systems, and often a static copy of these
364-
libraries cannot be found. When this dependency is included in a rust crate,
364+
libraries cannot be found. When this dependency is included in a Rust crate,
365365
partial targets (like rlibs) will not link to the library, but when the rlib
366366
is included in a final target (like a binary), the native library will be
367367
linked in.

src/doc/trpl/installing-rust.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The first step to using Rust is to install it! There are a number of ways to
44
install Rust, but the easiest is to use the `rustup` script. If you're on Linux
5-
or a Mac, all you need to do is this:
5+
or a Mac, all you need to do is this:
66

77
> Note: you don't need to type in the `$`s, they just indicate the start of
88
> each command. You’ll see many tutorials and examples around the web that
@@ -25,6 +25,12 @@ $ sh rustup.sh
2525
[insecurity]: http://curlpipesh.tumblr.com
2626

2727
If you're on Windows, please download the appropriate [installer][install-page].
28+
**NOTE:** By default, the Windows installer will not add Rust to the %PATH%
29+
system variable. If this is the only version of Rust you are installing and you
30+
want to be able to run it from the command line, click on "Advanced" on the
31+
install dialog and on the "Product Features" page ensure "Add to PATH" is
32+
installed on the local hard drive.
33+
2834

2935
[install-page]: http://www.rust-lang.org/install.html
3036

@@ -87,6 +93,11 @@ rustc 1.0.0 (a59de37e9 2015-05-13)
8793

8894
If you did, Rust has been installed successfully! Congrats!
8995

96+
If you didn't and you're on Windows, check that Rust is in your %PATH% system
97+
variable. If it isn't, run the installer again, select "Change" on the "Change,
98+
repair, or remove installation" page and ensure "Add to PATH" is installed on
99+
the local hard drive.
100+
90101
This installer also installs a copy of the documentation locally, so you can
91102
read it offline. On UNIX systems, `/usr/local/share/doc/rust` is the location.
92103
On Windows, it's in a `share/doc` directory, inside wherever you installed Rust
@@ -101,5 +112,5 @@ resources include [the user’s forum][users], and
101112

102113
[irc]: irc://irc.mozilla.org/#rust
103114
[mibbit]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
104-
[users]: http://users.rust-lang.org/
115+
[users]: http://users.rust-lang.org/
105116
[stackoverflow]: http://stackoverflow.com/questions/tagged/rust

src/doc/trpl/release-channels.md

+23
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,26 @@ This will help alert the team in case there’s an accidental regression.
4343
Additionally, testing against nightly can catch regressions even sooner, and so
4444
if you don’t mind a third build, we’d appreciate testing against all channels.
4545

46+
As an example, many Rust programmers use [Travis](https://travis-ci.org/) to
47+
test their crates, which is free for open source projects. Travis [supports
48+
Rust directly][travis], and you can use a `.travis.yml` file like this to
49+
test on all channels:
50+
51+
```yaml
52+
language: rust
53+
rust:
54+
- nightly
55+
- beta
56+
- stable
57+
58+
matrix:
59+
allow_failures:
60+
- rust: nightly
61+
```
62+
63+
[travis]: http://docs.travis-ci.com/user/languages/rust/
64+
65+
With this configuration, Travis will test all three channels, but if something
66+
breaks on nightly, it won’t fail your build. A similar configuration is
67+
recommended for any CI system, check the documentation of the one you’re
68+
using for more details.

src/doc/trpl/unsafe.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,14 @@ that you normally can not do. Just three. Here they are:
100100

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

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

108112
## Access or update a `static mut`
109113

src/libcore/iter.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
25552555
#[unstable(feature = "iter_unfold")]
25562556
#[derive(Clone)]
25572557
#[deprecated(since = "1.2.0",
2558-
reason = "has gained enough traction to retain its position \
2558+
reason = "has not gained enough traction to retain its position \
25592559
in the standard library")]
25602560
#[allow(deprecated)]
25612561
pub struct Unfold<St, F> {
@@ -2567,7 +2567,7 @@ pub struct Unfold<St, F> {
25672567

25682568
#[unstable(feature = "iter_unfold")]
25692569
#[deprecated(since = "1.2.0",
2570-
reason = "has gained enough traction to retain its position \
2570+
reason = "has not gained enough traction to retain its position \
25712571
in the standard library")]
25722572
#[allow(deprecated)]
25732573
impl<A, St, F> Unfold<St, F> where F: FnMut(&mut St) -> Option<A> {
@@ -3018,7 +3018,7 @@ type IterateState<T, F> = (F, Option<T>, bool);
30183018
/// from a given seed value.
30193019
#[unstable(feature = "iter_iterate")]
30203020
#[deprecated(since = "1.2.0",
3021-
reason = "has gained enough traction to retain its position \
3021+
reason = "has not gained enough traction to retain its position \
30223022
in the standard library")]
30233023
#[allow(deprecated)]
30243024
pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>) -> Option<T>>;
@@ -3027,7 +3027,7 @@ pub type Iterate<T, F> = Unfold<IterateState<T, F>, fn(&mut IterateState<T, F>)
30273027
/// repeated applications of the given function `f`.
30283028
#[unstable(feature = "iter_iterate")]
30293029
#[deprecated(since = "1.2.0",
3030-
reason = "has gained enough traction to retain its position \
3030+
reason = "has not gained enough traction to retain its position \
30313031
in the standard library")]
30323032
#[allow(deprecated)]
30333033
pub fn iterate<T, F>(seed: T, f: F) -> Iterate<T, F> where

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
165165
if from_tc.interior_param() || to_tc.interior_param() {
166166
span_err!(self.tcx.sess, span, E0139,
167167
"cannot transmute to or from a type that contains \
168-
type parameters in its interior");
168+
unsubstituted type parameters");
169169
return;
170170
}
171171

src/librustc_resolve/diagnostics.rs

+155-9
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ mod foo {
106106
use foo::MyTrait::do_something;
107107
```
108108
109-
In general, it's not legal to directly import methods belonging to a
110-
trait or concrete type.
109+
It's illegal to directly import methods belonging to a trait or concrete type.
111110
"##,
112111

113112
E0255: r##"
@@ -272,7 +271,160 @@ See the 'Use Declarations' section of the reference for more information
272271
on this topic:
273272
274273
http://doc.rust-lang.org/reference.html#use-declarations
275-
"##
274+
"##,
275+
276+
E0403: r##"
277+
Some type parameters have the same name. Example of erroneous code:
278+
279+
```
280+
fn foo<T, T>(s: T, u: T) {} // error: the name `T` is already used for a type
281+
// parameter in this type parameter list
282+
```
283+
284+
Please verify that none of the type parameterss are misspelled, and rename any
285+
clashing parameters. Example:
286+
287+
```
288+
fn foo<T, Y>(s: T, u: Y) {} // ok!
289+
```
290+
"##,
291+
292+
E0404: r##"
293+
You tried to implement something which was not a trait on an object. Example of
294+
erroneous code:
295+
296+
```
297+
struct Foo;
298+
struct Bar;
299+
300+
impl Foo for Bar {} // error: `Foo` is not a trait
301+
```
302+
303+
Please verify that you didn't misspell the trait's name or otherwise use the
304+
wrong identifier. Example:
305+
306+
```
307+
trait Foo {
308+
// some functions
309+
}
310+
struct Bar;
311+
312+
impl Foo for Bar { // ok!
313+
// functions implementation
314+
}
315+
```
316+
"##,
317+
318+
E0405: r##"
319+
An unknown trait was implemented. Example of erroneous code:
320+
321+
```
322+
struct Foo;
323+
324+
impl SomeTrait for Foo {} // error: use of undeclared trait name `SomeTrait`
325+
```
326+
327+
Please verify that the name of the trait wasn't misspelled and ensure that it
328+
was imported. Example:
329+
330+
```
331+
// solution 1:
332+
use some_file::SomeTrait;
333+
334+
// solution 2:
335+
trait SomeTrait {
336+
// some functions
337+
}
338+
339+
struct Foo;
340+
341+
impl SomeTrait for Foo { // ok!
342+
// implements functions
343+
}
344+
```
345+
"##,
346+
347+
E0407: r##"
348+
A definition of a method not in the implemented trait was given in a trait
349+
implementation. Example of erroneous code:
350+
351+
```
352+
trait Foo {
353+
fn a();
354+
}
355+
356+
struct Bar;
357+
358+
impl Foo for Bar {
359+
fn a() {}
360+
fn b() {} // error: method `b` is not a member of trait `Foo`
361+
}
362+
```
363+
364+
Please verify you didn't misspell the method name and you used the correct
365+
trait. First example:
366+
367+
```
368+
trait Foo {
369+
fn a();
370+
fn b();
371+
}
372+
373+
struct Bar;
374+
375+
impl Foo for Bar {
376+
fn a() {}
377+
fn b() {} // ok!
378+
}
379+
```
380+
381+
Second example:
382+
383+
```
384+
trait Foo {
385+
fn a();
386+
}
387+
388+
struct Bar;
389+
390+
impl Foo for Bar {
391+
fn a() {}
392+
}
393+
394+
impl Bar {
395+
fn b() {}
396+
}
397+
```
398+
"##,
399+
400+
E0428: r##"
401+
A type or module has been defined more than once. Example of erroneous
402+
code:
403+
404+
```
405+
struct Bar;
406+
struct Bar; // error: duplicate definition of value `Bar`
407+
```
408+
409+
Please verify you didn't misspell the type/module's name or remove/rename the
410+
duplicated one. Example:
411+
412+
```
413+
struct Bar;
414+
struct Bar2; // ok!
415+
```
416+
"##,
417+
418+
E0433: r##"
419+
Invalid import. Example of erroneous code:
420+
421+
```
422+
use something_which_doesnt_exist;
423+
// error: unresolved import `something_which_doesnt_exist`
424+
```
425+
426+
Please verify you didn't misspell the import's name.
427+
"##,
276428

277429
}
278430

@@ -284,11 +436,7 @@ register_diagnostics! {
284436
E0258,
285437
E0401, // can't use type parameters from outer function
286438
E0402, // cannot use an outer type parameter in this context
287-
E0403, // the name `{}` is already used
288-
E0404, // is not a trait
289-
E0405, // use of undeclared trait name
290439
E0406, // undeclared associated type
291-
E0407, // method is not a member of trait
292440
E0408, // variable from pattern #1 is not bound in pattern #
293441
E0409, // variable is bound with different mode in pattern # than in
294442
// pattern #1
@@ -313,13 +461,11 @@ register_diagnostics! {
313461
E0425, // unresolved name
314462
E0426, // use of undeclared label
315463
E0427, // cannot use `ref` binding mode with ...
316-
E0428, // duplicate definition of ...
317464
E0429, // `self` imports are only allowed within a { } list
318465
E0430, // `self` import can only appear once in the list
319466
E0431, // `self` import can only appear in an import list with a non-empty
320467
// prefix
321468
E0432, // unresolved import
322-
E0433, // failed to resolve
323469
E0434, // can't capture dynamic environment in a fn item
324470
E0435, // attempt to use a non-constant value in a constant
325471
E0437, // type is not a member of trait

0 commit comments

Comments
 (0)