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#96695 - JohnTitor:rollup-oo4fc1h, r=JohnTitor
Rollup of 6 pull requests Successful merges: - rust-lang#96597 (openbsd: unbreak build on native platform) - rust-lang#96662 (Fix typo in lint levels doc) - rust-lang#96668 (Fix flaky rustdoc-ui test because it did not replace time result) - rust-lang#96679 (Quick fix for rust-lang#96223.) - rust-lang#96684 (Update `ProjectionElem::Downcast` documentation) - rust-lang#96686 (Add some TAIT-related tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
15 changed files
with
218 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
running 0 tests | ||
|
||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s | ||
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME | ||
|
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,52 @@ | ||
// Previously ICEd because we didn't properly track binders in suggestions | ||
// check-fail | ||
|
||
pub trait Foo<'de>: Sized {} | ||
|
||
pub trait Bar<'a>: 'static { | ||
type Inner: 'a; | ||
} | ||
|
||
pub trait Fubar { | ||
type Bar: for<'a> Bar<'a>; | ||
} | ||
|
||
pub struct Baz<T>(pub T); | ||
|
||
impl<'de, T> Foo<'de> for Baz<T> where T: Foo<'de> {} | ||
|
||
struct Empty; | ||
|
||
impl<M> Dummy<M> for Empty | ||
where | ||
M: Fubar, | ||
for<'de> Baz<<M::Bar as Bar<'de>>::Inner>: Foo<'de>, | ||
{ | ||
} | ||
|
||
pub trait Dummy<M> | ||
where | ||
M: Fubar, | ||
{ | ||
} | ||
|
||
pub struct EmptyBis<'a>(&'a [u8]); | ||
|
||
impl<'a> Bar<'a> for EmptyBis<'static> { | ||
type Inner = EmptyBis<'a>; | ||
} | ||
|
||
pub struct EmptyMarker; | ||
|
||
impl Fubar for EmptyMarker { | ||
type Bar = EmptyBis<'static>; | ||
} | ||
|
||
fn icey_bounds<D: Dummy<EmptyMarker>>(p: &D) {} | ||
|
||
fn trigger_ice() { | ||
let p = Empty; | ||
icey_bounds(&p); //~ERROR the trait bound | ||
} | ||
|
||
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,28 @@ | ||
error[E0277]: the trait bound `for<'de> EmptyBis<'de>: Foo<'_>` is not satisfied | ||
--> $DIR/issue-96223.rs:49:17 | ||
| | ||
LL | icey_bounds(&p); | ||
| ----------- ^^ the trait `for<'de> Foo<'_>` is not implemented for `EmptyBis<'de>` | ||
| | | ||
| required by a bound introduced by this call | ||
| | ||
= help: the trait `Foo<'de>` is implemented for `Baz<T>` | ||
note: required because of the requirements on the impl of `for<'de> Foo<'de>` for `Baz<EmptyBis<'de>>` | ||
--> $DIR/issue-96223.rs:16:14 | ||
| | ||
LL | impl<'de, T> Foo<'de> for Baz<T> where T: Foo<'de> {} | ||
| ^^^^^^^^ ^^^^^^ | ||
note: required because of the requirements on the impl of `Dummy<EmptyMarker>` for `Empty` | ||
--> $DIR/issue-96223.rs:20:9 | ||
| | ||
LL | impl<M> Dummy<M> for Empty | ||
| ^^^^^^^^ ^^^^^ | ||
note: required by a bound in `icey_bounds` | ||
--> $DIR/issue-96223.rs:45:19 | ||
| | ||
LL | fn icey_bounds<D: Dummy<EmptyMarker>>(p: &D) {} | ||
| ^^^^^^^^^^^^^^^^^^ required by this bound in `icey_bounds` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
9 changes: 9 additions & 0 deletions
9
src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.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,9 @@ | ||
#![feature(type_alias_impl_trait)] | ||
|
||
type Foo = impl Fn() -> Foo; | ||
|
||
fn foo() -> Foo { | ||
foo //~ ERROR: overflow evaluating the requirement `fn() -> Foo {foo}: Sized` | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/type-alias-impl-trait/issue-53398-cyclic-types.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,11 @@ | ||
error[E0275]: overflow evaluating the requirement `fn() -> Foo {foo}: Sized` | ||
--> $DIR/issue-53398-cyclic-types.rs:6:5 | ||
| | ||
LL | foo | ||
| ^^^ | ||
| | ||
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_53398_cyclic_types`) | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0275`. |
39 changes: 39 additions & 0 deletions
39
src/test/ui/type-alias-impl-trait/issue-58662-generator-with-lifetime.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,39 @@ | ||
// check-pass | ||
|
||
#![feature(generators, generator_trait)] | ||
#![feature(type_alias_impl_trait)] | ||
|
||
use std::ops::{Generator, GeneratorState}; | ||
use std::pin::Pin; | ||
|
||
type RandGenerator<'a> = impl Generator<Return = (), Yield = u64> + 'a; | ||
fn rand_generator<'a>(rng: &'a ()) -> RandGenerator<'a> { | ||
move || { | ||
let _rng = rng; | ||
loop { | ||
yield 0; | ||
} | ||
} | ||
} | ||
|
||
pub type RandGeneratorWithIndirection<'a> = impl Generator<Return = (), Yield = u64> + 'a; | ||
pub fn rand_generator_with_indirection<'a>(rng: &'a ()) -> RandGeneratorWithIndirection<'a> { | ||
fn helper<'b>(rng: &'b ()) -> impl 'b + Generator<Return = (), Yield = u64> { | ||
move || { | ||
let _rng = rng; | ||
loop { | ||
yield 0; | ||
} | ||
} | ||
} | ||
|
||
helper(rng) | ||
} | ||
|
||
fn main() { | ||
let mut gen = rand_generator(&()); | ||
match unsafe { Pin::new_unchecked(&mut gen) }.resume(()) { | ||
GeneratorState::Yielded(_) => {} | ||
GeneratorState::Complete(_) => {} | ||
}; | ||
} |
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,31 @@ | ||
// check-pass | ||
|
||
#![feature(type_alias_impl_trait)] | ||
|
||
trait SomeTrait {} | ||
impl SomeTrait for () {} | ||
|
||
trait MyFuture { | ||
type Output; | ||
} | ||
impl<T> MyFuture for T { | ||
type Output = T; | ||
} | ||
|
||
trait ReturnsFuture { | ||
type Output: SomeTrait; | ||
type Future: MyFuture<Output = Result<Self::Output, ()>>; | ||
fn func() -> Self::Future; | ||
} | ||
|
||
struct Foo; | ||
|
||
impl ReturnsFuture for Foo { | ||
type Output = impl SomeTrait; | ||
type Future = impl MyFuture<Output = Result<Self::Output, ()>>; | ||
fn func() -> Self::Future { | ||
Result::<(), ()>::Err(()) | ||
} | ||
} | ||
|
||
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,22 @@ | ||
#![feature(type_alias_impl_trait, generator_trait, generators)] | ||
use std::ops::Generator; | ||
|
||
trait Runnable { | ||
type Gen: Generator<Yield = (), Return = ()>; | ||
|
||
fn run(&mut self) -> Self::Gen; | ||
} | ||
|
||
struct Implementor {} | ||
|
||
impl Runnable for Implementor { | ||
type Gen = impl Generator<Yield = (), Return = ()>; | ||
|
||
fn run(&mut self) -> Self::Gen { | ||
move || { //~ ERROR: type mismatch resolving | ||
yield 1; | ||
} | ||
} | ||
} | ||
|
||
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,11 @@ | ||
error[E0271]: type mismatch resolving `<[generator@$DIR/issue-94429.rs:16:9: 18:10] as Generator>::Yield == ()` | ||
--> $DIR/issue-94429.rs:16:9 | ||
| | ||
LL | / move || { | ||
LL | | yield 1; | ||
LL | | } | ||
| |_________^ expected integer, found `()` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0271`. |