Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that type alias impl trait happens in a submodule #88172

Merged
merged 1 commit into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/test/ui/type-alias-impl-trait/defining-use-submodule.rs
Original file line number Diff line number Diff line change
@@ -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
}
}
}
10 changes: 0 additions & 10 deletions src/test/ui/type-alias-impl-trait/type-alias-impl-trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand All @@ -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> {
Expand Down