Skip to content

Commit

Permalink
Auto merge of rust-lang#88217 - jackh726:rollup-3k74o2m, r=jackh726
Browse files Browse the repository at this point in the history
Rollup of 13 pull requests

Successful merges:

 - rust-lang#87604 (CI: Verify commits in beta & stable are in upstream branches.)
 - rust-lang#88057 (Update RELEASES to clarify attribute macro values.)
 - rust-lang#88072 (Allow the iOS toolchain to be built on Linux)
 - rust-lang#88170 (Update release note for 1.55.0.)
 - rust-lang#88172 (Test that type alias impl trait happens in a submodule)
 - rust-lang#88179 (Mailmap entry for myself)
 - rust-lang#88182 (We meant to use a trait instead of lifetime here)
 - rust-lang#88183 (test TAIT in different positions)
 - rust-lang#88189 (Add TAIT struct test)
 - rust-lang#88192 (Use of impl trait in an impl as the value for an associated type in a dyn)
 - rust-lang#88194 (Test use of impl Trait in an impl as the value for an associated type in an impl trait)
 - rust-lang#88197 (Test tait use in a fn type)
 - rust-lang#88201 (Test that incomplete inference for TAITs fail)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Aug 22, 2021
2 parents 9faa714 + b9b53c8 commit 50731df
Show file tree
Hide file tree
Showing 21 changed files with 345 additions and 66 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ jobs:
- name: ensure line endings are correct
run: src/ci/scripts/verify-line-endings.sh
if: success() && !env.SKIP_JOB
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -499,6 +502,9 @@ jobs:
- name: ensure line endings are correct
run: src/ci/scripts/verify-line-endings.sh
if: success() && !env.SKIP_JOB
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down Expand Up @@ -609,6 +615,9 @@ jobs:
- name: ensure line endings are correct
run: src/ci/scripts/verify-line-endings.sh
if: success() && !env.SKIP_JOB
- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
if: success() && !env.SKIP_JOB
- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Falco Hirschenberger <falco.hirschenberger@gmail.com> <hirschen@itwm.fhg.de>
Felix S. Klock II <pnkfelix@pnkfx.org> Felix S Klock II <pnkfelix@pnkfx.org>
Flaper Fesp <flaper87@gmail.com>
Florian Wilkens <mrfloya_github@outlook.com> Florian Wilkens <floya@live.de>
Frank Steffahn <fdsteffahn@gmail.com> <frank.steffahn@stu.uni-kiel.de>
Gareth Daniel Smith <garethdanielsmith@gmail.com> gareth <gareth@gareth-N56VM.(none)>
Gareth Daniel Smith <garethdanielsmith@gmail.com> Gareth Smith <garethdanielsmith@gmail.com>
Georges Dubus <georges.dubus@gmail.com> <georges.dubus@compiletoi.net>
Expand Down
14 changes: 5 additions & 9 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Cargo
- [The package definition in `cargo metadata` now includes the `"default_run"`
field from the manifest.][cargo/9550]
- [Added `cargo d` as an alias for `cargo doc`.][cargo/9680]
- [Added `{lib}` as formatting option for `cargo tree` to print the "lib_name" of packages.][cargo/9663]

Rustdoc
-------
Expand Down Expand Up @@ -146,18 +147,13 @@ Version 1.54.0 (2021-07-29)
Language
-----------------------

- [You can now use macros for values in built-in attribute macros.][83366]
While a seemingly minor addition on its own, this enables a lot of
powerful functionality when combined correctly. Most notably you can
now include external documentation in your crate by writing the following.
- [You can now use macros for values in some built-in attributes.][83366]
This primarily allows you to call macros within the `#[doc]` attribute. For
example, to include external documentation in your crate, you can now write
the following:
```rust
#![doc = include_str!("README.md")]
```
You can also use this to include auto-generated modules:
```rust
#[path = concat!(env!("OUT_DIR"), "/generated.rs")]
mod generated;
```

- [You can now cast between unsized slice types (and types which contain
unsized slices) in `const fn`.][85078]
Expand Down
5 changes: 0 additions & 5 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,6 @@ pub fn check(build: &mut Build) {
}

