Skip to content

Commit 0689152

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#86727
2 parents 908b2ea + 2644a15 commit 0689152

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
3+
#![feature(type_alias_impl_trait)]
4+
#![allow(dead_code)]
5+
6+
// test that the type alias impl trait defining use is in a submodule
7+
8+
fn main() {}
9+
10+
type Foo = impl std::fmt::Display;
11+
type Bar = impl std::fmt::Display;
12+
13+
mod foo {
14+
pub fn foo() -> super::Foo {
15+
"foo"
16+
}
17+
18+
pub mod bar {
19+
pub fn bar() -> crate::Bar {
20+
1
21+
}
22+
}
23+
}

src/test/ui/type-alias-impl-trait/type-alias-impl-trait.rs

-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ fn main() {
1111
assert_eq!(bar2().to_string(), "bar2");
1212
let mut x = bar1();
1313
x = bar2();
14-
assert_eq!(boo::boo().to_string(), "boo");
1514
assert_eq!(my_iter(42u8).collect::<Vec<u8>>(), vec![42u8]);
1615
}
1716

@@ -33,15 +32,6 @@ fn bar2() -> Bar {
3332
"bar2"
3433
}
3534

36-
// definition in submodule
37-
type Boo = impl std::fmt::Display;
38-
39-
mod boo {
40-
pub fn boo() -> super::Boo {
41-
"boo"
42-
}
43-
}
44-
4535
type MyIter<T> = impl Iterator<Item = T>;
4636

4737
fn my_iter<T>(t: T) -> MyIter<T> {

0 commit comments

Comments
 (0)