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#93933 - matthiaskrgr:rollup-1hjae6g, r=matthi…
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91908 (Add 2 tests) - rust-lang#93595 (fix ICE when parsing lifetime as function argument) - rust-lang#93757 (Add some known GAT bugs as tests) - rust-lang#93759 (Pretty print ItemKind::Use in rustfmt style) - rust-lang#93897 (linkchecker: fix panic on directory symlinks) - rust-lang#93898 (tidy: Extend error code check) - rust-lang#93928 (Add missing release notes for rust-lang#85200) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
36 changed files
with
644 additions
and
31 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
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,23 @@ | ||
// pp-exact | ||
// edition:2021 | ||
|
||
#![allow(unused_imports)] | ||
|
||
use ::std::fmt::{self, Debug, Display, Write as _}; | ||
|
||
use core::option::Option::*; | ||
|
||
use core::{ | ||
cmp::{Eq, Ord, PartialEq, PartialOrd}, | ||
convert::{AsMut, AsRef, From, Into}, | ||
iter::{ | ||
DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator, | ||
IntoIterator, Iterator, | ||
}, | ||
marker::{ | ||
Copy as Copy, Send as Send, Sized as Sized, Sync as Sync, Unpin as U, | ||
}, | ||
ops::{*, Drop, Fn, FnMut, FnOnce}, | ||
}; | ||
|
||
fn main() {} |
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,24 @@ | ||
// check-pass | ||
|
||
pub trait Associate { | ||
type Associated; | ||
} | ||
|
||
pub struct Wrap<'a> { | ||
pub field: &'a i32, | ||
} | ||
|
||
pub trait Create<T> { | ||
fn create() -> Self; | ||
} | ||
|
||
pub fn oh_no<'a, T>() | ||
where | ||
Wrap<'a>: Associate, | ||
<Wrap<'a> as Associate>::Associated: Create<T>, | ||
{ | ||
<Wrap<'a> as Associate>::Associated::create(); | ||
} | ||
|
||
|
||
pub fn main() {} |
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,17 @@ | ||
// check-fail | ||
|
||
// This should pass, but it requires `Sized` to be coinductive. | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
trait Allocator { | ||
type Allocated<T>; | ||
} | ||
|
||
enum LinkedList<A: Allocator> { | ||
Head, | ||
Next(A::Allocated<Self>) | ||
//~^ overflow | ||
} | ||
|
||
fn main() {} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/generic-associated-types/bugs/issue-80626.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error[E0275]: overflow evaluating the requirement `LinkedList<A>: Sized` | ||
--> $DIR/issue-80626.rs:13:10 | ||
| | ||
LL | Next(A::Allocated<Self>) | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: no field of an enum variant may have a dynamically sized type | ||
= help: change the field's type to have a statically known size | ||
help: borrowed types always have a statically known size | ||
| | ||
LL | Next(&A::Allocated<Self>) | ||
| + | ||
help: the `Box` type always has a statically known size and allocates its contents in the heap | ||
| | ||
LL | Next(Box<A::Allocated<Self>>) | ||
| ++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
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,27 @@ | ||
// check-fail | ||
|
||
// This should pass, but seems to run into a TAIT issue. | ||
|
||
#![feature(generic_associated_types)] | ||
#![feature(type_alias_impl_trait)] | ||
|
||
pub trait Stream { | ||
type Item; | ||
} | ||
|
||
impl Stream for () { | ||
type Item = i32; | ||
} | ||
|
||
trait Yay<AdditionalValue> { | ||
type InnerStream<'s>: Stream<Item = i32> + 's; | ||
fn foo<'s>() -> Self::InnerStream<'s>; | ||
} | ||
|
||
impl<'a> Yay<&'a ()> for () { | ||
type InnerStream<'s> = impl Stream<Item = i32> + 's; | ||
//~^ the type | ||
fn foo<'s>() -> Self::InnerStream<'s> { todo!() } | ||
} | ||
|
||
fn main() {} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/generic-associated-types/bugs/issue-86218.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0477]: the type `impl Stream<Item = i32>` does not fulfill the required lifetime | ||
--> $DIR/issue-86218.rs:22:28 | ||
| | ||
LL | type InnerStream<'s> = impl Stream<Item = i32> + 's; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: type must outlive the lifetime `'s` as defined here as required by this binding | ||
--> $DIR/issue-86218.rs:22:22 | ||
| | ||
LL | type InnerStream<'s> = impl Stream<Item = i32> + 's; | ||
| ^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0477`. |
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,45 @@ | ||
// check-fail | ||
|
||
// This should pass, but we need an extension of implied bounds (probably). | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
pub trait AsRef2 { | ||
type Output<'a> where Self: 'a; | ||
|
||
fn as_ref2<'a>(&'a self) -> Self::Output<'a>; | ||
} | ||
|
||
impl<T> AsRef2 for Vec<T> { | ||
type Output<'a> where Self: 'a = &'a [T]; | ||
|
||
fn as_ref2<'a>(&'a self) -> Self::Output<'a> { | ||
&self[..] | ||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
struct Foo<T>(T); | ||
#[derive(Debug)] | ||
struct FooRef<'a, U>(&'a [U]); | ||
|
||
impl<'b, T, U> AsRef2 for Foo<T> //~ the type parameter | ||
where | ||
// * `for<'b, 'c> T: AsRef2<Output<'b> = &'c [U]>>` does not work | ||
// | ||
// * `U` is unconstrained but should be allowed in this context because `Output` is | ||
// an associated type | ||
T: AsRef2<Output<'b> = &'b [U]>, | ||
U: 'b | ||
{ | ||
type Output<'a> where Self: 'a = FooRef<'a, U>; | ||
|
||
fn as_ref2<'a>(&'a self) -> Self::Output<'a> { | ||
FooRef(self.0.as_ref2()) | ||
} | ||
} | ||
|
||
fn main() { | ||
let foo = Foo(vec![1, 2, 3]); | ||
dbg!(foo.as_ref2()); | ||
} |
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,9 @@ | ||
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates | ||
--> $DIR/issue-87735.rs:26:13 | ||
| | ||
LL | impl<'b, T, U> AsRef2 for Foo<T> | ||
| ^ unconstrained type parameter | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0207`. |
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,22 @@ | ||
// check-fail | ||
|
||
// This should pass, but unnormalized input args aren't treated as implied. | ||
|
||
#![feature(generic_associated_types)] | ||
|
||
trait MyTrait { | ||
type Assoc<'a, 'b> where 'b: 'a; | ||
fn do_sth(arg: Self::Assoc<'_, '_>); | ||
} | ||
|
||
struct Foo; | ||
|
||
impl MyTrait for Foo { | ||
type Assoc<'a, 'b> where 'b: 'a = u32; | ||
|
||
fn do_sth(_: u32) {} //~ lifetime bound | ||
// fn do_sth(_: Self::Assoc<'static, 'static>) {} | ||
// fn do_sth(_: Self::Assoc<'_, '_>) {} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.