Rollup merge of #88172 - spastorino:tait-defining-use-submodule-test, r=oli-obk

Test that type alias impl trait happens in a submodule

r? `@oli-obk`

Related to #86727
This commit is contained in:
Jack Huey 2021-08-21 20:56:31 -04:00 committed by GitHub
commit 0689152b1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 10 deletions

View File

@ -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
}
}
}

View File

@ -11,7 +11,6 @@ fn main() {
assert_eq!(bar2().to_string(), "bar2");
let mut x = bar1();
x = bar2();
assert_eq!(boo::boo().to_string(), "boo");
assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
}
@ -33,15 +32,6 @@ fn bar2() -> Bar {
"bar2"
}
// definition in submodule
type Boo = impl std::fmt::Display;
mod boo {
pub fn boo() -> super::Boo {
"boo"
}
}
type MyIter<T> = impl Iterator<Item = T>;
fn my_iter<T>(t: T) -> MyIter<T> {