Skip to content

Rollup of 13 pull requests #88217

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

Merged
merged 28 commits into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
634244e
Update RELEASES to clarify attribute macro values.
ehuss Aug 15, 2021
79e402e
Allow the iOS toolchain to be built on Linux
kit-981 Aug 16, 2021
52a9883
Update release note for 1.55.0.
nebkor Aug 19, 2021
2644a15
Test that type alias impl trait happens in a submodule
spastorino Aug 19, 2021
700b64e
CI: Verify commits in beta & stable are in upstream branches.
Jul 29, 2021
30f7b89
Mailmap entry for myself
steffahn Aug 20, 2021
adc8cd3
Add cherry-pick.sh convenience script.
Aug 19, 2021
f19ba35
Add support for including non-backport commits.
Aug 20, 2021
49a31a2
We meant to use a trait instead of lifetime here
spastorino Aug 20, 2021
593fd7c
test TAIT in different positions
spastorino Aug 20, 2021
cfcc851
Add TAIT struct test
spastorino Aug 20, 2021
eb16ae7
Use of impl trait in an impl as the valoe for an associated type in a…
spastorino Aug 20, 2021
c6c2f11
Test tait use in a fn type
spastorino Aug 20, 2021
dcfff23
Test use of impl Trait in an impl as the value for an associated type…
spastorino Aug 20, 2021
29dffe5
Test that incomplete inference for TAITs fail
spastorino Aug 21, 2021
8660e3d
Rollup merge of #87604 - yaymukund:verify-backported-commits, r=Mark-…
jackh726 Aug 22, 2021
9e8b143
Rollup merge of #88057 - ehuss:releases-doc-macros, r=Mark-Simulacrum
jackh726 Aug 22, 2021
5ffff5c
Rollup merge of #88072 - kit-981:feature/build-ios-toolchain-on-linux…
jackh726 Aug 22, 2021
908b2ea
Rollup merge of #88170 - nebkor:release-note-1.55, r=Mark-Simulacrum
jackh726 Aug 22, 2021
0689152
Rollup merge of #88172 - spastorino:tait-defining-use-submodule-test,…
jackh726 Aug 22, 2021
1a48b56
Rollup merge of #88179 - steffahn:mailmap, r=Mark-Simulacrum
jackh726 Aug 22, 2021
5be51f2
Rollup merge of #88182 - spastorino:use-trait-in-tait-tests, r=oli-obk
jackh726 Aug 22, 2021
ae58c51
Rollup merge of #88183 - spastorino:add-tait-in-different-tuple-posit…
jackh726 Aug 22, 2021
73d9758
Rollup merge of #88189 - spastorino:add-tait-struct-test, r=oli-obk
jackh726 Aug 22, 2021
d6492b1
Rollup merge of #88192 - spastorino:add-tait-test-for-assoc-dyn, r=ol…
jackh726 Aug 22, 2021
66b04c6
Rollup merge of #88194 - spastorino:test-tait-assoc-impl-trait, r=oli…
jackh726 Aug 22, 2021
1d0d7c3
Rollup merge of #88197 - spastorino:tait-test-fn-type, r=oli-obk
jackh726 Aug 22, 2021
b9b53c8
Rollup merge of #88201 - spastorino:tait-incomplete-inference-test, r…
jackh726 Aug 22, 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
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 <[email protected]> <[email protected]>
Felix S. Klock II <[email protected]> Felix S Klock II <[email protected]>
Flaper Fesp <[email protected]>
Florian Wilkens <[email protected]> Florian Wilkens <[email protected]>
Frank Steffahn <[email protected]> <[email protected]>
Gareth Daniel Smith <[email protected]> gareth <gareth@gareth-N56VM.(none)>
Gareth Daniel Smith <[email protected]> Gareth Smith <[email protected]>
Georges Dubus <[email protected]> <[email protected]>
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