diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-01-15 08:34:20 +0900 |
|---|---|---|
| committer | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-01-15 23:41:37 +0900 |
| commit | 406049df4948a2c93d50f2c72cfa0e2811695ef5 (patch) | |
| tree | 40e2103558d908de546abf6ac01931944894bbc0 | |
| parent | 8a87b945b27b5670ac5ed665bbb0fccc1b88a0a0 (diff) | |
| download | rust-406049df4948a2c93d50f2c72cfa0e2811695ef5.tar.gz rust-406049df4948a2c93d50f2c72cfa0e2811695ef5.zip | |
Add test for issue-64848
| -rw-r--r-- | src/test/ui/associated-types/issue-64848.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/associated-types/issue-64848.rs b/src/test/ui/associated-types/issue-64848.rs new file mode 100644 index 00000000000..77712168a0f --- /dev/null +++ b/src/test/ui/associated-types/issue-64848.rs @@ -0,0 +1,29 @@ +// build-pass + +trait AssociatedConstant { + const DATA: (); +} + +impl<F, T> AssociatedConstant for F +where + F: FnOnce() -> T, + T: AssociatedConstant, +{ + const DATA: () = T::DATA; +} + +impl AssociatedConstant for () { + const DATA: () = (); +} + +fn foo() -> impl AssociatedConstant { + () +} + +fn get_data<T: AssociatedConstant>(_: T) -> &'static () { + &T::DATA +} + +fn main() { + get_data(foo); +} |
