Skip to content

Commit 5efa4c0

Browse files
committed
Auto merge of rust-lang#86875 - JohnTitor:rollup-fuefamw, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#86477 (E0716: clarify that equivalent code example is erroneous) - rust-lang#86623 (Add check to ensure error code explanations are not removed anymore even if not emitted) - rust-lang#86856 (Make x.py less verbose on failures) - rust-lang#86858 (Stabilize `string_drain_as_str`) - rust-lang#86859 (Add a regression test for issue-69323) - rust-lang#86862 (re-export SwitchIntEdgeEffects) - rust-lang#86864 (Add missing code example for Write::write_vectored) - rust-lang#86874 (Bump deps) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b3d11f9 + 433287f commit 5efa4c0

File tree

13 files changed

+126
-70
lines changed

13 files changed

+126
-70
lines changed

Cargo.lock

+13-46
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ dependencies = [
398398
"jobserver",
399399
"libc",
400400
"log",
401-
"miow 0.3.6",
401+
"miow 0.3.7",
402402
"same-file",
403403
"shell-escape",
404404
"tempfile",
@@ -418,17 +418,6 @@ dependencies = [
418418
"serde_json",
419419
]
420420

421-
[[package]]
422-
name = "cargo_metadata"
423-
version = "0.11.1"
424-
source = "registry+https://github.com/rust-lang/crates.io-index"
425-
checksum = "89fec17b16f1ac67908af82e47d0a90a7afd0e1827b181cd77504323d3263d35"
426-
dependencies = [
427-
"semver 0.10.0",
428-
"serde",
429-
"serde_json",
430-
]
431-
432421
[[package]]
433422
name = "cargo_metadata"
434423
version = "0.12.0"
@@ -675,7 +664,7 @@ dependencies = [
675664
"glob",
676665
"lazy_static",
677666
"libc",
678-
"miow 0.3.6",
667+
"miow 0.3.7",
679668
"regex",
680669
"rustfix 0.6.0",
681670
"serde",
@@ -699,7 +688,7 @@ dependencies = [
699688
"lazy_static",
700689
"libc",
701690
"log",
702-
"miow 0.3.6",
691+
"miow 0.3.7",
703692
"regex",
704693
"rustfix 0.5.1",
705694
"serde",
@@ -867,24 +856,24 @@ dependencies = [
867856

868857
[[package]]
869858
name = "curl"
870-
version = "0.4.36"
859+
version = "0.4.38"
871860
source = "registry+https://github.com/rust-lang/crates.io-index"
872-
checksum = "d0bac9f84ca0977c4d9b8db998689de55b9e976656a6bc87fada2ca710d504c7"
861+
checksum = "003cb79c1c6d1c93344c7e1201bb51c2148f24ec2bd9c253709d6b2efb796515"
873862
dependencies = [
874863
"curl-sys",
875864
"libc",
876865
"openssl-probe",
877866
"openssl-sys",
878867
"schannel",
879-
"socket2 0.4.0",
868+
"socket2",
880869
"winapi 0.3.9",
881870
]
882871

883872
[[package]]
884873
name = "curl-sys"
885-
version = "0.4.42+curl-7.76.0"
874+
version = "0.4.44+curl-7.77.0"
886875
source = "registry+https://github.com/rust-lang/crates.io-index"
887-
checksum = "4636d8d6109c842707018a104051436bffb8991ea20b2d1293db70b6e0ee4c7c"
876+
checksum = "4b6d85e9322b193f117c966e79c2d6929ec08c02f339f950044aba12e20bbaf1"
888877
dependencies = [
889878
"cc",
890879
"libc",
@@ -2263,7 +2252,7 @@ checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
22632252
dependencies = [
22642253
"log",
22652254
"mio",
2266-
"miow 0.3.6",
2255+
"miow 0.3.7",
22672256
"winapi 0.3.9",
22682257
]
22692258

@@ -2292,11 +2281,10 @@ dependencies = [
22922281

22932282
[[package]]
22942283
name = "miow"
2295-
version = "0.3.6"
2284+
version = "0.3.7"
22962285
source = "registry+https://github.com/rust-lang/crates.io-index"
2297-
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
2286+
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
22982287
dependencies = [
2299-
"socket2 0.3.19",
23002288
"winapi 0.3.9",
23012289
]
23022290

@@ -2525,7 +2513,7 @@ dependencies = [
25252513
"libc",
25262514
"log",
25272515
"mio-named-pipes",
2528-
"miow 0.3.6",
2516+
"miow 0.3.7",
25292517
"rand 0.7.3",
25302518
"tokio",
25312519
"winapi 0.3.9",
@@ -4681,16 +4669,6 @@ dependencies = [
46814669
"serde",
46824670
]
46834671

4684-
[[package]]
4685-
name = "semver"
4686-
version = "0.10.0"
4687-
source = "registry+https://github.com/rust-lang/crates.io-index"
4688-
checksum = "394cec28fa623e00903caf7ba4fa6fb9a0e260280bb8cdbbba029611108a0190"
4689-
dependencies = [
4690-
"semver-parser 0.7.0",
4691-
"serde",
4692-
]
4693-
46944672
[[package]]
46954673
name = "semver"
46964674
version = "0.11.0"
@@ -4879,17 +4857,6 @@ version = "1.0.1"
48794857
source = "registry+https://github.com/rust-lang/crates.io-index"
48804858
checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e"
48814859

4882-
[[package]]
4883-
name = "socket2"
4884-
version = "0.3.19"
4885-
source = "registry+https://github.com/rust-lang/crates.io-index"
4886-
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
4887-
dependencies = [
4888-
"cfg-if 1.0.0",
4889-
"libc",
4890-
"winapi 0.3.9",
4891-
]
4892-
48934860
[[package]]
48944861
name = "socket2"
48954862
version = "0.4.0"
@@ -5230,7 +5197,7 @@ dependencies = [
52305197
name = "tidy"
52315198
version = "0.1.0"
52325199
dependencies = [
5233-
"cargo_metadata 0.11.1",
5200+
"cargo_metadata 0.12.0",
52345201
"crossbeam-utils 0.8.3",
52355202
"lazy_static",
52365203
"regex",

compiler/rustc_error_codes/src/error_codes/E0716.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ Here, the expression `&foo()` is borrowing the expression `foo()`. As `foo()` is
1414
a call to a function, and not the name of a variable, this creates a
1515
**temporary** -- that temporary stores the return value from `foo()` so that it
1616
can be borrowed. You could imagine that `let p = bar(&foo());` is equivalent to
17-
this:
17+
the following, which uses an explicit temporary variable.
18+
19+
Erroneous code example:
1820

1921
```compile_fail,E0597
2022
# fn foo() -> i32 { 22 }
2123
# fn bar(x: &i32) -> &i32 { x }
2224
let p = {
2325
let tmp = foo(); // the temporary
24-
bar(&tmp)
26+
bar(&tmp) // error: `tmp` does not live long enough
2527
}; // <-- tmp is freed as we exit this block
2628
let q = p;
2729
```

compiler/rustc_mir/src/dataflow/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub(crate) use self::drop_flag_effects::*;
77
pub use self::framework::{
88
fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
99
BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
10-
ResultsCursor, ResultsRefCursor, ResultsVisitor,
10+
ResultsCursor, ResultsRefCursor, ResultsVisitor, SwitchIntEdgeEffects,
1111
};
1212

1313
use self::move_paths::MoveData;

library/alloc/src/string.rs

+14-16
Original file line numberDiff line numberDiff line change
@@ -2769,33 +2769,31 @@ impl<'a> Drain<'a> {
27692769
/// # Examples
27702770
///
27712771
/// ```
2772-
/// #![feature(string_drain_as_str)]
27732772
/// let mut s = String::from("abc");
27742773
/// let mut drain = s.drain(..);
27752774
/// assert_eq!(drain.as_str(), "abc");
27762775
/// let _ = drain.next().unwrap();
27772776
/// assert_eq!(drain.as_str(), "bc");
27782777
/// ```
2779-
#[unstable(feature = "string_drain_as_str", issue = "76905")] // Note: uncomment AsRef impls below when stabilizing.
2778+
#[stable(feature = "string_drain_as_str", since = "1.55.0")]
27802779
pub fn as_str(&self) -> &str {
27812780
self.iter.as_str()
27822781
}
27832782
}
27842783

2785-
// Uncomment when stabilizing `string_drain_as_str`.
2786-
// #[unstable(feature = "string_drain_as_str", issue = "76905")]
2787-
// impl<'a> AsRef<str> for Drain<'a> {
2788-
// fn as_ref(&self) -> &str {
2789-
// self.as_str()
2790-
// }
2791-
// }
2792-
//
2793-
// #[unstable(feature = "string_drain_as_str", issue = "76905")]
2794-
// impl<'a> AsRef<[u8]> for Drain<'a> {
2795-
// fn as_ref(&self) -> &[u8] {
2796-
// self.as_str().as_bytes()
2797-
// }
2798-
// }
2784+
#[stable(feature = "string_drain_as_str", since = "1.55.0")]
2785+
impl<'a> AsRef<str> for Drain<'a> {
2786+
fn as_ref(&self) -> &str {
2787+
self.as_str()
2788+
}
2789+
}
2790+
2791+
#[stable(feature = "string_drain_as_str", since = "1.55.0")]
2792+
impl<'a> AsRef<[u8]> for Drain<'a> {
2793+
fn as_ref(&self) -> &[u8] {
2794+
self.as_str().as_bytes()
2795+
}
2796+
}
27992797

28002798
#[stable(feature = "drain", since = "1.6.0")]
28012799
impl Iterator for Drain<'_> {

library/std/src/io/mod.rs

+21
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,27 @@ pub trait Write {
14181418
/// The default implementation calls [`write`] with either the first nonempty
14191419
/// buffer provided, or an empty one if none exists.
14201420
///
1421+
/// # Examples
1422+
///
1423+
/// ```no_run
1424+
/// use std::io::IoSlice;
1425+
/// use std::io::prelude::*;
1426+
/// use std::fs::File;
1427+
///
1428+
/// fn main() -> std::io::Result<()> {
1429+
/// let mut data1 = [1; 8];
1430+
/// let mut data2 = [15; 8];
1431+
/// let io_slice1 = IoSlice::new(&mut data1);
1432+
/// let io_slice2 = IoSlice::new(&mut data2);
1433+
///
1434+
/// let mut buffer = File::create("foo.txt")?;
1435+
///
1436+
/// // Writes some prefix of the byte string, not necessarily all of it.
1437+
/// buffer.write_vectored(&[io_slice1, io_slice2])?;
1438+
/// Ok(())
1439+
/// }
1440+
/// ```
1441+
///
14211442
/// [`write`]: Write::write
14221443
#[stable(feature = "iovec", since = "1.36.0")]
14231444
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize> {

src/bootstrap/bootstrap.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def unpack(tarball, tarball_suffix, dst, verbose=False, match=None):
138138
shutil.rmtree(os.path.join(dst, fname))
139139

140140

141-
def run(args, verbose=False, exception=False, **kwargs):
141+
def run(args, verbose=False, exception=False, is_bootstrap=False, **kwargs):
142142
"""Run a child program in a new process"""
143143
if verbose:
144144
print("running: " + ' '.join(args))
@@ -151,7 +151,14 @@ def run(args, verbose=False, exception=False, **kwargs):
151151
err = "failed to run: " + ' '.join(args)
152152
if verbose or exception:
153153
raise RuntimeError(err)
154-
sys.exit(err)
154+
# For most failures, we definitely do want to print this error, or the user will have no
155+
# idea what went wrong. But when we've successfully built bootstrap and it failed, it will
156+
# have already printed an error above, so there's no need to print the exact command we're
157+
# running.
158+
if is_bootstrap:
159+
sys.exit(1)
160+
else:
161+
sys.exit(err)
155162

156163

157164
def require(cmd, exit=True):
@@ -1170,7 +1177,7 @@ def bootstrap(help_triggered):
11701177
env["BOOTSTRAP_CONFIG"] = toml_path
11711178
if build.rustc_commit is not None:
11721179
env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
1173-
run(args, env=env, verbose=build.verbose)
1180+
run(args, env=env, verbose=build.verbose, is_bootstrap=True)
11741181

11751182

11761183
def main():

src/bootstrap/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ pub fn stream_cargo(
13661366

13671367
// Make sure Cargo actually succeeded after we read all of its stdout.
13681368
let status = t!(child.wait());
1369-
if !status.success() {
1369+
if builder.is_verbose() && !status.success() {
13701370
eprintln!(
13711371
"command did not execute successfully: {:?}\n\
13721372
expected success, got: {}",

src/ci/docker/host-x86_64/mingw-check/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ COPY scripts/sccache.sh /scripts/
2828
RUN sh /scripts/sccache.sh
2929

3030
COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
31+
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/
3132

3233
ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
3334
ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
@@ -37,6 +38,7 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
3738
python3 ../x.py test --stage 2 src/tools/tidy && \
3839
python3 ../x.py doc --stage 0 library/test && \
3940
/scripts/validate-toolstate.sh && \
41+
/scripts/validate-error-codes.sh && \
4042
# Runs checks to ensure that there are no ES5 issues in our JS code.
4143
es-check es5 ../src/librustdoc/html/static/*.js && \
4244
eslint ../src/librustdoc/html/static/*.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Checks that no error code explanation is removed.
3+
4+
set -eo pipefail
5+
6+
if [[ -z "$BASE_COMMIT" ]]; then
7+
echo "not checking error code explanations removal"
8+
exit 0
9+
fi
10+
11+
echo "Check if an error code explanation was removed..."
12+
13+
if (git diff "$BASE_COMMIT" --name-status | grep '^D' \
14+
| grep --quiet "compiler/rustc_error_codes/src/error_codes/"); then
15+
echo "Error code explanations should never be removed!"
16+
echo "Take a look at E0001 to see how to handle it."
17+
exit 1
18+
fi
19+
20+
echo "No error code explanation was removed!"

src/ci/docker/run.sh

+9
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ else
219219
command="/checkout/src/ci/run.sh"
220220
fi
221221

222+
if [ "$CI" != "" ]; then
223+
# Get some needed information for $BASE_COMMIT
224+
git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
225+
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
226+
else
227+
BASE_COMMIT=""
228+
fi
229+
222230
docker \
223231
run \
224232
--workdir /checkout/obj \
@@ -237,6 +245,7 @@ docker \
237245
--env TOOLSTATE_PUBLISH \
238246
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
239247
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
248+
--env BASE_COMMIT="$BASE_COMMIT" \
240249
--init \
241250
--rm \
242251
rust-ci \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-69323.rs:5:27
3+
|
4+
LL | #![cfg_attr(full, feature(type_alias_impl_trait))]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
9+
10+
warning: 1 warning emitted
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// check-pass
2+
3+
// revisions: min full
4+
#![feature(min_type_alias_impl_trait)]
5+
#![cfg_attr(full, feature(type_alias_impl_trait))]
6+
//[full]~^ WARN incomplete
7+
8+
use std::iter::{once, Chain};
9+
10+
fn test1<A: Iterator<Item = &'static str>>(x: A) -> Chain<A, impl Iterator<Item = &'static str>> {
11+
x.chain(once(","))
12+
}
13+
14+
type I<A> = Chain<A, impl Iterator<Item = &'static str>>;
15+
fn test2<A: Iterator<Item = &'static str>>(x: A) -> I<A> {
16+
x.chain(once(","))
17+
}
18+
19+
fn main() {}

src/tools/tidy/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2018"
66
autobins = false
77

88
[dependencies]
9-
cargo_metadata = "0.11"
9+
cargo_metadata = "0.12"
1010
regex = "1"
1111
lazy_static = "1"
1212
walkdir = "2"

0 commit comments

Comments
 (0)