for target in &build.targets {
// Can't compile for iOS unless we're on macOS
if target.contains("apple-ios") && !build.build.contains("apple-darwin") {
panic!("the iOS target is only supported on macOS");
}

build
.config
.target_config
Expand Down
4 changes: 4 additions & 0 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ x--expand-yaml-anchors--remove:
run: src/ci/scripts/verify-line-endings.sh
<<: *step

- name: ensure backported commits are in upstream branches
run: src/ci/scripts/verify-backported-commits.sh
<<: *step

- name: run the build
run: src/ci/scripts/run-build-from-ci.sh
env:
Expand Down
150 changes: 150 additions & 0 deletions src/ci/scripts/verify-backported-commits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#!/bin/bash
# Ensure commits in beta are in master & commits in stable are in beta + master.
set -euo pipefail
IFS=$'\n\t'

source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

# We don't care about commits that predate this automation check, so we pass a
# `<limit>` argument to `git cherry`.
BETA_LIMIT="53fd98ca776cb875bc9e5514f56b52eb74f9e7a9"
STABLE_LIMIT="a178d0322ce20e33eac124758e837cbd80a6f633"

verify_backported_commits_main() {
ci_base_branch=$(ciBaseBranch)

if [[ "$ci_base_branch" != "beta" && "$ci_base_branch" != "stable" ]]; then
echo 'Skipping. This is only run when merging to the beta or stable branches.'
exit 0
fi

echo 'git: unshallowing the repository so we can check commits'
git fetch \
--no-tags \
--no-recurse-submodules \
--progress \
--prune \
--unshallow

if [[ $ci_base_branch == "beta" ]]; then
verify_cherries master "$BETA_LIMIT" \
|| exit 1

elif [[ $ci_base_branch == "stable" ]]; then
(verify_cherries master "$STABLE_LIMIT" \
& verify_cherries beta "$STABLE_LIMIT") \
|| exit 1

fi
}

# Verify all commits in `HEAD` are backports of a commit in <upstream>. See
# https://git-scm.com/docs/git-cherry for an explanation of the arguments.
#
# $1 = <upstream>
# $2 = <limit>
verify_cherries() {
# commits that lack a `backport-of` comment.
local no_backports=()
# commits with an incorrect `backport-of` comment.
local bad_backports=()

commits=$(git cherry "origin/$1" HEAD "$2")

if [[ -z "$commits" ]]; then
echo "All commits in \`HEAD\` are present in \`$1\`"
return 0
fi

commits=$(echo "$commits" | grep '^\+' | cut -c 3-)

while read sha; do
# Check each commit in <current>..<upstream>
backport_sha=$(get_backport "$sha")

if [[ "$backport_sha" == "nothing" ]]; then
echo "\`$sha\` backports nothing"
continue
fi

if [[ -z "$backport_sha" ]]; then
no_backports+=("$sha")
continue
fi

if ! is_in_master "$backport_sha"; then
bad_backports+=("$sha")
continue
fi

echo "\`$sha\` backports \`$backport_sha\`"
done <<< "$commits"

failure=0

if [ ${#no_backports[@]} -ne 0 ]; then
echo 'Error: Could not find backports for all commits.'
echo
echo 'All commits in \`HEAD\` are required to have a corresponding upstream commit.'
echo 'It looks like the following commits:'
echo
for commit in "${no_backports[@]}"; do
echo " $commit"
done
echo
echo "do not match any commits in \`$1\`. If this was intended, add the text"
echo '\`backport-of: <SHA of a commit already in master>\`'
echo 'somewhere in the message of each of these commits.'
echo
failure=1
fi

if [ ${#bad_backports[@]} -ne 0 ]; then
echo 'Error: Found incorrectly marked commits.'
echo
echo 'The following commits:'
echo
for commit in "${bad_backports[@]}"; do
echo " $commit"
done
echo
echo 'have commit messages marked \`backport-of: <SHA>\`, but the SHA is not in'
echo '\`master\`.'
echo
failure=1
fi

return $failure
}

# Get the backport of a commit. It echoes one of:
#
# 1. A SHA of the backported commit
# 2. The string "nothing"
# 3. An empty string
#
# $1 = <sha>
get_backport() {
# This regex is:
#
# ^.* - throw away any extra starting characters
# backport-of: - prefix
# \s\? - optional space
# \(\) - capture group
# [a-f0-9]\+\|nothing - a SHA or the text 'nothing'
# .* - throw away any extra ending characters
# \1 - replace it with the first match
# {s//\1/p;q} - print the first occurrence and quit
#
git show -s --format=%B "$1" \
| sed -n '/^.*backport-of:\s\?\([a-f0-9]\+\|nothing\).*/{s//\1/p;q}'
}

# Check if a commit is in master.
#
# $1 = <sha>
is_in_master() {
git merge-base --is-ancestor "$1" origin/master 2> /dev/null
}

verify_backported_commits_main
23 changes: 23 additions & 0 deletions src/test/ui/type-alias-impl-trait/defining-use-submodule.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// check-pass

#![feature(type_alias_impl_trait)]
#![allow(dead_code)]

// test that the type alias impl trait defining use is in a submodule

fn main() {}

type Foo = impl std::fmt::Display;
type Bar = impl std::fmt::Display;

mod foo {
pub fn foo() -> super::Foo {
"foo"
}

pub mod bar {
pub fn bar() -> crate::Bar {
1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
fn main() {}

trait Trait {}
type Underconstrained<T: Trait> = impl 'static;
//~^ ERROR: at least one trait must be specified
type Underconstrained<T: Trait> = impl Send;

// no `Trait` bound
fn underconstrain<T>(_: T) -> Underconstrained<T> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
error: at least one trait must be specified
--> $DIR/generic_underconstrained.rs:6:35
|
LL | type Underconstrained<T: Trait> = impl 'static;
| ^^^^^^^^^^^^

error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/generic_underconstrained.rs:10:31
--> $DIR/generic_underconstrained.rs:9:31
|
LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
|
note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained.rs:6:26
|
LL | type Underconstrained<T: Trait> = impl 'static;
LL | type Underconstrained<T: Trait> = impl Send;
| ^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `T`
|
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
| +++++++

error: aborting due to 2 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

fn main() {}

type Underconstrained<T: std::fmt::Debug> = impl 'static;
//~^ ERROR: at least one trait must be specified
type Underconstrained<T: std::fmt::Debug> = impl Send;

// not a defining use, because it doesn't define *all* possible generics
fn underconstrained<U>(_: U) -> Underconstrained<U> {
//~^ ERROR `U` doesn't implement `Debug`
5u32
}

type Underconstrained2<T: std::fmt::Debug> = impl 'static;
//~^ ERROR: at least one trait must be specified
type Underconstrained2<T: std::fmt::Debug> = impl Send;

// not a defining use, because it doesn't define *all* possible generics
fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
Expand Down
24 changes: 6 additions & 18 deletions src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr
Original file line number Diff line number Diff line change
@@ -1,47 +1,35 @@
error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:5:45
|
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^

error: at least one trait must be specified
--> $DIR/generic_underconstrained2.rs:14:46
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
| ^^^^^^^^^^^^

error[E0277]: `U` doesn't implement `Debug`
--> $DIR/generic_underconstrained2.rs:9:33
--> $DIR/generic_underconstrained2.rs:8:33
|
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound in `Underconstrained`
--> $DIR/generic_underconstrained2.rs:5:26
|
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained`
help: consider restricting type parameter `U`
|
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
| +++++++++++++++++

error[E0277]: `V` doesn't implement `Debug`
--> $DIR/generic_underconstrained2.rs:18:43
--> $DIR/generic_underconstrained2.rs:16:43
|
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound in `Underconstrained2`
--> $DIR/generic_underconstrained2.rs:14:27
--> $DIR/generic_underconstrained2.rs:13:27
|
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2`
help: consider restricting type parameter `V`
|
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
| +++++++++++++++++

error: aborting due to 4 previous errors
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.
15 changes: 15 additions & 0 deletions src/test/ui/type-alias-impl-trait/incomplete-inference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#![feature(type_alias_impl_trait)]

type Foo = impl Sized;

fn bar() -> Foo {
None
//~^ ERROR: type annotations needed [E0282]
}

fn baz() -> Foo {
//~^ ERROR: concrete type differs from previous defining opaque type use
Some(())
}

fn main() {}
Loading

0 comments on commit 50731df

Please sign in to comment.