Skip to content

Commit 50731df

Browse files
committed
Auto merge of rust-lang#88217 - jackh726:rollup-3k74o2m, r=jackh726
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
2 parents 9faa714 + b9b53c8 commit 50731df

21 files changed

+345
-66
lines changed

.github/workflows/ci.yml

+9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ jobs:
128128
- name: ensure line endings are correct
129129
run: src/ci/scripts/verify-line-endings.sh
130130
if: success() && !env.SKIP_JOB
131+
- name: ensure backported commits are in upstream branches
132+
run: src/ci/scripts/verify-backported-commits.sh
133+
if: success() && !env.SKIP_JOB
131134
- name: run the build
132135
run: src/ci/scripts/run-build-from-ci.sh
133136
env:
@@ -499,6 +502,9 @@ jobs:
499502
- name: ensure line endings are correct
500503
run: src/ci/scripts/verify-line-endings.sh
501504
if: success() && !env.SKIP_JOB
505+
- name: ensure backported commits are in upstream branches
506+
run: src/ci/scripts/verify-backported-commits.sh
507+
if: success() && !env.SKIP_JOB
502508
- name: run the build
503509
run: src/ci/scripts/run-build-from-ci.sh
504510
env:
@@ -609,6 +615,9 @@ jobs:
609615
- name: ensure line endings are correct
610616
run: src/ci/scripts/verify-line-endings.sh
611617
if: success() && !env.SKIP_JOB
618+
- name: ensure backported commits are in upstream branches
619+
run: src/ci/scripts/verify-backported-commits.sh
620+
if: success() && !env.SKIP_JOB
612621
- name: run the build
613622
run: src/ci/scripts/run-build-from-ci.sh
614623
env:

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ Falco Hirschenberger <[email protected]> <[email protected]>
101101
Felix S. Klock II <[email protected]> Felix S Klock II <[email protected]>
102102
Flaper Fesp <[email protected]>
103103
Florian Wilkens <[email protected]> Florian Wilkens <[email protected]>
104+
104105
Gareth Daniel Smith <[email protected]> gareth <gareth@gareth-N56VM.(none)>
105106
Gareth Daniel Smith <[email protected]> Gareth Smith <[email protected]>
106107

RELEASES.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Cargo
7070
- [The package definition in `cargo metadata` now includes the `"default_run"`
7171
field from the manifest.][cargo/9550]
7272
- [Added `cargo d` as an alias for `cargo doc`.][cargo/9680]
73+
- [Added `{lib}` as formatting option for `cargo tree` to print the "lib_name" of packages.][cargo/9663]
7374

7475
Rustdoc
7576
-------
@@ -146,18 +147,13 @@ Version 1.54.0 (2021-07-29)
146147
Language
147148
-----------------------
148149

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

162158
- [You can now cast between unsized slice types (and types which contain
163159
unsized slices) in `const fn`.][85078]

src/bootstrap/sanity.rs

-5
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ pub fn check(build: &mut Build) {
166166
}
167167

