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 8 pull requests #86875

Merged
merged 18 commits into from
Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
13bdc5c
Add check to ensure error code explanations are not removed anymore e…
GuillaumeGomez Jun 28, 2021
d6962ff
Only run error code explanation removal check if on CI
GuillaumeGomez Jul 2, 2021
fad1b9c
Make x.py less verbose on failures
jyn514 Jul 4, 2021
ab86df0
Stabilize `string_drain_as_str`
JohnTitor Jul 4, 2021
6bbf1e7
re-export SwitchIntEdgeEffects
tmiasko Jul 4, 2021
92197a5
E0716: clarify that equivalent code example is erroneous
tlyu Jun 19, 2021
2512e96
Add a regression test for issue-69323
JohnTitor Jul 4, 2021
f614608
tidy: update cargo_metadata to 0.12
klensy Jul 4, 2021
f742cde
Add missing code example for Write::write_vectored
GuillaumeGomez Jul 4, 2021
d5e8ad4
miow v0.3.6 -> v0.3.7, drops socket2 v0.3.19
klensy Jul 4, 2021
5d555bf
Rollup merge of #86477 - tlyu:e0716-clarification, r=JohnTitor
JohnTitor Jul 4, 2021
ac880e5
Rollup merge of #86623 - GuillaumeGomez:prevent-explanation-removal, …
JohnTitor Jul 4, 2021
249d872
Rollup merge of #86856 - jyn514:x.py-less-verbose, r=Mark-Simulacrum
JohnTitor Jul 4, 2021
28dba82
Rollup merge of #86858 - JohnTitor:stabilize-string-drain-as-str, r=M…
JohnTitor Jul 4, 2021
d3244e2
Rollup merge of #86859 - JohnTitor:test-69323, r=jackh726
JohnTitor Jul 4, 2021
8bb5f37
Rollup merge of #86862 - tmiasko:re-export-SwitchIntEdgeEffects, r=jo…
JohnTitor Jul 4, 2021
0e4c4cd
Rollup merge of #86864 - GuillaumeGomez:example-write-vectored, r=Joh…
JohnTitor Jul 4, 2021
433287f
Rollup merge of #86874 - klensy:bump-deps, r=Mark-Simulacrum
JohnTitor Jul 4, 2021
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
59 changes: 13 additions & 46 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ dependencies = [
"jobserver",
"libc",
"log",
"miow 0.3.6",
"miow 0.3.7",
"same-file",
"shell-escape",
"tempfile",
Expand All @@ -418,17 +418,6 @@ dependencies = [
"serde_json",
]

[[package]]
name = "cargo_metadata"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89fec17b16f1ac67908af82e47d0a90a7afd0e1827b181cd77504323d3263d35"
dependencies = [
"semver 0.10.0",
"serde",
"serde_json",
]

[[package]]
name = "cargo_metadata"
version = "0.12.0"
Expand Down Expand Up @@ -675,7 +664,7 @@ dependencies = [
"glob",
"lazy_static",
"libc",
"miow 0.3.6",
"miow 0.3.7",
"regex",
"rustfix 0.6.0",
"serde",
Expand All @@ -699,7 +688,7 @@ dependencies = [
"lazy_static",
"libc",
"log",
"miow 0.3.6",
"miow 0.3.7",
"regex",
"rustfix 0.5.1",
"serde",
Expand Down Expand Up @@ -867,24 +856,24 @@ dependencies = [

[[package]]
name = "curl"
version = "0.4.36"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0bac9f84ca0977c4d9b8db998689de55b9e976656a6bc87fada2ca710d504c7"
checksum = "003cb79c1c6d1c93344c7e1201bb51c2148f24ec2bd9c253709d6b2efb796515"
dependencies = [
"curl-sys",
"libc",
"openssl-probe",
"openssl-sys",
"schannel",
"socket2 0.4.0",
"socket2",
"winapi 0.3.9",
]

[[package]]
name = "curl-sys"
version = "0.4.42+curl-7.76.0"
version = "0.4.44+curl-7.77.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4636d8d6109c842707018a104051436bffb8991ea20b2d1293db70b6e0ee4c7c"
checksum = "4b6d85e9322b193f117c966e79c2d6929ec08c02f339f950044aba12e20bbaf1"
dependencies = [
"cc",
"libc",
Expand Down Expand Up @@ -2263,7 +2252,7 @@ checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
dependencies = [
"log",
"mio",
"miow 0.3.6",
"miow 0.3.7",
"winapi 0.3.9",
]

Expand Down Expand Up @@ -2292,11 +2281,10 @@ dependencies = [

[[package]]
name = "miow"
version = "0.3.6"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"socket2 0.3.19",
"winapi 0.3.9",
]

Expand Down Expand Up @@ -2525,7 +2513,7 @@ dependencies = [
"libc",
"log",
"mio-named-pipes",
"miow 0.3.6",
"miow 0.3.7",
"rand 0.7.3",
"tokio",
"winapi 0.3.9",
Expand Down Expand Up @@ -4681,16 +4669,6 @@ dependencies = [
"serde",
]

[[package]]
name = "semver"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "394cec28fa623e00903caf7ba4fa6fb9a0e260280bb8cdbbba029611108a0190"
dependencies = [
"semver-parser 0.7.0",
"serde",
]

[[package]]
name = "semver"
version = "0.11.0"
Expand Down Expand Up @@ -4879,17 +4857,6 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e"

[[package]]
name = "socket2"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e"
dependencies = [
"cfg-if 1.0.0",
"libc",
"winapi 0.3.9",
]

[[package]]
name = "socket2"
version = "0.4.0"
Expand Down Expand Up @@ -5230,7 +5197,7 @@ dependencies = [
name = "tidy"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.11.1",
"cargo_metadata 0.12.0",
"crossbeam-utils 0.8.3",
"lazy_static",
"regex",
Expand Down
6 changes: 4 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0716.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ Here, the expression `&foo()` is borrowing the expression `foo()`. As `foo()` is
a call to a function, and not the name of a variable, this creates a
**temporary** -- that temporary stores the return value from `foo()` so that it
can be borrowed. You could imagine that `let p = bar(&foo());` is equivalent to
this:
the following, which uses an explicit temporary variable.

Erroneous code example:

```compile_fail,E0597
# fn foo() -> i32 { 22 }
# fn bar(x: &i32) -> &i32 { x }
let p = {
let tmp = foo(); // the temporary
bar(&tmp)
bar(&tmp) // error: `tmp` does not live long enough
}; // <-- tmp is freed as we exit this block
let q = p;
```
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub(crate) use self::drop_flag_effects::*;
pub use self::framework::{
fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
ResultsCursor, ResultsRefCursor, ResultsVisitor,
ResultsCursor, ResultsRefCursor, ResultsVisitor, SwitchIntEdgeEffects,
};

use self::move_paths::MoveData;
Expand Down
30 changes: 14 additions & 16 deletions library/alloc/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2769,33 +2769,31 @@ impl<'a> Drain<'a> {
/// # Examples
///
/// ```
/// #![feature(string_drain_as_str)]
/// let mut s = String::from("abc");
/// let mut drain = s.drain(..);
/// assert_eq!(drain.as_str(), "abc");
/// let _ = drain.next().unwrap();
/// assert_eq!(drain.as_str(), "bc");
/// ```
#[unstable(feature = "string_drain_as_str", issue = "76905")] // Note: uncomment AsRef impls below when stabilizing.
#[stable(feature = "string_drain_as_str", since = "1.55.0")]
pub fn as_str(&self) -> &str {
self.iter.as_str()
}
}

// Uncomment when stabilizing `string_drain_as_str`.
// #[unstable(feature = "string_drain_as_str", issue = "76905")]
// impl<'a> AsRef<str> for Drain<'a> {
// fn as_ref(&self) -> &str {
// self.as_str()
// }
// }
//
// #[unstable(feature = "string_drain_as_str", issue = "76905")]
// impl<'a> AsRef<[u8]> for Drain<'a> {
// fn as_ref(&self) -> &[u8] {
// self.as_str().as_bytes()
// }
// }
#[stable(feature = "string_drain_as_str", since = "1.55.0")]
impl<'a> AsRef<str> for Drain<'a> {
fn as_ref(&self) -> &str {
self.as_str()
}
}

#[stable(feature = "string_drain_as_str", since = "1.55.0")]
impl<'a> AsRef<[u8]> for Drain<'a> {
fn as_ref(&self) -> &[u8] {
self.as_str().as_bytes()
}
}

#[stable(feature = "drain", since = "1.6.0")]
impl Iterator for Drain<'_> {
Expand Down
21 changes: 21 additions & 0 deletions library/std/src/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,27 @@ pub trait Write {
/// The default implementation calls [`write`] with either the first nonempty
/// buffer provided, or an empty one if none exists.
///
/// # Examples
///
/// ```no_run
/// use std::io::IoSlice;
/// use std::io::prelude::*;
/// use std::fs::File;
///
/// fn main() -> std::io::Result<()> {
/// let mut data1 = [1; 8];
/// let mut data2 = [15; 8];
/// let io_slice1 = IoSlice::new(&mut data1);
/// let io_slice2 = IoSlice::new(&mut data2);
///
/// let mut buffer = File::create("foo.txt")?;
///
/// // Writes some prefix of the byte string, not necessarily all of it.
/// buffer.write_vectored(&[io_slice1, io_slice2])?;
/// Ok(())
/// }
/// ```
///
/// [`write`]: Write::write
#[stable(feature = "iovec", since = "1.36.0")]
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize> {
Expand Down
13 changes: 10 additions & 3 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def unpack(tarball, tarball_suffix, dst, verbose=False, match=None):
shutil.rmtree(os.path.join(dst, fname))


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


def require(cmd, exit=True):
Expand Down Expand Up @@ -1170,7 +1177,7 @@ def bootstrap(help_triggered):
env["BOOTSTRAP_CONFIG"] = toml_path
if build.rustc_commit is not None:
env["BOOTSTRAP_DOWNLOAD_RUSTC"] = '1'
run(args, env=env, verbose=build.verbose)
run(args, env=env, verbose=build.verbose, is_bootstrap=True)


def main():
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ pub fn stream_cargo(

// Make sure Cargo actually succeeded after we read all of its stdout.
let status = t!(child.wait());
if !status.success() {
if builder.is_verbose() && !status.success() {
eprintln!(
"command did not execute successfully: {:?}\n\
expected success, got: {}",
Expand Down
2 changes: 2 additions & 0 deletions src/ci/docker/host-x86_64/mingw-check/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh

COPY host-x86_64/mingw-check/validate-toolstate.sh /scripts/
COPY host-x86_64/mingw-check/validate-error-codes.sh /scripts/

ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1
ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
Expand All @@ -37,6 +38,7 @@ ENV SCRIPT python3 ../x.py --stage 2 test src/tools/expand-yaml-anchors && \
python3 ../x.py test --stage 2 src/tools/tidy && \
python3 ../x.py doc --stage 0 library/test && \
/scripts/validate-toolstate.sh && \
/scripts/validate-error-codes.sh && \
# Runs checks to ensure that there are no ES5 issues in our JS code.
es-check es5 ../src/librustdoc/html/static/*.js && \
eslint ../src/librustdoc/html/static/*.js
20 changes: 20 additions & 0 deletions src/ci/docker/host-x86_64/mingw-check/validate-error-codes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Checks that no error code explanation is removed.

set -eo pipefail

if [[ -z "$BASE_COMMIT" ]]; then
echo "not checking error code explanations removal"
exit 0
fi

echo "Check if an error code explanation was removed..."

if (git diff "$BASE_COMMIT" --name-status | grep '^D' \
| grep --quiet "compiler/rustc_error_codes/src/error_codes/"); then
echo "Error code explanations should never be removed!"
echo "Take a look at E0001 to see how to handle it."
exit 1
fi

echo "No error code explanation was removed!"
9 changes: 9 additions & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ else
command="/checkout/src/ci/run.sh"
fi

if [ "$CI" != "" ]; then
# Get some needed information for $BASE_COMMIT
git fetch "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF"
BASE_COMMIT="$(git merge-base FETCH_HEAD HEAD)"
else
BASE_COMMIT=""
fi

docker \
run \
--workdir /checkout/obj \
Expand All @@ -237,6 +245,7 @@ docker \
--env TOOLSTATE_PUBLISH \
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
--env BASE_COMMIT="$BASE_COMMIT" \
--init \
--rm \
rust-ci \
Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-69323.full.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
warning: the feature `type_alias_impl_trait` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-69323.rs:5:27
|
LL | #![cfg_attr(full, feature(type_alias_impl_trait))]
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information

warning: 1 warning emitted

19 changes: 19 additions & 0 deletions src/test/ui/type-alias-impl-trait/issue-69323.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// check-pass

// revisions: min full
#![feature(min_type_alias_impl_trait)]
#![cfg_attr(full, feature(type_alias_impl_trait))]
//[full]~^ WARN incomplete

use std::iter::{once, Chain};

fn test1<A: Iterator<Item = &'static str>>(x: A) -> Chain<A, impl Iterator<Item = &'static str>> {
x.chain(once(","))
}

type I<A> = Chain<A, impl Iterator<Item = &'static str>>;
fn test2<A: Iterator<Item = &'static str>>(x: A) -> I<A> {
x.chain(once(","))
}

fn main() {}
2 changes: 1 addition & 1 deletion src/tools/tidy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2018"
autobins = false

[dependencies]
cargo_metadata = "0.11"
cargo_metadata = "0.12"
regex = "1"
lazy_static = "1"
walkdir = "2"
Expand Down