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:
commit
0689152b1e
2 changed files with 23 additions and 10 deletions
23
src/test/ui/type-alias-impl-trait/defining-use-submodule.rs
Normal file
23
src/test/ui/type-alias-impl-trait/defining-use-submodule.rs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ fn main() {
|
||||||
assert_eq!(bar2().to_string(), "bar2");
|
assert_eq!(bar2().to_string(), "bar2");
|
||||||
let mut x = bar1();
|
let mut x = bar1();
|
||||||
x = bar2();
|
x = bar2();
|
||||||
assert_eq!(boo::boo().to_string(), "boo");
|
|
||||||
assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
|
assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,15 +32,6 @@ fn bar2() -> Bar {
|
||||||
"bar2"
|
"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>;
|
type MyIter<T> = impl Iterator<Item = T>;
|
||||||
|
|
||||||
fn my_iter<T>(t: T) -> MyIter<T> {
|
fn my_iter<T>(t: T) -> MyIter<T> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue