]> git.proxmox.com Git - rustc.git/blame - src/test/ui/feature-gates/feature-gate-type_alias_impl_trait.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / feature-gates / feature-gate-type_alias_impl_trait.rs
CommitLineData
29967ef6 1// ignore-compare-mode-chalk
60c5eb7d
XL
2use std::fmt::Debug;
3
4type Foo = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
416331ca
XL
5
6trait Bar {
60c5eb7d 7 type Baa: Debug;
416331ca
XL
8 fn define() -> Self::Baa;
9}
10
11impl Bar for () {
60c5eb7d 12 type Baa = impl Debug; //~ ERROR `impl Trait` in type aliases is unstable
f035d41b
XL
13 fn define() -> Self::Baa {
14 0
15 }
416331ca
XL
16}
17
f035d41b
XL
18fn define() -> Foo {
19 0
20}
416331ca 21
60c5eb7d
XL
22trait TraitWithDefault {
23 type Assoc = impl Debug;
24 //~^ ERROR associated type defaults are unstable
25 //~| ERROR `impl Trait` not allowed outside of function
26 //~| ERROR `impl Trait` in type aliases is unstable
27}
28
29type NestedFree = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug>);
30//~^ ERROR `impl Trait` in type aliases is unstable
31//~| ERROR `impl Trait` in type aliases is unstable
32//~| ERROR `impl Trait` in type aliases is unstable
33//~| ERROR `impl Trait` in type aliases is unstable
f035d41b
XL
34
35fn define_multiple() -> NestedFree {
36 (vec![true], 0u8, 0i32..1)
37}
60c5eb7d
XL
38
39impl Bar for u8 {
f035d41b 40 type Baa = (Vec<impl Debug>, impl Debug, impl Iterator<Item = impl Debug> + Debug);
60c5eb7d
XL
41 //~^ ERROR `impl Trait` in type aliases is unstable
42 //~| ERROR `impl Trait` in type aliases is unstable
43 //~| ERROR `impl Trait` in type aliases is unstable
44 //~| ERROR `impl Trait` in type aliases is unstable
f035d41b
XL
45 fn define() -> Self::Baa {
46 (vec![true], 0u8, 0i32..1)
47 }
60c5eb7d
XL
48}
49
416331ca 50fn main() {}