Skip to content

Commit a24e0f2

Browse files
committed
Auto merge of rust-lang#44033 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: rust-lang#43993, rust-lang#44001, rust-lang#44010, rust-lang#44014, rust-lang#44029 - Failed merges:
2 parents 1177911 + 2dfb8d7 commit a24e0f2

File tree

7 files changed

+108
-78
lines changed

7 files changed

+108
-78
lines changed

RELEASES.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Stabilized APIs
9292
Cargo
9393
-----
9494
- [Cargo API token location moved from `~/.cargo/config` to
95-
`~/cargo/credentials`.][cargo/3978]
95+
`~/.cargo/credentials`.][cargo/3978]
9696
- [Cargo will now build `main.rs` binaries that are in sub-directories of
9797
`src/bin`.][cargo/4214] ie. Having `src/bin/server/main.rs` and
9898
`src/bin/client/main.rs` generates `target/debug/server` and `target/debug/client`
@@ -172,7 +172,6 @@ Compatibility Notes
172172
[`slice::sort_unstable`]: https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable
173173
[`ste::from_boxed_utf8_unchecked`]: https://doc.rust-lang.org/std/str/fn.from_boxed_utf8_unchecked.html
174174
[`str::as_bytes_mut`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_bytes_mut
175-
[`str::as_bytes_mut`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_bytes_mut
176175
[`str::from_utf8_mut`]: https://doc.rust-lang.org/std/str/fn.from_utf8_mut.html
177176
[`str::from_utf8_unchecked_mut`]: https://doc.rust-lang.org/std/str/fn.from_utf8_unchecked_mut.html
178177
[`str::get_mut`]: https://doc.rust-lang.org/std/primitive.str.html#method.get_mut
@@ -898,6 +897,9 @@ Compatibility Notes
898897
* [Ctrl-Z returns from `Stdin.read()` when reading from the console on
899898
Windows][38274]
900899
* [Clean up semantics of `self` in an import list][38313]
900+
* Reimplemented lifetime elision. This change was almost entirely compatible
901+
with existing code, but it did close a number of small bugs and loopholes,
902+
as well as being more accepting in some other [cases][41105].
901903

902904
[37057]: https://github.com/rust-lang/rust/pull/37057
903905
[37761]: https://github.com/rust-lang/rust/pull/37761
@@ -932,6 +934,7 @@ Compatibility Notes
932934
[39048]: https://github.com/rust-lang/rust/pull/39048
933935
[39282]: https://github.com/rust-lang/rust/pull/39282
934936
[39379]: https://github.com/rust-lang/rust/pull/39379
937+
[41105]: https://github.com/rust-lang/rust/issues/41105
935938
[`<*const T>::wrapping_offset`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.wrapping_offset
936939
[`<*mut T>::wrapping_offset`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.wrapping_offset
937940
[`Duration::checked_add`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.checked_add

src/bootstrap/README.md

+20-16
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,19 @@ The script accepts commands, flags, and arguments to determine what to do:
7373

7474
## Configuring rustbuild
7575

76-
There are currently two primary methods for configuring the rustbuild build
77-
system. First, the `./configure` options serialized in `config.mk` will be
78-
parsed and read. That is, if any `./configure` options are passed, they'll be
79-
handled naturally.
76+
There are currently two methods for configuring the rustbuild build system.
8077

81-
Next, rustbuild offers a TOML-based configuration system with a `config.toml`
78+
First, rustbuild offers a TOML-based configuration system with a `config.toml`
8279
file in the same location as `config.mk`. An example of this configuration can
83-
be found at `config.toml.example`, and the configuration file
84-
can also be passed as `--config path/to/config.toml` if the build system is
85-
being invoked manually (via the python script).
80+
be found at `config.toml.example`, and the configuration file can also be passed
81+
as `--config path/to/config.toml` if the build system is being invoked manually
82+
(via the python script).
83+
84+
Next, the `./configure` options serialized in `config.mk` will be
85+
parsed and read. That is, if any `./configure` options are passed, they'll be
86+
handled naturally. `./configure` should almost never be used for local
87+
installations, and is primarily useful for CI. Prefer to customize behavior
88+
using `config.toml`.
8689

8790
Finally, rustbuild makes use of the [gcc-rs crate] which has [its own
8891
method][env-vars] of configuring C compilers and C flags via environment
@@ -310,17 +313,18 @@ After that, each module in rustbuild should have enough documentation to keep
310313
you up and running. Some general areas that you may be interested in modifying
311314
are:
312315

313-
* Adding a new build tool? Take a look at `bootstrap/step.rs` for examples of
316+
* Adding a new build tool? Take a look at `bootstrap/tool.rs` for examples of
314317
other tools.
315318
* Adding a new compiler crate? Look no further! Adding crates can be done by
316319
adding a new directory with `Cargo.toml` followed by configuring all
317320
`Cargo.toml` files accordingly.
318-
* Adding a new dependency from crates.io? We're still working on that, so hold
319-
off on that for now.
320-
* Adding a new configuration option? Take a look at `bootstrap/config.rs` or
321-
perhaps `bootstrap/flags.rs` and then modify the build elsewhere to read that
322-
option.
321+
* Adding a new dependency from crates.io? This should just work inside the
322+
compiler artifacts stage (everything other than libtest and libstd).
323+
* Adding a new configuration option? You'll want to modify `bootstrap/flags.rs`
324+
for command line flags and then `bootstrap/config.rs` to copy the flags to the
325+
`Config` struct.
323326
* Adding a sanity check? Take a look at `bootstrap/sanity.rs`.
324327

325-
If you have any questions feel free to reach out on `#rust-internals` on IRC or
326-
open an issue in the bug tracker!
328+
If you have any questions feel free to reach out on `#rust-infra` on IRC or ask on
329+
internals.rust-lang.org. When you encounter bugs, please file issues on the
330+
rust-lang/rust issue tracker.

src/librustc_borrowck/borrowck/gather_loans/move_error.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -153,20 +153,19 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
153153
}
154154

155155
Categorization::Interior(ref b, mc::InteriorElement(ik)) => {
156-
match (&b.ty.sty, ik) {
157-
(&ty::TySlice(..), _) |
158-
(_, Kind::Index) => {
159-
let mut err = struct_span_err!(bccx, move_from.span, E0508,
160-
"cannot move out of type `{}`, \
161-
a non-copy array",
162-
b.ty);
163-
err.span_label(move_from.span, "cannot move out of here");
164-
err
165-
}
166-
(_, Kind::Pattern) => {
156+
let type_name = match (&b.ty.sty, ik) {
157+
(&ty::TyArray(_, _), Kind::Index) => "array",
158+
(&ty::TySlice(_), _) => "slice",
159+
_ => {
167160
span_bug!(move_from.span, "this path should not cause illegal move");
168-
}
169-
}
161+
},
162+
};
163+
let mut err = struct_span_err!(bccx, move_from.span, E0508,
164+
"cannot move out of type `{}`, \
165+
a non-copy {}",
166+
b.ty, type_name);
167+
err.span_label(move_from.span, "cannot move out of here");
168+
err
170169
}
171170

172171
Categorization::Downcast(ref b, _) |

src/libstd/io/mod.rs

+65-41
Original file line numberDiff line numberDiff line change
@@ -401,28 +401,29 @@ fn read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> Result<usize>
401401
///
402402
/// Implementors of the `Read` trait are called 'readers'.
403403
///
404-
/// Readers are defined by one required method, `read()`. Each call to `read`
404+
/// Readers are defined by one required method, [`read()`]. Each call to [`read()`]
405405
/// will attempt to pull bytes from this source into a provided buffer. A
406-
/// number of other methods are implemented in terms of `read()`, giving
406+
/// number of other methods are implemented in terms of [`read()`], giving
407407
/// implementors a number of ways to read bytes while only needing to implement
408408
/// a single method.
409409
///
410410
/// Readers are intended to be composable with one another. Many implementors
411-
/// throughout `std::io` take and provide types which implement the `Read`
411+
/// throughout [`std::io`] take and provide types which implement the `Read`
412412
/// trait.
413413
///
414-
/// Please note that each call to `read` may involve a system call, and
415-
/// therefore, using something that implements [`BufRead`][bufread], such as
416-
/// [`BufReader`][bufreader], will be more efficient.
417-
///
418-
/// [bufread]: trait.BufRead.html
419-
/// [bufreader]: struct.BufReader.html
414+
/// Please note that each call to [`read()`] may involve a system call, and
415+
/// therefore, using something that implements [`BufRead`], such as
416+
/// [`BufReader`], will be more efficient.
420417
///
421418
/// # Examples
422419
///
423-
/// [`File`][file]s implement `Read`:
420+
/// [`File`]s implement `Read`:
424421
///
425-
/// [file]: ../fs/struct.File.html
422+
/// [`read()`]: trait.Read.html#tymethod.read
423+
/// [`std::io`]: ../../std/io/index.html
424+
/// [`File`]: ../fs/struct.File.html
425+
/// [`BufRead`]: trait.BufRead.html
426+
/// [`BufReader`]: struct.BufReader.html
426427
///
427428
/// ```
428429
/// use std::io;
@@ -455,9 +456,9 @@ pub trait Read {
455456
///
456457
/// This function does not provide any guarantees about whether it blocks
457458
/// waiting for data, but if an object needs to block for a read but cannot
458-
/// it will typically signal this via an `Err` return value.
459+
/// it will typically signal this via an [`Err`] return value.
459460
///
460-
/// If the return value of this method is `Ok(n)`, then it must be
461+
/// If the return value of this method is [`Ok(n)`], then it must be
461462
/// guaranteed that `0 <= n <= buf.len()`. A nonzero `n` value indicates
462463
/// that the buffer `buf` has been filled in with `n` bytes of data from this
463464
/// source. If `n` is `0`, then it can indicate one of two scenarios:
@@ -478,14 +479,17 @@ pub trait Read {
478479
/// variant will be returned. If an error is returned then it must be
479480
/// guaranteed that no bytes were read.
480481
///
481-
/// An error of the `ErrorKind::Interrupted` kind is non-fatal and the read
482+
/// An error of the [`ErrorKind::Interrupted`] kind is non-fatal and the read
482483
/// operation should be retried if there is nothing else to do.
483484
///
484485
/// # Examples
485486
///
486-
/// [`File`][file]s implement `Read`:
487+
/// [`File`]s implement `Read`:
487488
///
488-
/// [file]: ../fs/struct.File.html
489+
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
490+
/// [`Ok(n)`]: ../../std/result/enum.Result.html#variant.Ok
491+
/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
492+
/// [`File`]: ../fs/struct.File.html
489493
///
490494
/// ```
491495
/// use std::io;
@@ -511,8 +515,8 @@ pub trait Read {
511515
/// buffers.
512516
///
513517
/// If a `Read`er guarantees that it can work properly with uninitialized
514-
/// memory, it should call `Initializer::nop()`. See the documentation for
515-
/// `Initializer` for details.
518+
/// memory, it should call [`Initializer::nop()`]. See the documentation for
519+
/// [`Initializer`] for details.
516520
///
517521
/// The behavior of this method must be independent of the state of the
518522
/// `Read`er - the method only takes `&self` so that it can be used through
@@ -523,6 +527,9 @@ pub trait Read {
523527
/// This method is unsafe because a `Read`er could otherwise return a
524528
/// non-zeroing `Initializer` from another `Read` type without an `unsafe`
525529
/// block.
530+
///
531+
/// [`Initializer::nop()`]: ../../std/io/struct.Initializer.html#method.nop
532+
/// [`Initializer`]: ../../std/io/struct.Initializer.html
526533
#[unstable(feature = "read_initializer", issue = "42788")]
527534
#[inline]
528535
unsafe fn initializer(&self) -> Initializer {
@@ -532,16 +539,16 @@ pub trait Read {
532539
/// Read all bytes until EOF in this source, placing them into `buf`.
533540
///
534541
/// All bytes read from this source will be appended to the specified buffer
535-
/// `buf`. This function will continuously call `read` to append more data to
536-
/// `buf` until `read` returns either `Ok(0)` or an error of
537-
/// non-`ErrorKind::Interrupted` kind.
542+
/// `buf`. This function will continuously call [`read()`] to append more data to
543+
/// `buf` until [`read()`] returns either [`Ok(0)`] or an error of
544+
/// non-[`ErrorKind::Interrupted`] kind.
538545
///
539546
/// If successful, this function will return the total number of bytes read.
540547
///
541548
/// # Errors
542549
///
543550
/// If this function encounters an error of the kind
544-
/// `ErrorKind::Interrupted` then the error is ignored and the operation
551+
/// [`ErrorKind::Interrupted`] then the error is ignored and the operation
545552
/// will continue.
546553
///
547554
/// If any other read error is encountered then this function immediately
@@ -550,9 +557,12 @@ pub trait Read {
550557
///
551558
/// # Examples
552559
///
553-
/// [`File`][file]s implement `Read`:
560+
/// [`File`]s implement `Read`:
554561
///
555-
/// [file]: ../fs/struct.File.html
562+
/// [`read()`]: trait.Read.html#tymethod.read
563+
/// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok
564+
/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
565+
/// [`File`]: ../fs/struct.File.html
556566
///
557567
/// ```
558568
/// use std::io;
@@ -633,11 +643,11 @@ pub trait Read {
633643
/// # Errors
634644
///
635645
/// If this function encounters an error of the kind
636-
/// `ErrorKind::Interrupted` then the error is ignored and the operation
646+
/// [`ErrorKind::Interrupted`] then the error is ignored and the operation
637647
/// will continue.
638648
///
639649
/// If this function encounters an "end of file" before completely filling
640-
/// the buffer, it returns an error of the kind `ErrorKind::UnexpectedEof`.
650+
/// the buffer, it returns an error of the kind [`ErrorKind::UnexpectedEof`].
641651
/// The contents of `buf` are unspecified in this case.
642652
///
643653
/// If any other read error is encountered then this function immediately
@@ -649,9 +659,11 @@ pub trait Read {
649659
///
650660
/// # Examples
651661
///
652-
/// [`File`][file]s implement `Read`:
662+
/// [`File`]s implement `Read`:
653663
///
654-
/// [file]: ../fs/struct.File.html
664+
/// [`File`]: ../fs/struct.File.html
665+
/// [`ErrorKind::Interrupted`]: ../../std/io/enum.ErrorKind.html#variant.Interrupted
666+
/// [`ErrorKind::UnexpectedEof`]: ../../std/io/enum.ErrorKind.html#variant.UnexpectedEof
655667
///
656668
/// ```
657669
/// use std::io;
@@ -722,18 +734,24 @@ pub trait Read {
722734
#[stable(feature = "rust1", since = "1.0.0")]
723735
fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
724736

725-
/// Transforms this `Read` instance to an `Iterator` over its bytes.
737+
/// Transforms this `Read` instance to an [`Iterator`] over its bytes.
726738
///
727-
/// The returned type implements `Iterator` where the `Item` is `Result<u8,
728-
/// R::Err>`. The yielded item is `Ok` if a byte was successfully read and
729-
/// `Err` otherwise for I/O errors. EOF is mapped to returning `None` from
739+
/// The returned type implements [`Iterator`] where the `Item` is [`Result`]`<`[`u8`]`,
740+
/// R::Err>`. The yielded item is [`Ok`] if a byte was successfully read and
741+
/// [`Err`] otherwise for I/O errors. EOF is mapped to returning [`None`] from
730742
/// this iterator.
731743
///
732744
/// # Examples
733745
///
734746
/// [`File`][file]s implement `Read`:
735747
///
736748
/// [file]: ../fs/struct.File.html
749+
/// [`Iterator`]: ../../std/iter/trait.Iterator.html
750+
/// [`Result`]: ../../std/result/enum.Result.html
751+
/// [`u8`]: ../../std/primitive.u8.html
752+
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
753+
/// [`Err`]: ../../std/result/enum.Result.html#variant.Err
754+
/// [`None`]: ../../std/option/enum.Option.html#variant.None
737755
///
738756
/// ```
739757
/// use std::io;
@@ -754,22 +772,26 @@ pub trait Read {
754772
Bytes { inner: self }
755773
}
756774

757-
/// Transforms this `Read` instance to an `Iterator` over `char`s.
775+
/// Transforms this `Read` instance to an [`Iterator`] over [`char`]s.
758776
///
759777
/// This adaptor will attempt to interpret this reader as a UTF-8 encoded
760-
/// sequence of characters. The returned iterator will return `None` once
778+
/// sequence of characters. The returned iterator will return [`None`] once
761779
/// EOF is reached for this reader. Otherwise each element yielded will be a
762-
/// `Result<char, E>` where `E` may contain information about what I/O error
780+
/// [`Result`]`<`[`char`]`, E>` where `E` may contain information about what I/O error
763781
/// occurred or where decoding failed.
764782
///
765783
/// Currently this adaptor will discard intermediate data read, and should
766784
/// be avoided if this is not desired.
767785
///
768786
/// # Examples
769787
///
770-
/// [`File`][file]s implement `Read`:
788+
/// [`File`]s implement `Read`:
771789
///
772-
/// [file]: ../fs/struct.File.html
790+
/// [`File`]: ../fs/struct.File.html
791+
/// [`Iterator`]: ../../std/iter/trait.Iterator.html
792+
/// [`Result`]: ../../std/result/enum.Result.html
793+
/// [`char`]: ../../std/primitive.char.html
794+
/// [`None`]: ../../std/option/enum.Option.html#variant.None
773795
///
774796
/// ```
775797
/// #![feature(io)]
@@ -832,15 +854,17 @@ pub trait Read {
832854
/// Creates an adaptor which will read at most `limit` bytes from it.
833855
///
834856
/// This function returns a new instance of `Read` which will read at most
835-
/// `limit` bytes, after which it will always return EOF (`Ok(0)`). Any
857+
/// `limit` bytes, after which it will always return EOF ([`Ok(0)`]). Any
836858
/// read errors will not count towards the number of bytes read and future
837-
/// calls to `read` may succeed.
859+
/// calls to [`read()`] may succeed.
838860
///
839861
/// # Examples
840862
///
841-
/// [`File`][file]s implement `Read`:
863+
/// [`File`]s implement `Read`:
842864
///
843-
/// [file]: ../fs/struct.File.html
865+
/// [`File`]: ../fs/struct.File.html
866+
/// [`Ok(0)`]: ../../std/result/enum.Result.html#variant.Ok
867+
/// [`read()`]: trait.Read.html#tymethod.read
844868
///
845869
/// ```
846870
/// use std::io;

src/test/compile-fail/issue-12567.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) {
1515
(&[], &[]) => println!("both empty"),
1616
(&[], &[hd, ..]) | (&[hd, ..], &[])
1717
=> println!("one empty"),
18-
//~^^ ERROR: cannot move out of type `[T]`, a non-copy array
19-
//~^^^ ERROR: cannot move out of type `[T]`, a non-copy array
18+
//~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
19+
//~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
2020
(&[hd1, ..], &[hd2, ..])
2121
=> println!("both nonempty"),
22-
//~^^ ERROR: cannot move out of type `[T]`, a non-copy array
23-
//~^^^ ERROR: cannot move out of type `[T]`, a non-copy array
22+
//~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
23+
//~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
2424
}
2525
}
2626

src/test/compile-fail/move-out-of-array-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ fn main() {
2424
}
2525

2626
fn foo(a: [D; 4], i: usize) -> D {
27-
a[i] //~ ERROR cannot move out of type `[D; 4]`
27+
a[i] //~ ERROR cannot move out of type `[D; 4]`, a non-copy array
2828
}

src/test/compile-fail/move-out-of-slice-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct A;
1515
fn main() {
1616
let a: Box<[A]> = Box::new([A]);
1717
match a {
18-
box [a] => {}, //~ ERROR cannot move out of type `[A]`
18+
box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
1919
_ => {}
2020
}
2121
}

0 commit comments

Comments
 (0)