forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
21 changed files
with
345 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
23
src/test/ui/type-alias-impl-trait/defining-use-submodule.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
src/test/ui/type-alias-impl-trait/generic_underconstrained.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 6 additions & 18 deletions
24
src/test/ui/type-alias-impl-trait/generic_underconstrained2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |
Oops, something went wrong.