summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-06 07:43:56 +0000
committerbors <bors@rust-lang.org>2019-12-06 07:43:56 +0000
commitd0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0 (patch)
tree1e574274dfc984cf278d7a39e154b408f1663485
parentAuto merge of #66835 - AviKozokin:master, r=alexcrichton (diff)
parentRollup merge of #67066 - alexcrichton:update-wasi-libc, r=Mark-Simulacrum (diff)
downloadrust-d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0.tar.gz
rust-d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0.tar.bz2
rust-d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0.tar.xz
Auto merge of #67080 - JohnTitor:rollup-2t6fm3u, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #66649 (VxWorks: fix issues in accessing environment variables) - #66764 (Tweak wording of `collect()` on bad target type) - #66900 (Clean up error codes) - #66974 ([CI] fix the `! isCI` check in src/ci/run.sh) - #66979 (Add long error for E0631 and update ui tests.) - #67017 (cleanup long error explanations) - #67021 (Fix docs for formatting delegations) - #67041 (add ExitStatusExt into prelude) - #67065 (Fix fetching arguments on the wasm32-wasi target) - #67066 (Update the revision of wasi-libc used in wasm32-wasi) Failed merges: r? @ghost
-rwxr-xr-xsrc/ci/docker/dist-various-2/build-wasi-toolchain.sh2
-rwxr-xr-xsrc/ci/run.sh2
-rw-r--r--src/libcore/fmt/mod.rs11
-rw-r--r--src/libcore/iter/traits/collect.rs4
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0092.md7
-rw-r--r--src/librustc_error_codes/error_codes/E0093.md8
-rw-r--r--src/librustc_error_codes/error_codes/E0094.md3
-rw-r--r--src/librustc_error_codes/error_codes/E0106.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0107.md23
-rw-r--r--src/librustc_error_codes/error_codes/E0109.md1
-rw-r--r--src/librustc_error_codes/error_codes/E0116.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0117.md14
-rw-r--r--src/librustc_error_codes/error_codes/E0118.md6
-rw-r--r--src/librustc_error_codes/error_codes/E0119.md3
-rw-r--r--src/librustc_error_codes/error_codes/E0631.md27
-rw-r--r--src/libstd/sys/vxworks/ext/mod.rs3
-rw-r--r--src/libstd/sys/vxworks/os.rs19
-rw-r--r--src/libstd/sys/vxworks/process/process_vxworks.rs12
-rw-r--r--src/libstd/sys/wasi/args.rs1
-rw-r--r--src/test/ui/anonymous-higher-ranked-lifetime.stderr1
-rw-r--r--src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr1
-rw-r--r--src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr3
-rw-r--r--src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr1
-rw-r--r--src/test/ui/closures/issue-41366.stderr3
-rw-r--r--src/test/ui/issues/issue-43623.stderr3
-rw-r--r--src/test/ui/issues/issue-60283.stderr3
-rw-r--r--src/test/ui/mismatched_types/E0631.stderr1
-rw-r--r--src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr3
-rw-r--r--src/test/ui/mismatched_types/closure-mismatch.stderr3
-rw-r--r--src/test/ui/mismatched_types/fn-variance-1.stderr1
-rw-r--r--src/test/ui/mismatched_types/issue-36053-2.stderr3
-rw-r--r--src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr1
-rw-r--r--src/test/ui/type/type-check-defaults.rs4
-rw-r--r--src/test/ui/type/type-check-defaults.stderr8
-rw-r--r--src/test/ui/type/type-dependent-def-issue-49241.rs2
-rw-r--r--src/test/ui/type/type-dependent-def-issue-49241.stderr4
37 files changed, 148 insertions, 59 deletions
diff --git a/src/ci/docker/dist-various-2/build-wasi-toolchain.sh b/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
index 17aa789..925d5ca 100755
--- a/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
+++ b/src/ci/docker/dist-various-2/build-wasi-toolchain.sh
@@ -12,7 +12,7 @@ export PATH=`pwd`/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-14.04/bin:$PATH
12git clone https://github.com/CraneStation/wasi-libc 12git clone https://github.com/CraneStation/wasi-libc
13 13
14cd wasi-libc 14cd wasi-libc
15git reset --hard a94d2d04e7722b323573da2bd04e909a5763d35b 15git reset --hard f645f498dfbbbc00a7a97874d33082d3605c3f21
16make -j$(nproc) INSTALL_DIR=/wasm32-wasi install 16make -j$(nproc) INSTALL_DIR=/wasm32-wasi install
17 17
18cd .. 18cd ..
diff --git a/src/ci/run.sh b/src/ci/run.sh
index ae5b224..38d1d2b 100755
--- a/src/ci/run.sh
+++ b/src/ci/run.sh
@@ -23,7 +23,7 @@ fi
23ci_dir=`cd $(dirname $0) && pwd` 23ci_dir=`cd $(dirname $0) && pwd`
24source "$ci_dir/shared.sh" 24source "$ci_dir/shared.sh"
25 25
26if [ ! isCI ] || isCiBranch auto || isCiBranch beta; then 26if ! isCI || isCiBranch auto || isCiBranch beta; then
27 RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.print-step-timings --enable-verbose-tests" 27 RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set build.print-step-timings --enable-verbose-tests"
28fi 28fi
29 29
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 4c941e2..e2f49ee 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -662,7 +662,7 @@ pub trait Display {
662/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 662/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
663/// let val = self.0; 663/// let val = self.0;
664/// 664///
665/// write!(f, "{:o}", val) // delegate to i32's implementation 665/// fmt::Octal::fmt(&val, f) // delegate to i32's implementation
666/// } 666/// }
667/// } 667/// }
668/// 668///
@@ -712,7 +712,7 @@ pub trait Octal {
712/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 712/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
713/// let val = self.0; 713/// let val = self.0;
714/// 714///
715/// write!(f, "{:b}", val) // delegate to i32's implementation 715/// fmt::Binary::fmt(&val, f) // delegate to i32's implementation
716/// } 716/// }
717/// } 717/// }
718/// 718///
@@ -771,7 +771,7 @@ pub trait Binary {
771/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 771/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
772/// let val = self.0; 772/// let val = self.0;
773/// 773///
774/// write!(f, "{:x}", val) // delegate to i32's implementation 774/// fmt::LowerHex::fmt(&val, f) // delegate to i32's implementation
775/// } 775/// }
776/// } 776/// }
777/// 777///
@@ -824,7 +824,7 @@ pub trait LowerHex {
824/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 824/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
825/// let val = self.0; 825/// let val = self.0;
826/// 826///
827/// write!(f, "{:X}", val) // delegate to i32's implementation 827/// fmt::UpperHex::fmt(&val, f) // delegate to i32's implementation
828/// } 828/// }
829/// } 829/// }
830/// 830///
@@ -869,7 +869,8 @@ pub trait UpperHex {
869/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 869/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
870/// // use `as` to convert to a `*const T`, which implements Pointer, which we can use 870/// // use `as` to convert to a `*const T`, which implements Pointer, which we can use
871/// 871///
872/// write!(f, "{:p}", self as *const Length) 872/// let ptr = self as *const Self;
873/// fmt::Pointer::fmt(&ptr, f)
873/// } 874/// }
874/// } 875/// }
875/// 876///
diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs
index bbdb169..d6ae5cf 100644
--- a/src/libcore/iter/traits/collect.rs
+++ b/src/libcore/iter/traits/collect.rs
@@ -91,9 +91,9 @@
91/// ``` 91/// ```
92#[stable(feature = "rust1", since = "1.0.0")] 92#[stable(feature = "rust1", since = "1.0.0")]
93#[rustc_on_unimplemented( 93#[rustc_on_unimplemented(
94 message="a collection of type `{Self}` cannot be built from an iterator \ 94 message="a value of type `{Self}` cannot be built from an iterator \
95 over elements of type `{A}`", 95 over elements of type `{A}`",
96 label="a collection of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`", 96 label="value of type `{Self}` cannot be built from `std::iter::Iterator<Item={A}>`",
97)] 97)]
98pub trait FromIterator<A>: Sized { 98pub trait FromIterator<A>: Sized {
99 /// Creates a value from an iterator. 99 /// Creates a value from an iterator.
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 7f111b4..9e4b704 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -347,6 +347,7 @@ E0622: include_str!("./error_codes/E0622.md"),
347E0623: include_str!("./error_codes/E0623.md"), 347E0623: include_str!("./error_codes/E0623.md"),
348E0624: include_str!("./error_codes/E0624.md"), 348E0624: include_str!("./error_codes/E0624.md"),
349E0626: include_str!("./error_codes/E0626.md"), 349E0626: include_str!("./error_codes/E0626.md"),
350E0631: include_str!("./error_codes/E0631.md"),
350E0633: include_str!("./error_codes/E0633.md"), 351E0633: include_str!("./error_codes/E0633.md"),
351E0635: include_str!("./error_codes/E0635.md"), 352E0635: include_str!("./error_codes/E0635.md"),
352E0636: include_str!("./error_codes/E0636.md"), 353E0636: include_str!("./error_codes/E0636.md"),
@@ -580,7 +581,6 @@ E0745: include_str!("./error_codes/E0745.md"),
580 // rustc_const_unstable attribute must be paired with stable/unstable 581 // rustc_const_unstable attribute must be paired with stable/unstable
581 // attribute 582 // attribute
582 E0630, 583 E0630,
583 E0631, // type mismatch in closure arguments
584 E0632, // cannot provide explicit generic arguments when `impl Trait` is 584 E0632, // cannot provide explicit generic arguments when `impl Trait` is
585 // used in argument position 585 // used in argument position
586 E0634, // type has conflicting packed representaton hints 586 E0634, // type has conflicting packed representaton hints
diff --git a/src/librustc_error_codes/error_codes/E0092.md b/src/librustc_error_codes/error_codes/E0092.md
index 2750a7d..e289534 100644
--- a/src/librustc_error_codes/error_codes/E0092.md
+++ b/src/librustc_error_codes/error_codes/E0092.md
@@ -1,4 +1,5 @@
1You tried to declare an undefined atomic operation function. 1An undefined atomic operation function was declared.
2
2Erroneous code example: 3Erroneous code example:
3 4
4```compile_fail,E0092 5```compile_fail,E0092
@@ -11,8 +12,8 @@ extern "rust-intrinsic" {
11``` 12```
12 13
13Please check you didn't make a mistake in the function's name. All intrinsic 14Please check you didn't make a mistake in the function's name. All intrinsic
14functions are defined in librustc_codegen_llvm/intrinsic.rs and in 15functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
15libcore/intrinsics.rs in the Rust source code. Example: 16`libcore/intrinsics.rs` in the Rust source code. Example:
16 17
17``` 18```
18#![feature(intrinsics)] 19#![feature(intrinsics)]
diff --git a/src/librustc_error_codes/error_codes/E0093.md b/src/librustc_error_codes/error_codes/E0093.md
index 9633f79..8e7de1a 100644
--- a/src/librustc_error_codes/error_codes/E0093.md
+++ b/src/librustc_error_codes/error_codes/E0093.md
@@ -1,4 +1,6 @@
1You declared an unknown intrinsic function. Erroneous code example: 1An unknown intrinsic function was declared.
2
3Erroneous code example:
2 4
3```compile_fail,E0093 5```compile_fail,E0093
4#![feature(intrinsics)] 6#![feature(intrinsics)]
@@ -15,8 +17,8 @@ fn main() {
15``` 17```
16 18
17Please check you didn't make a mistake in the function's name. All intrinsic 19Please check you didn't make a mistake in the function's name. All intrinsic
18functions are defined in librustc_codegen_llvm/intrinsic.rs and in 20functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
19libcore/intrinsics.rs in the Rust source code. Example: 21`libcore/intrinsics.rs` in the Rust source code. Example:
20 22
21``` 23```
22#![feature(intrinsics)] 24#![feature(intrinsics)]
diff --git a/src/librustc_error_codes/error_codes/E0094.md b/src/librustc_error_codes/error_codes/E0094.md
index 4d27f61..42baa65 100644
--- a/src/librustc_error_codes/error_codes/E0094.md
+++ b/src/librustc_error_codes/error_codes/E0094.md
@@ -1,4 +1,5 @@
1You gave an invalid number of type parameters to an intrinsic function. 1An invalid number of type parameters was given to an intrinsic function.
2
2Erroneous code example: 3Erroneous code example:
3 4
4```compile_fail,E0094 5```compile_fail,E0094
diff --git a/src/librustc_error_codes/error_codes/E0106.md b/src/librustc_error_codes/error_codes/E0106.md
index 8a49c1f..60ca1dd 100644
--- a/src/librustc_error_codes/error_codes/E0106.md
+++ b/src/librustc_error_codes/error_codes/E0106.md
@@ -2,7 +2,7 @@ This error indicates that a lifetime is missing from a type. If it is an error
2inside a function signature, the problem may be with failing to adhere to the 2inside a function signature, the problem may be with failing to adhere to the
3lifetime elision rules (see below). 3lifetime elision rules (see below).
4 4
5Here are some simple examples of where you'll run into this error: 5Erroneous code examples:
6 6
7```compile_fail,E0106 7```compile_fail,E0106
8struct Foo1 { x: &bool } 8struct Foo1 { x: &bool }
@@ -27,7 +27,7 @@ function signatures which allows you to leave out lifetimes in certain cases.
27For more background on lifetime elision see [the book][book-le]. 27For more background on lifetime elision see [the book][book-le].
28 28
29The lifetime elision rules require that any function signature with an elided 29The lifetime elision rules require that any function signature with an elided
30output lifetime must either have 30output lifetime must either have:
31 31
32 - exactly one input lifetime 32 - exactly one input lifetime
33 - or, multiple input lifetimes, but the function must also be a method with a 33 - or, multiple input lifetimes, but the function must also be a method with a
diff --git a/src/librustc_error_codes/error_codes/E0107.md b/src/librustc_error_codes/error_codes/E0107.md
index bfe0d21..4d22b17 100644
--- a/src/librustc_error_codes/error_codes/E0107.md
+++ b/src/librustc_error_codes/error_codes/E0107.md
@@ -1,4 +1,6 @@
1This error means that an incorrect number of generic arguments were provided: 1An incorrect number of generic arguments were provided.
2
3Erroneous code example:
2 4
3```compile_fail,E0107 5```compile_fail,E0107
4struct Foo<T> { x: T } 6struct Foo<T> { x: T }
@@ -9,6 +11,7 @@ struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
9 // expected 1, found 2 11 // expected 1, found 2
10 12
11fn foo<T, U>(x: T, y: U) {} 13fn foo<T, U>(x: T, y: U) {}
14fn f() {}
12 15
13fn main() { 16fn main() {
14 let x: bool = true; 17 let x: bool = true;
@@ -16,12 +19,26 @@ fn main() {
16 // expected 2, found 1 19 // expected 2, found 1
17 foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments: 20 foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
18 // expected 2, found 3 21 // expected 2, found 3
22 f::<'static>(); // error: wrong number of lifetime arguments
23 // expected 0, found 1
19} 24}
25```
26
27When using/declaring an item with generic arguments, you must provide the exact
28same number:
29
30```
31struct Foo<T> { x: T }
32
33struct Bar<T> { x: Foo<T> } // ok!
34struct Baz<S, T> { x: Foo<S>, y: Foo<T> } // ok!
20 35
36fn foo<T, U>(x: T, y: U) {}
21fn f() {} 37fn f() {}
22 38
23fn main() { 39fn main() {
24 f::<'static>(); // error: wrong number of lifetime arguments: 40 let x: bool = true;
25 // expected 0, found 1 41 foo::<bool, u32>(x, 12); // ok!
42 f(); // ok!
26} 43}
27``` 44```
diff --git a/src/librustc_error_codes/error_codes/E0109.md b/src/librustc_error_codes/error_codes/E0109.md
index 5bc229a..2eab972 100644
--- a/src/librustc_error_codes/error_codes/E0109.md
+++ b/src/librustc_error_codes/error_codes/E0109.md
@@ -1,4 +1,5 @@
1You tried to provide a generic argument to a type which doesn't need it. 1You tried to provide a generic argument to a type which doesn't need it.
2
2Erroneous code example: 3Erroneous code example:
3 4
4```compile_fail,E0109 5```compile_fail,E0109
diff --git a/src/librustc_error_codes/error_codes/E0116.md b/src/librustc_error_codes/error_codes/E0116.md
index 27759a4..ca849c2 100644
--- a/src/librustc_error_codes/error_codes/E0116.md
+++ b/src/librustc_error_codes/error_codes/E0116.md
@@ -1,11 +1,15 @@
1You can only define an inherent implementation for a type in the same crate 1An inherent implementation was defined for a type outside the current crate.
2where the type was defined. For example, an `impl` block as below is not allowed 2
3since `Vec` is defined in the standard library: 3Erroneous code example:
4 4
5```compile_fail,E0116 5```compile_fail,E0116
6impl Vec<u8> { } // error 6impl Vec<u8> { } // error
7``` 7```
8 8
9You can only define an inherent implementation for a type in the same crate
10where the type was defined. For example, an `impl` block as above is not allowed
11since `Vec` is defined in the standard library.
12
9To fix this problem, you can do either of these things: 13To fix this problem, you can do either of these things:
10 14
11 - define a trait that has the desired associated functions/types/constants and 15 - define a trait that has the desired associated functions/types/constants and
diff --git a/src/librustc_error_codes/error_codes/E0117.md b/src/librustc_error_codes/error_codes/E0117.md
index bd36230..7fa211d 100644
--- a/src/librustc_error_codes/error_codes/E0117.md
+++ b/src/librustc_error_codes/error_codes/E0117.md
@@ -1,3 +1,11 @@
1The `Drop` trait was implemented on a non-struct type.
2
3Erroneous code example:
4
5```compile_fail,E0117
6impl Drop for u32 {}
7```
8
1This error indicates a violation of one of Rust's orphan rules for trait 9This error indicates a violation of one of Rust's orphan rules for trait
2implementations. The rule prohibits any implementation of a foreign trait (a 10implementations. The rule prohibits any implementation of a foreign trait (a
3trait defined in another crate) where 11trait defined in another crate) where
@@ -6,12 +14,6 @@ trait defined in another crate) where
6 - all of the parameters being passed to the trait (if there are any) are also 14 - all of the parameters being passed to the trait (if there are any) are also
7 foreign. 15 foreign.
8 16
9Here's one example of this error:
10
11```compile_fail,E0117
12impl Drop for u32 {}
13```
14
15To avoid this kind of error, ensure that at least one local type is referenced 17To avoid this kind of error, ensure that at least one local type is referenced
16by the `impl`: 18by the `impl`:
17 19
diff --git a/src/librustc_error_codes/error_codes/E0118.md b/src/librustc_error_codes/error_codes/E0118.md
index baf35ff..5cb5f50 100644
--- a/src/librustc_error_codes/error_codes/E0118.md
+++ b/src/librustc_error_codes/error_codes/E0118.md
@@ -1,5 +1,7 @@
1You're trying to write an inherent implementation for something which isn't a 1An inherent implementation was defined for something which isn't a struct nor
2struct nor an enum. Erroneous code example: 2an enum.
3
4Erroneous code example:
3 5
4```compile_fail,E0118 6```compile_fail,E0118
5impl (u8, u8) { // error: no base type found for inherent implementation 7impl (u8, u8) { // error: no base type found for inherent implementation
diff --git a/src/librustc_error_codes/error_codes/E0119.md b/src/librustc_error_codes/error_codes/E0119.md
index 0af3bd4..e596349 100644
--- a/src/librustc_error_codes/error_codes/E0119.md
+++ b/src/librustc_error_codes/error_codes/E0119.md
@@ -1,5 +1,6 @@
1There are conflicting trait implementations for the same type. 1There are conflicting trait implementations for the same type.
2Example of erroneous code: 2
3Erroneous code example:
3 4
4```compile_fail,E0119 5```compile_fail,E0119
5trait MyTrait { 6trait MyTrait {
diff --git a/src/librustc_error_codes/error_codes/E0631.md b/src/librustc_error_codes/error_codes/E0631.md
new file mode 100644
index 0000000..6188d5f
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0631.md
@@ -0,0 +1,27 @@
1This error indicates a type mismatch in closure arguments.
2
3Erroneous code example:
4
5```compile_fail,E0631
6fn foo<F: Fn(i32)>(f: F) {
7}
8
9fn main() {
10 foo(|x: &str| {});
11}
12```
13
14The error occurs because `foo` accepts a closure that takes an `i32` argument,
15but in `main`, it is passed a closure with a `&str` argument.
16
17This can be resolved by changing the type annotation or removing it entirely
18if it can be inferred.
19
20```
21fn foo<F: Fn(i32)>(f: F) {
22}
23
24fn main() {
25 foo(|x: i32| {});
26}
27```
diff --git a/src/libstd/sys/vxworks/ext/mod.rs b/src/libstd/sys/vxworks/ext/mod.rs
index 251a198..8fa9bd9 100644
--- a/src/libstd/sys/vxworks/ext/mod.rs
+++ b/src/libstd/sys/vxworks/ext/mod.rs
@@ -18,4 +18,7 @@ pub mod prelude {
18 #[doc(no_inline)] 18 #[doc(no_inline)]
19 #[stable(feature = "rust1", since = "1.0.0")] 19 #[stable(feature = "rust1", since = "1.0.0")]
20 pub use super::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; 20 pub use super::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
21 #[doc(no_inline)]
22 #[stable(feature = "rust1", since = "1.0.0")]
23 pub use super::process::ExitStatusExt;
21} 24}
diff --git a/src/libstd/sys/vxworks/os.rs b/src/libstd/sys/vxworks/os.rs
index baa6c42..71e1d16 100644
--- a/src/libstd/sys/vxworks/os.rs
+++ b/src/libstd/sys/vxworks/os.rs
@@ -11,14 +11,12 @@ use crate::path::{self, PathBuf, Path};
11use crate::ptr; 11use crate::ptr;
12use crate::slice; 12use crate::slice;
13use crate::str; 13use crate::str;
14use crate::sys_common::mutex::Mutex; 14use crate::sys_common::mutex::{Mutex, MutexGuard};
15use crate::sys::cvt; 15use crate::sys::cvt;
16/*use sys::fd; this one is probably important */ 16/*use sys::fd; this one is probably important */
17use crate::vec; 17use crate::vec;
18 18
19const TMPBUF_SZ: usize = 128; 19const TMPBUF_SZ: usize = 128;
20static ENV_LOCK: Mutex = Mutex::new();
21
22 20
23// This is a terrible fix 21// This is a terrible fix
24use crate::sys::os_str::Buf; 22use crate::sys::os_str::Buf;
@@ -200,11 +198,18 @@ pub unsafe fn environ() -> *mut *const *const c_char {
200 &mut environ 198 &mut environ
201} 199}
202 200
201pub unsafe fn env_lock() -> MutexGuard<'static> {
202 // We never call `ENV_LOCK.init()`, so it is UB to attempt to
203 // acquire this mutex reentrantly!
204 static ENV_LOCK: Mutex = Mutex::new();
205 ENV_LOCK.lock()
206}
207
203/// Returns a vector of (variable, value) byte-vector pairs for all the 208/// Returns a vector of (variable, value) byte-vector pairs for all the
204/// environment variables of the current process. 209/// environment variables of the current process.
205pub fn env() -> Env { 210pub fn env() -> Env {
206 unsafe { 211 unsafe {
207 let _guard = ENV_LOCK.lock(); 212 let _guard = env_lock();
208 let mut environ = *environ(); 213 let mut environ = *environ();
209 if environ == ptr::null() { 214 if environ == ptr::null() {
210 panic!("os::env() failure getting env string from OS: {}", 215 panic!("os::env() failure getting env string from OS: {}",
@@ -244,7 +249,7 @@ pub fn getenv(k: &OsStr) -> io::Result<Option<OsString>> {
244 // always None as well 249 // always None as well
245 let k = CString::new(k.as_bytes())?; 250 let k = CString::new(k.as_bytes())?;
246 unsafe { 251 unsafe {
247 let _guard = ENV_LOCK.lock(); 252 let _guard = env_lock();
248 let s = libc::getenv(k.as_ptr()) as *const libc::c_char; 253 let s = libc::getenv(k.as_ptr()) as *const libc::c_char;
249 let ret = if s.is_null() { 254 let ret = if s.is_null() {
250 None 255 None
@@ -260,7 +265,7 @@ pub fn setenv(k: &OsStr, v: &OsStr) -> io::Result<()> {
260 let v = CString::new(v.as_bytes())?; 265 let v = CString::new(v.as_bytes())?;
261 266
262 unsafe { 267 unsafe {
263 let _guard = ENV_LOCK.lock(); 268 let _guard = env_lock();
264 cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(|_| ()) 269 cvt(libc::setenv(k.as_ptr(), v.as_ptr(), 1)).map(|_| ())
265 } 270 }
266} 271}
@@ -269,7 +274,7 @@ pub fn unsetenv(n: &OsStr) -> io::Result<()> {
269 let nbuf = CString::new(n.as_bytes())?; 274 let nbuf = CString::new(n.as_bytes())?;
270 275
271 unsafe { 276 unsafe {
272 let _guard = ENV_LOCK.lock(); 277 let _guard = env_lock();
273 cvt(libc::unsetenv(nbuf.as_ptr())).map(|_| ()) 278 cvt(libc::unsetenv(nbuf.as_ptr())).map(|_| ())
274 } 279 }
275} 280}
diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs
index 7446471..79bfd77 100644
--- a/src/libstd/sys/vxworks/process/process_vxworks.rs
+++ b/src/libstd/sys/vxworks/process/process_vxworks.rs
@@ -15,6 +15,7 @@ impl Command {
15 -> io::Result<(Process, StdioPipes)> { 15 -> io::Result<(Process, StdioPipes)> {
16 use crate::sys::{cvt_r}; 16 use crate::sys::{cvt_r};
17 const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX"; 17 const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
18 let envp = self.capture_env();
18 19
19 if self.saw_nul() { 20 if self.saw_nul() {
20 return Err(io::Error::new(ErrorKind::InvalidInput, 21 return Err(io::Error::new(ErrorKind::InvalidInput,
@@ -52,12 +53,19 @@ impl Command {
52 t!(cvt(libc::chdir(cwd.as_ptr()))); 53 t!(cvt(libc::chdir(cwd.as_ptr())));
53 } 54 }
54 55
56 let c_envp = envp.as_ref().map(|c| c.as_ptr())
57 .unwrap_or_else(|| *sys::os::environ() as *const _);
58 let stack_size = thread::min_stack();
59
60 // ensure that access to the environment is synchronized
61 let _lock = sys::os::env_lock();
62
55 let ret = libc::rtpSpawn( 63 let ret = libc::rtpSpawn(
56 self.get_argv()[0], // executing program 64 self.get_argv()[0], // executing program
57 self.get_argv().as_ptr() as *mut *const c_char, // argv 65 self.get_argv().as_ptr() as *mut *const c_char, // argv
58 *sys::os::environ() as *mut *const c_char, 66 c_envp as *mut *const c_char,
59 100 as c_int, // initial priority 67 100 as c_int, // initial priority
60 thread::min_stack(), // initial stack size. 68 stack_size, // initial stack size.
61 0, // options 69 0, // options
62 0 // task options 70 0 // task options
63 ); 71 );
diff --git a/src/libstd/sys/wasi/args.rs b/src/libstd/sys/wasi/args.rs
index 3db36f5..02aa68d 100644
--- a/src/libstd/sys/wasi/args.rs
+++ b/src/libstd/sys/wasi/args.rs
@@ -26,6 +26,7 @@ fn maybe_args() -> Option<Vec<OsString>> {
26 let mut argv = Vec::with_capacity(argc); 26 let mut argv = Vec::with_capacity(argc);
27 let mut buf = Vec::with_capacity(buf_size); 27 let mut buf = Vec::with_capacity(buf_size);
28 wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?; 28 wasi::args_get(argv.as_mut_ptr(), buf.as_mut_ptr()).ok()?;
29 argv.set_len(argc);
29 let mut ret = Vec::with_capacity(argc); 30 let mut ret = Vec::with_capacity(argc);
30 for ptr in argv { 31 for ptr in argv {
31 let s = CStr::from_ptr(ptr.cast()); 32 let s = CStr::from_ptr(ptr.cast());
diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr
index 9be44c7..c6d9a61 100644
--- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr
+++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr
@@ -121,3 +121,4 @@ LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(),
121 121
122error: aborting due to 11 previous errors 122error: aborting due to 11 previous errors
123 123
124For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
index a6b52b2..7141c04 100644
--- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
+++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
@@ -39,3 +39,4 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
39 39
40error: aborting due to 3 previous errors 40error: aborting due to 3 previous errors
41 41
42For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
index a154442..0033395 100644
--- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
+++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
@@ -77,4 +77,5 @@ LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| {
77 77
78error: aborting due to 5 previous errors 78error: aborting due to 5 previous errors
79 79
80For more information about this error, try `rustc --explain E0308`. 80Some errors have detailed explanations: E0308, E0631.
81For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
index 9fbe95a..1c6564e 100644
--- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
+++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
@@ -13,3 +13,4 @@ LL | with_closure(|x: u32, y: i32| {
13 13
14error: aborting due to previous error 14error: aborting due to previous error
15 15
16For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/closures/issue-41366.stderr b/src/test/ui/closures/issue-41366.stderr
index 91d26ef..2f2871e 100644
--- a/src/test/ui/closures/issue-41366.stderr
+++ b/src/test/ui/closures/issue-41366.stderr
@@ -19,4 +19,5 @@ LL | (&|_|()) as &dyn for<'x> Fn(<u32 as T<'x>>::V);
19 19
20error: aborting due to 2 previous errors 20error: aborting due to 2 previous errors
21 21
22For more information about this error, try `rustc --explain E0271`. 22Some errors have detailed explanations: E0271, E0631.
23For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issues/issue-43623.stderr b/src/test/ui/issues/issue-43623.stderr
index 2c57b85..d90eb53 100644
--- a/src/test/ui/issues/issue-43623.stderr
+++ b/src/test/ui/issues/issue-43623.stderr
@@ -25,4 +25,5 @@ LL | break_me::<Type, fn(_)>;
25 25
26error: aborting due to 2 previous errors 26error: aborting due to 2 previous errors
27 27
28For more information about this error, try `rustc --explain E0271`. 28Some errors have detailed explanations: E0271, E0631.
29For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/issues/issue-60283.stderr b/src/test/ui/issues/issue-60283.stderr
index 69c1d85..d13dcd5 100644
--- a/src/test/ui/issues/issue-60283.stderr
+++ b/src/test/ui/issues/issue-60283.stderr
@@ -27,4 +27,5 @@ LL | foo((), drop)
27 27
28error: aborting due to 2 previous errors 28error: aborting due to 2 previous errors
29 29
30For more information about this error, try `rustc --explain E0271`. 30Some errors have detailed explanations: E0271, E0631.
31For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr
index 88c1efd..06f5c05 100644
--- a/src/test/ui/mismatched_types/E0631.stderr
+++ b/src/test/ui/mismatched_types/E0631.stderr
@@ -46,3 +46,4 @@ LL | bar(f);
46 46
47error: aborting due to 4 previous errors 47error: aborting due to 4 previous errors
48 48
49For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
index 85cad61..ed50282 100644
--- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
+++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr
@@ -45,4 +45,5 @@ LL | baz(f);
45 45
46error: aborting due to 5 previous errors 46error: aborting due to 5 previous errors
47 47
48For more information about this error, try `rustc --explain E0271`. 48Some errors have detailed explanations: E0271, E0631.
49For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr
index fd2b9f3..f3874c0 100644
--- a/src/test/ui/mismatched_types/closure-mismatch.stderr
+++ b/src/test/ui/mismatched_types/closure-mismatch.stderr
@@ -24,4 +24,5 @@ LL | baz(|_| ());
24 24
25error: aborting due to 2 previous errors 25error: aborting due to 2 previous errors
26 26
27For more information about this error, try `rustc --explain E0271`. 27Some errors have detailed explanations: E0271, E0631.
28For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr
index 1a82dd5..88c9266 100644
--- a/src/test/ui/mismatched_types/fn-variance-1.stderr
+++ b/src/test/ui/mismatched_types/fn-variance-1.stderr
@@ -24,3 +24,4 @@ LL | apply(&mut 3, takes_imm);
24 24
25error: aborting due to 2 previous errors 25error: aborting due to 2 previous errors
26 26
27For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr
index 72f3220..da018aa 100644
--- a/src/test/ui/mismatched_types/issue-36053-2.stderr
+++ b/src/test/ui/mismatched_types/issue-36053-2.stderr
@@ -18,4 +18,5 @@ LL | once::<&str>("str").fuse().filter(|a: &str| true).count();
18 18
19error: aborting due to 2 previous errors 19error: aborting due to 2 previous errors
20 20
21For more information about this error, try `rustc --explain E0599`. 21Some errors have detailed explanations: E0599, E0631.
22For more information about an error, try `rustc --explain E0599`.
diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
index 2daf478..3c999f2 100644
--- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
+++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr
@@ -12,3 +12,4 @@ LL | let z = call_it(3, f);
12 12
13error: aborting due to previous error 13error: aborting due to previous error
14 14
15For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/ui/type/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs
index 5748c9b..5380fae 100644
--- a/src/test/ui/type/type-check-defaults.rs
+++ b/src/test/ui/type/type-check-defaults.rs
@@ -4,9 +4,9 @@ use std::ops::Add;
4 4
5struct Foo<T, U: FromIterator<T>>(T, U); 5struct Foo<T, U: FromIterator<T>>(T, U);
6struct WellFormed<Z = Foo<i32, i32>>(Z); 6struct WellFormed<Z = Foo<i32, i32>>(Z);
7//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` 7//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32`
8struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); 8struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
9//~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` 9//~^ ERROR a value of type `i32` cannot be built from an iterator over elements of type `i32`
10 10
11struct Bounds<T:Copy=String>(T); 11struct Bounds<T:Copy=String>(T);
12//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] 12//~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277]
diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr
index 6802bc3..6f84b37 100644
--- a/src/test/ui/type/type-check-defaults.stderr
+++ b/src/test/ui/type/type-check-defaults.stderr
@@ -1,21 +1,21 @@
1error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` 1error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
2 --> $DIR/type-check-defaults.rs:6:19 2 --> $DIR/type-check-defaults.rs:6:19
3 | 3 |
4LL | struct Foo<T, U: FromIterator<T>>(T, U); 4LL | struct Foo<T, U: FromIterator<T>>(T, U);
5 | ---------------------------------------- required by `Foo` 5 | ---------------------------------------- required by `Foo`
6LL | struct WellFormed<Z = Foo<i32, i32>>(Z); 6LL | struct WellFormed<Z = Foo<i32, i32>>(Z);
7 | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` 7 | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
8 | 8 |
9 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` 9 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
10 10
11error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` 11error[E0277]: a value of type `i32` cannot be built from an iterator over elements of type `i32`
12 --> $DIR/type-check-defaults.rs:8:27 12 --> $DIR/type-check-defaults.rs:8:27
13 | 13 |
14LL | struct Foo<T, U: FromIterator<T>>(T, U); 14LL | struct Foo<T, U: FromIterator<T>>(T, U);
15 | ---------------------------------------- required by `Foo` 15 | ---------------------------------------- required by `Foo`
16... 16...
17LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z); 17LL | struct WellFormedNoBounds<Z:?Sized = Foo<i32, i32>>(Z);
18 | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` 18 | ^ value of type `i32` cannot be built from `std::iter::Iterator<Item=i32>`
19 | 19 |
20 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` 20 = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32`
21 21
diff --git a/src/test/ui/type/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs
index 5ad50ff..a25e3ba 100644
--- a/src/test/ui/type/type-dependent-def-issue-49241.rs
+++ b/src/test/ui/type/type-dependent-def-issue-49241.rs
@@ -3,5 +3,5 @@ fn main() {
3 const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant 3 const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
4 let s: [u32; l] = v.into_iter().collect(); 4 let s: [u32; l] = v.into_iter().collect();
5 //~^ ERROR evaluation of constant value failed 5 //~^ ERROR evaluation of constant value failed
6 //~^^ ERROR a collection of type 6 //~^^ ERROR a value of type
7} 7}
diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr
index 851004d..18a69c5 100644
--- a/src/test/ui/type/type-dependent-def-issue-49241.stderr
+++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr
@@ -10,11 +10,11 @@ error[E0080]: evaluation of constant value failed
10LL | let s: [u32; l] = v.into_iter().collect(); 10LL | let s: [u32; l] = v.into_iter().collect();
11 | ^ referenced constant has errors 11 | ^ referenced constant has errors
12 12
13error[E0277]: a collection of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}` 13error[E0277]: a value of type `[u32; _]` cannot be built from an iterator over elements of type `{integer}`
14 --> $DIR/type-dependent-def-issue-49241.rs:4:37 14 --> $DIR/type-dependent-def-issue-49241.rs:4:37
15 | 15 |
16LL | let s: [u32; l] = v.into_iter().collect(); 16LL | let s: [u32; l] = v.into_iter().collect();
17 | ^^^^^^^ a collection of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>` 17 | ^^^^^^^ value of type `[u32; _]` cannot be built from `std::iter::Iterator<Item={integer}>`
18 | 18 |
19 = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]` 19 = help: the trait `std::iter::FromIterator<{integer}>` is not implemented for `[u32; _]`
20 20