168168
for target in &build.targets {
169-
// Can't compile for iOS unless we're on macOS
170-
if target.contains("apple-ios") && !build.build.contains("apple-darwin") {
171-
panic!("the iOS target is only supported on macOS");
172-
}
173-
174169
build
175170
.config
176171
.target_config

src/ci/github-actions/ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ x--expand-yaml-anchors--remove:
206206
run: src/ci/scripts/verify-line-endings.sh
207207
<<: *step
208208

209+
- name: ensure backported commits are in upstream branches
210+
run: src/ci/scripts/verify-backported-commits.sh
211+
<<: *step
212+
209213
- name: run the build
210214
run: src/ci/scripts/run-build-from-ci.sh
211215
env:
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/bin/bash
2+
# Ensure commits in beta are in master & commits in stable are in beta + master.
3+
set -euo pipefail
4+
IFS=$'\n\t'
5+
6+
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
7+
8+
# We don't care about commits that predate this automation check, so we pass a
9+
# `<limit>` argument to `git cherry`.
10+
BETA_LIMIT="53fd98ca776cb875bc9e5514f56b52eb74f9e7a9"
11+
STABLE_LIMIT="a178d0322ce20e33eac124758e837cbd80a6f633"
12+
13+
verify_backported_commits_main() {
14+
ci_base_branch=$(ciBaseBranch)
15+
16+
if [[ "$ci_base_branch" != "beta" && "$ci_base_branch" != "stable" ]]; then
17+
echo 'Skipping. This is only run when merging to the beta or stable branches.'
18+
exit 0
19+
fi
20+
21+
echo 'git: unshallowing the repository so we can check commits'
22+
git fetch \
23+
--no-tags \
24+
--no-recurse-submodules \
25+
--progress \
26+
--prune \
27+
--unshallow
28+
29+
if [[ $ci_base_branch == "beta" ]]; then
30+
verify_cherries master "$BETA_LIMIT" \
31+
|| exit 1
32+
33+
elif [[ $ci_base_branch == "stable" ]]; then
34+
(verify_cherries master "$STABLE_LIMIT" \
35+
& verify_cherries beta "$STABLE_LIMIT") \
36+
|| exit 1
37+
38+
fi
39+
}
40+
41+
# Verify all commits in `HEAD` are backports of a commit in <upstream>. See
42+
# https://git-scm.com/docs/git-cherry for an explanation of the arguments.
43+
#
44+
# $1 = <upstream>
45+
# $2 = <limit>
46+
verify_cherries() {
47+
# commits that lack a `backport-of` comment.
48+
local no_backports=()
49+
# commits with an incorrect `backport-of` comment.
50+
local bad_backports=()
51+
52+
commits=$(git cherry "origin/$1" HEAD "$2")
53+
54+
if [[ -z "$commits" ]]; then
55+
echo "All commits in \`HEAD\` are present in \`$1\`"
56+
return 0
57+
fi
58+
59+
commits=$(echo "$commits" | grep '^\+' | cut -c 3-)
60+
61+
while read sha; do
62+
# Check each commit in <current>..<upstream>
63+
backport_sha=$(get_backport "$sha")
64+
65+
if [[ "$backport_sha" == "nothing" ]]; then
66+
echo "\`$sha\` backports nothing"
67+
continue
68+
fi
69+
70+
if [[ -z "$backport_sha" ]]; then
71+
no_backports+=("$sha")
72+
continue
73+
fi
74+
75+
if ! is_in_master "$backport_sha"; then
76+
bad_backports+=("$sha")
77+
continue
78+
fi
79+
80+
echo "\`$sha\` backports \`$backport_sha\`"
81+
done <<< "$commits"
82+
83+
failure=0
84+
85+
if [ ${#no_backports[@]} -ne 0 ]; then
86+
echo 'Error: Could not find backports for all commits.'
87+
echo
88+
echo 'All commits in \`HEAD\` are required to have a corresponding upstream commit.'
89+
echo 'It looks like the following commits:'
90+
echo
91+
for commit in "${no_backports[@]}"; do
92+
echo " $commit"
93+
done
94+
echo
95+
echo "do not match any commits in \`$1\`. If this was intended, add the text"
96+
echo '\`backport-of: <SHA of a commit already in master>\`'
97+
echo 'somewhere in the message of each of these commits.'
98+
echo
99+
failure=1
100+
fi
101+
102+
if [ ${#bad_backports[@]} -ne 0 ]; then
103+
echo 'Error: Found incorrectly marked commits.'
104+
echo
105+
echo 'The following commits:'
106+
echo
107+
for commit in "${bad_backports[@]}"; do
108+
echo " $commit"
109+
done
110+
echo
111+
echo 'have commit messages marked \`backport-of: <SHA>\`, but the SHA is not in'
112+
echo '\`master\`.'
113+
echo
114+
failure=1
115+
fi
116+
117+
return $failure
118+
}
119+
120+
# Get the backport of a commit. It echoes one of:
121+
#
122+
# 1. A SHA of the backported commit
123+
# 2. The string "nothing"
124+
# 3. An empty string
125+
#
126+
# $1 = <sha>
127+
get_backport() {
128+
# This regex is:
129+
#
130+
# ^.* - throw away any extra starting characters
131+
# backport-of: - prefix
132+
# \s\? - optional space
133+
# \(\) - capture group
134+
# [a-f0-9]\+\|nothing - a SHA or the text 'nothing'
135+
# .* - throw away any extra ending characters
136+
# \1 - replace it with the first match
137+
# {s//\1/p;q} - print the first occurrence and quit
138+
#
139+
git show -s --format=%B "$1" \
140+
| sed -n '/^.*backport-of:\s\?\([a-f0-9]\+\|nothing\).*/{s//\1/p;q}'
141+
}
142+
143+
# Check if a commit is in master.
144+
#
145+
# $1 = <sha>
146+
is_in_master() {
147+
git merge-base --is-ancestor "$1" origin/master 2> /dev/null
148+
}
149+
150+
verify_backported_commits_main
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
#![allow(dead_code)]
5+
6+
// test that the type alias impl trait defining use is in a submodule
7+
8+
fn main() {}
9+
10+
type Foo = impl std::fmt::Display;
11+
type Bar = impl std::fmt::Display;
12+
13+
mod foo {
14+
pub fn foo() -> super::Foo {
15+
"foo"
16+
}
17+
18+
pub mod bar {
19+
pub fn bar() -> crate::Bar {
20+
1
21+
}
22+
}
23+
}

src/test/ui/type-alias-impl-trait/generic_underconstrained.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
fn main() {}
44

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

98
// no `Trait` bound
109
fn underconstrain<T>(_: T) -> Underconstrained<T> {
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
error: at least one trait must be specified
2-
--> $DIR/generic_underconstrained.rs:6:35
3-
|
4-
LL | type Underconstrained<T: Trait> = impl 'static;
5-
| ^^^^^^^^^^^^
6-
71
error[E0277]: the trait bound `T: Trait` is not satisfied
8-
--> $DIR/generic_underconstrained.rs:10:31
2+
--> $DIR/generic_underconstrained.rs:9:31
93
|
104
LL | fn underconstrain<T>(_: T) -> Underconstrained<T> {
115
| ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T`
126
|
137
note: required by a bound in `Underconstrained`
148
--> $DIR/generic_underconstrained.rs:6:26
159
|
16-
LL | type Underconstrained<T: Trait> = impl 'static;
10+
LL | type Underconstrained<T: Trait> = impl Send;
1711
| ^^^^^ required by this bound in `Underconstrained`
1812
help: consider restricting type parameter `T`
1913
|
2014
LL | fn underconstrain<T: Trait>(_: T) -> Underconstrained<T> {
2115
| +++++++
2216

23-
error: aborting due to 2 previous errors
17+
error: aborting due to previous error
2418

2519
For more information about this error, try `rustc --explain E0277`.

src/test/ui/type-alias-impl-trait/generic_underconstrained2.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
fn main() {}
44

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

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

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

1715
// not a defining use, because it doesn't define *all* possible generics
1816
fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,35 @@
1-
error: at least one trait must be specified
2-
--> $DIR/generic_underconstrained2.rs:5:45
3-
|
4-
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
5-
| ^^^^^^^^^^^^
6-
7-
error: at least one trait must be specified
8-
--> $DIR/generic_underconstrained2.rs:14:46
9-
|
10-
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
11-
| ^^^^^^^^^^^^
12-
131
error[E0277]: `U` doesn't implement `Debug`
14-
--> $DIR/generic_underconstrained2.rs:9:33
2+
--> $DIR/generic_underconstrained2.rs:8:33
153
|
164
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
175
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
186
|
197
note: required by a bound in `Underconstrained`
208
--> $DIR/generic_underconstrained2.rs:5:26
219
|
22-
LL | type Underconstrained<T: std::fmt::Debug> = impl 'static;
10+
LL | type Underconstrained<T: std::fmt::Debug> = impl Send;
2311
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained`
2412
help: consider restricting type parameter `U`
2513
|
2614
LL | fn underconstrained<U: std::fmt::Debug>(_: U) -> Underconstrained<U> {
2715
| +++++++++++++++++
2816

2917
error[E0277]: `V` doesn't implement `Debug`
30-
--> $DIR/generic_underconstrained2.rs:18:43
18+
--> $DIR/generic_underconstrained2.rs:16:43
3119
|
3220
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
3321
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
3422
|
3523
note: required by a bound in `Underconstrained2`
36-
--> $DIR/generic_underconstrained2.rs:14:27
24+
--> $DIR/generic_underconstrained2.rs:13:27
3725
|
38-
LL | type Underconstrained2<T: std::fmt::Debug> = impl 'static;
26+
LL | type Underconstrained2<T: std::fmt::Debug> = impl Send;
3927
| ^^^^^^^^^^^^^^^ required by this bound in `Underconstrained2`
4028
help: consider restricting type parameter `V`
4129
|
4230
LL | fn underconstrained2<U, V: std::fmt::Debug>(_: U, _: V) -> Underconstrained2<V> {
4331
| +++++++++++++++++
4432

45-
error: aborting due to 4 previous errors
33+
error: aborting due to 2 previous errors
4634

4735
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
type Foo = impl Sized;
4+
5+
fn bar() -> Foo {
6+
None
7+
//~^ ERROR: type annotations needed [E0282]
8+
}
9+
10+
fn baz() -> Foo {
11+
//~^ ERROR: concrete type differs from previous defining opaque type use
12+
Some(())
13+
}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)