mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Fix fallout after rebase
This commit is contained in:
parent
c28ce3e4ca
commit
70c8839f7c
@ -1207,7 +1207,7 @@ pub fn may_define_opaque_type(
|
||||
// Syntactically, we are allowed to define the concrete type if:
|
||||
let res = hir_id == scope;
|
||||
trace!(
|
||||
"may_define_existential_type(def={:?}, opaque_node={:?}) = {}",
|
||||
"may_define_opaque_type(def={:?}, opaque_node={:?}) = {}",
|
||||
tcx.hir().get(hir_id),
|
||||
tcx.hir().get(opaque_hir_id),
|
||||
res
|
||||
|
@ -221,7 +221,7 @@ impl AssocItem {
|
||||
tcx.fn_sig(self.def_id).skip_binder().to_string()
|
||||
}
|
||||
ty::AssocKind::Type => format!("type {};", self.ident),
|
||||
// FIXME(trait_alias_impl_trait): we should print bounds here too.
|
||||
// FIXME(type_alias_impl_trait): we should print bounds here too.
|
||||
ty::AssocKind::OpaqueTy => format!("type {};", self.ident),
|
||||
ty::AssocKind::Const => {
|
||||
format!("const {}: {:?};", self.ident, tcx.type_of(self.def_id))
|
||||
|
@ -1713,7 +1713,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> {
|
||||
// For example, this code:
|
||||
// ```
|
||||
// fn foo() {
|
||||
// existential type Blah: Debug;
|
||||
// type Blah = impl Debug;
|
||||
// let my_closure = || -> Blah { true };
|
||||
// }
|
||||
// ```
|
||||
|
@ -144,7 +144,7 @@ impl ItemType {
|
||||
ItemType::AssocConst => "associatedconstant",
|
||||
ItemType::ForeignType => "foreigntype",
|
||||
ItemType::Keyword => "keyword",
|
||||
ItemType::OpaqueTy => "opaque",
|
||||
ItemType::OpaqueTy => "opaque",
|
||||
ItemType::ProcAttribute => "attr",
|
||||
ItemType::ProcDerive => "derive",
|
||||
ItemType::TraitAlias => "traitalias",
|
||||
|
@ -1,230 +0,0 @@
|
||||
// run-pass
|
||||
|
||||
// edition:2018
|
||||
// aux-build:arc_wake.rs
|
||||
|
||||
#![feature(async_await, async_closure, await_macro)]
|
||||
|
||||
extern crate arc_wake;
|
||||
|
||||
use std::pin::Pin;
|
||||
use std::future::Future;
|
||||
use std::sync::{
|
||||
Arc,
|
||||
atomic::{self, AtomicUsize},
|
||||
};
|
||||
use std::task::{Context, Poll};
|
||||
use arc_wake::ArcWake;
|
||||
|
||||
struct Counter {
|
||||
wakes: AtomicUsize,
|
||||
}
|
||||
|
||||
impl ArcWake for Counter {
|
||||
fn wake(self: Arc<Self>) {
|
||||
Self::wake_by_ref(&self)
|
||||
}
|
||||
fn wake_by_ref(arc_self: &Arc<Self>) {
|
||||
arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
struct WakeOnceThenComplete(bool);
|
||||
|
||||
fn wake_and_yield_once() -> WakeOnceThenComplete { WakeOnceThenComplete(false) }
|
||||
|
||||
impl Future for WakeOnceThenComplete {
|
||||
type Output = ();
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
|
||||
if self.0 {
|
||||
Poll::Ready(())
|
||||
} else {
|
||||
cx.waker().wake_by_ref();
|
||||
self.0 = true;
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn async_block(x: u8) -> impl Future<Output = u8> {
|
||||
async move {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
}
|
||||
}
|
||||
|
||||
fn async_block_with_borrow_named_lifetime<'a>(x: &'a u8) -> impl Future<Output = u8> + 'a {
|
||||
async move {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
}
|
||||
|
||||
fn async_nonmove_block(x: u8) -> impl Future<Output = u8> {
|
||||
async move {
|
||||
let future = async {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
};
|
||||
await!(future)
|
||||
}
|
||||
}
|
||||
|
||||
fn async_closure(x: u8) -> impl Future<Output = u8> {
|
||||
(async move |x: u8| -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
})(x)
|
||||
}
|
||||
|
||||
fn async_closure_in_unsafe_block(x: u8) -> impl Future<Output = u8> {
|
||||
(unsafe {
|
||||
async move |x: u8| unsafe_fn(await!(unsafe_async_fn(x)))
|
||||
})(x)
|
||||
}
|
||||
|
||||
async fn async_fn(x: u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
}
|
||||
|
||||
async fn generic_async_fn<T>(x: T) -> T {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
}
|
||||
|
||||
async fn async_fn_with_borrow(x: &u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
|
||||
async fn async_fn_with_borrow_named_lifetime<'a>(x: &'a u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
|
||||
fn async_fn_with_impl_future_named_lifetime<'a>(x: &'a u8) -> impl Future<Output = u8> + 'a {
|
||||
async move {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME(cramertj) support when `type T<'a, 'b> = impl;` works
|
||||
async fn async_fn_multiple_args(x: &u8, _y: &u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
*/
|
||||
|
||||
async fn async_fn_multiple_args_named_lifetime<'a>(x: &'a u8, _y: &'a u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
*x
|
||||
}
|
||||
|
||||
fn async_fn_with_internal_borrow(y: u8) -> impl Future<Output = u8> {
|
||||
async move {
|
||||
await!(async_fn_with_borrow_named_lifetime(&y))
|
||||
}
|
||||
}
|
||||
|
||||
async unsafe fn unsafe_async_fn(x: u8) -> u8 {
|
||||
await!(wake_and_yield_once());
|
||||
x
|
||||
}
|
||||
|
||||
unsafe fn unsafe_fn(x: u8) -> u8 {
|
||||
x
|
||||
}
|
||||
|
||||
fn async_block_in_unsafe_block(x: u8) -> impl Future<Output = u8> {
|
||||
unsafe {
|
||||
async move {
|
||||
unsafe_fn(await!(unsafe_async_fn(x)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Foo;
|
||||
|
||||
trait Bar {
|
||||
fn foo() {}
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
async fn async_assoc_item(x: u8) -> u8 {
|
||||
unsafe {
|
||||
await!(unsafe_async_fn(x))
|
||||
}
|
||||
}
|
||||
|
||||
async unsafe fn async_unsafe_assoc_item(x: u8) -> u8 {
|
||||
await!(unsafe_async_fn(x))
|
||||
}
|
||||
}
|
||||
|
||||
fn test_future_yields_once_then_returns<F, Fut>(f: F)
|
||||
where
|
||||
F: FnOnce(u8) -> Fut,
|
||||
Fut: Future<Output = u8>,
|
||||
{
|
||||
let mut fut = Box::pin(f(9));
|
||||
let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) });
|
||||
let waker = ArcWake::into_waker(counter.clone());
|
||||
let mut cx = Context::from_waker(&waker);
|
||||
assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst));
|
||||
assert_eq!(Poll::Pending, fut.as_mut().poll(&mut cx));
|
||||
assert_eq!(1, counter.wakes.load(atomic::Ordering::SeqCst));
|
||||
assert_eq!(Poll::Ready(9), fut.as_mut().poll(&mut cx));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
macro_rules! test {
|
||||
($($fn_name:expr,)*) => { $(
|
||||
test_future_yields_once_then_returns($fn_name);
|
||||
)* }
|
||||
}
|
||||
|
||||
macro_rules! test_with_borrow {
|
||||
($($fn_name:expr,)*) => { $(
|
||||
test_future_yields_once_then_returns(|x| {
|
||||
async move {
|
||||
await!($fn_name(&x))
|
||||
}
|
||||
});
|
||||
)* }
|
||||
}
|
||||
|
||||
test! {
|
||||
async_block,
|
||||
async_nonmove_block,
|
||||
async_closure,
|
||||
async_closure_in_unsafe_block,
|
||||
async_fn,
|
||||
generic_async_fn,
|
||||
async_fn_with_internal_borrow,
|
||||
async_block_in_unsafe_block,
|
||||
Foo::async_assoc_item,
|
||||
|x| {
|
||||
async move {
|
||||
unsafe { await!(unsafe_async_fn(x)) }
|
||||
}
|
||||
},
|
||||
|x| {
|
||||
async move {
|
||||
unsafe { await!(Foo::async_unsafe_assoc_item(x)) }
|
||||
}
|
||||
},
|
||||
}
|
||||
test_with_borrow! {
|
||||
async_block_with_borrow_named_lifetime,
|
||||
async_fn_with_borrow,
|
||||
async_fn_with_borrow_named_lifetime,
|
||||
async_fn_with_impl_future_named_lifetime,
|
||||
|x| {
|
||||
async move {
|
||||
await!(async_fn_multiple_args_named_lifetime(x, x))
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
// Checks to ensure that we properly detect when a closure constrains an existential type
|
||||
#![feature(existential_type)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {
|
||||
existential type Existential: Debug;
|
||||
fn _unused() -> Existential { String::new() }
|
||||
//~^ ERROR: concrete type differs from previous defining existential type use
|
||||
let null = || -> Existential { 0 };
|
||||
println!("{:?}", null());
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
error: concrete type differs from previous defining existential type use
|
||||
--> $DIR/issue-52843-closure-constrain.rs:8:5
|
||||
|
|
||||
LL | fn _unused() -> Existential { String::new() }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, got `std::string::String`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/issue-52843-closure-constrain.rs:6:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | existential type Existential: Debug;
|
||||
LL | | fn _unused() -> Existential { String::new() }
|
||||
LL | |
|
||||
LL | | let null = || -> Existential { 0 };
|
||||
LL | | println!("{:?}", null());
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,14 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// test that unused generic parameters are ok
|
||||
type Two<T, U> = impl Debug;
|
||||
//~^ could not find defining uses
|
||||
|
||||
fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
//~^ ERROR defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
error: defining opaque type use restricts opaque type by using the generic parameter `T` twice
|
||||
--> $DIR/generic_duplicate_param_use.rs:11:1
|
||||
|
|
||||
LL | / fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
LL | |
|
||||
LL | | t
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: could not find defining uses
|
||||
--> $DIR/generic_duplicate_param_use.rs:8:1
|
||||
|
|
||||
LL | type Two<T, U> = impl Debug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -1,17 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// test that unused generic parameters are ok
|
||||
type Two<T, U> = impl Debug;
|
||||
|
||||
fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
//~^ defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
|
||||
t
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// test that unused generic parameters are ok
|
||||
type Two<T, U> = impl Debug;
|
||||
|
||||
fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
//~^ defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
|
||||
t
|
||||
}
|
||||
|
||||
fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
|
||||
//~^ concrete type's generic parameters differ from previous defining use
|
||||
u
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {}
|
||||
|
||||
// test that unused generic parameters are ok
|
||||
type Two<T, U> = impl Debug;
|
||||
|
||||
fn one<T: Debug>(t: T) -> Two<T, T> {
|
||||
//~^ ERROR defining opaque type use restricts opaque type
|
||||
t
|
||||
}
|
||||
|
||||
fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
|
||||
u
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait UnwrapItemsExt {
|
||||
type Iter;
|
||||
fn unwrap_items(self) -> Self::Iter;
|
||||
}
|
||||
|
||||
impl<I, T, E> UnwrapItemsExt for I
|
||||
where
|
||||
I: Iterator<Item = Result<T, E>>,
|
||||
E: std::fmt::Debug,
|
||||
{
|
||||
type Iter = impl Iterator<Item = T>;
|
||||
//~^ ERROR: could not find defining uses
|
||||
|
||||
fn unwrap_items(self) -> Self::Iter {
|
||||
//~^ ERROR: type parameter `T` is part of concrete type
|
||||
//~| ERROR: type parameter `E` is part of concrete type
|
||||
self.map(|x| x.unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,30 +0,0 @@
|
||||
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-58887.rs:16:41
|
||||
|
|
||||
LL | fn unwrap_items(self) -> Self::Iter {
|
||||
| _________________________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | self.map(|x| x.unwrap())
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: type parameter `E` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-58887.rs:16:41
|
||||
|
|
||||
LL | fn unwrap_items(self) -> Self::Iter {
|
||||
| _________________________________________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | self.map(|x| x.unwrap())
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
error: could not find defining uses
|
||||
--> $DIR/issue-58887.rs:13:5
|
||||
|
|
||||
LL | type Iter = impl Iterator<Item = T>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -1,15 +0,0 @@
|
||||
trait Bug {
|
||||
type Item: Bug;
|
||||
|
||||
const FUN: fn() -> Self::Item;
|
||||
}
|
||||
|
||||
impl Bug for &() {
|
||||
type Item = impl Bug; //~ ERROR `impl Trait` in type aliases is unstable
|
||||
//~^ ERROR the trait bound `(): Bug` is not satisfied
|
||||
//~^^ ERROR could not find defining uses
|
||||
|
||||
const FUN: fn() -> Self::Item = || ();
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,29 +0,0 @@
|
||||
error[E0658]: `impl Trait` in type aliases is unstable
|
||||
--> $DIR/issue-60371.rs:8:5
|
||||
|
|
||||
LL | type Item = impl Bug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: for more information, see https://github.com/rust-lang/rust/issues/63063
|
||||
= help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
|
||||
|
||||
error[E0277]: the trait bound `(): Bug` is not satisfied
|
||||
--> $DIR/issue-60371.rs:8:5
|
||||
|
|
||||
LL | type Item = impl Bug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Bug` is not implemented for `()`
|
||||
|
|
||||
= help: the following implementations were found:
|
||||
<&() as Bug>
|
||||
= note: the return type of a function must have a statically known size
|
||||
|
||||
error: could not find defining uses
|
||||
--> $DIR/issue-60371.rs:8:5
|
||||
|
|
||||
LL | type Item = impl Bug;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0658.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
@ -1,13 +0,0 @@
|
||||
// Issue 52985: user code provides no use case that allows a type alias `impl Trait`
|
||||
// We now emit a 'could not find defining uses' error
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = impl Copy; //~ could not find defining uses
|
||||
|
||||
// make compiler happy about using 'Foo'
|
||||
fn bar(x: Foo) -> Foo { x }
|
||||
|
||||
fn main() {
|
||||
let _: Foo = std::mem::transmute(0u8);
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
error: could not find defining uses
|
||||
--> $DIR/no_inferrable_concrete_type.rs:6:1
|
||||
|
|
||||
LL | type Foo = impl Copy;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,40 +0,0 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {}
|
||||
|
||||
type Two<T, U> = impl Debug;
|
||||
|
||||
fn two<T: Debug>(t: T) -> Two<T, u32> {
|
||||
//~^ ERROR defining opaque type use does not fully define opaque type
|
||||
(t, 4i8)
|
||||
}
|
||||
|
||||
fn three<T: Debug, U>(t: T) -> Two<T, U> {
|
||||
(t, 5i8)
|
||||
}
|
||||
|
||||
trait Bar {
|
||||
type Blub: Debug;
|
||||
const FOO: Self::Blub;
|
||||
}
|
||||
|
||||
impl Bar for u32 {
|
||||
type Blub = i32;
|
||||
const FOO: i32 = 42;
|
||||
}
|
||||
|
||||
// this should work! But it requires `two` and `three` not to be defining uses,
|
||||
// just restricting uses
|
||||
fn four<T: Debug, U: Bar>(t: T) -> Two<T, U> { //~ concrete type differs from previous
|
||||
(t, <U as Bar>::FOO)
|
||||
}
|
||||
|
||||
fn is_sync<T: Sync>() {}
|
||||
|
||||
fn asdfl() {
|
||||
//FIXME(oli-obk): these currently cause cycle errors
|
||||
//is_sync::<Two<i32, u32>>();
|
||||
//is_sync::<Two<i32, *const i32>>();
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
error: defining opaque type use does not fully define opaque type
|
||||
--> $DIR/not_a_defining_use.rs:9:1
|
||||
|
|
||||
LL | / fn two<T: Debug>(t: T) -> Two<T, u32> {
|
||||
LL | |
|
||||
LL | | (t, 4i8)
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/not_a_defining_use.rs:30:1
|
||||
|
|
||||
LL | / fn four<T: Debug, U: Bar>(t: T) -> Two<T, U> {
|
||||
LL | | (t, <U as Bar>::FOO)
|
||||
LL | | }
|
||||
| |_^ expected `(T, i8)`, got `(T, <U as Bar>::Blub)`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/not_a_defining_use.rs:14:1
|
||||
|
|
||||
LL | / fn three<T: Debug, U>(t: T) -> Two<T, U> {
|
||||
LL | | (t, 5i8)
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
@ -81,9 +81,9 @@ mod impl_trait_in_bindings {
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// The same applied to `existential type`s
|
||||
// The same applied to `type Foo = impl Bar`s
|
||||
|
||||
mod existential_types {
|
||||
mod opaque_types {
|
||||
trait Implemented {
|
||||
type Assoc;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// run-pass
|
||||
#![allow(unused_must_use)]
|
||||
// Tests that a heterogeneous list of existential types can be put inside an Arc
|
||||
// Tests that a heterogeneous list of opaque types can be put inside an Arc
|
||||
// and shared between threads as long as all types fulfill Send.
|
||||
|
||||
// ignore-emscripten no threads support
|
||||
|
@ -0,0 +1,13 @@
|
||||
// Checks to ensure that we properly detect when a closure constrains an opaque type
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
fn main() {
|
||||
type Opaque = impl Debug;
|
||||
fn _unused() -> Opaque { String::new() }
|
||||
//~^ ERROR: concrete type differs from previous defining opaque type use
|
||||
let null = || -> Opaque { 0 };
|
||||
println!("{:?}", null());
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/issue-52843-closure-constrain.rs:9:5
|
||||
|
|
||||
LL | fn _unused() -> Opaque { String::new() }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, got `std::string::String`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/issue-52843-closure-constrain.rs:7:1
|
||||
|
|
||||
LL | / fn main() {
|
||||
LL | | type Opaque = impl Debug;
|
||||
LL | | fn _unused() -> Opaque { String::new() }
|
||||
LL | |
|
||||
LL | | let null = || -> Opaque { 0 };
|
||||
LL | | println!("{:?}", null());
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,10 +1,10 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(const_fn, generators, generator_trait, existential_type)]
|
||||
#![feature(const_fn, generators, generator_trait, type_alias_impl_trait)]
|
||||
|
||||
use std::ops::Generator;
|
||||
|
||||
existential type GenOnce<Y, R>: Generator<Yield = Y, Return = R>;
|
||||
type GenOnce<Y, R> = impl Generator<Yield = Y, Return = R>;
|
||||
|
||||
const fn const_generator<Y, R>(yielding: Y, returning: R) -> GenOnce<Y, R> {
|
||||
move || {
|
@ -1,8 +1,8 @@
|
||||
// check-pass
|
||||
|
||||
#![feature(existential_type)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
existential type Debuggable: core::fmt::Debug;
|
||||
type Debuggable = impl core::fmt::Debug;
|
||||
|
||||
static mut TEST: Option<Debuggable> = None;
|
||||
|
@ -1,11 +1,11 @@
|
||||
#![feature(existential_type)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait IterBits {
|
||||
type BitsIter: Iterator<Item = u8>;
|
||||
fn iter_bits(self, n: u8) -> Self::BitsIter;
|
||||
}
|
||||
|
||||
existential type IterBitsIter<T, E, I>: std::iter::Iterator<Item = I>;
|
||||
type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
|
||||
//~^ ERROR could not find defining uses
|
||||
|
||||
impl<T, E> IterBits for T
|
@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `issue_60564`
|
||||
|
|
||||
= note: consider adding a `main` function to `$DIR/issue-60564.rs`
|
||||
|
||||
error: type parameter `E` is part of concrete type but not used in parameter list for existential type
|
||||
error: type parameter `E` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||
--> $DIR/issue-60564.rs:20:49
|
||||
|
|
||||
LL | fn iter_bits(self, n: u8) -> Self::BitsIter {
|
||||
@ -17,8 +17,8 @@ LL | | }
|
||||
error: could not find defining uses
|
||||
--> $DIR/issue-60564.rs:8:1
|
||||
|
|
||||
LL | existential type IterBitsIter<T, E, I>: std::iter::Iterator<Item = I>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | type IterBitsIter<T, E, I> = impl std::iter::Iterator<Item = I>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Issue 52985: user code provides no use case that allows an existential type
|
||||
// Issue 52985: user code provides no use case that allows a type alias `impl Trait`
|
||||
// We now emit a 'could not find defining uses' error
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
Loading…
Reference in New Issue
Block a user