Add some tests for associated type normalization edge cases · rust-lang/rust@d80d7ea (original) (raw)

``

1

`` +

warning: type Priv is more private than the item Leak

``

``

2

`+

--> $DIR/projections.rs:3:5

`

``

3

`+

|

`

``

4

`+

LL | pub type Leak = Priv;

`

``

5

`` +

| ^^^^^^^^^^^^^ type alias Leak is reachable at visibility pub(crate)

``

``

6

`+

|

`

``

7

`` +

note: but type Priv is only usable at visibility pub(self)

``

``

8

`+

--> $DIR/projections.rs:2:5

`

``

9

`+

|

`

``

10

`+

LL | struct Priv;

`

``

11

`+

| ^^^^^^^^^^^

`

``

12

`` +

= note: #[warn(private_interfaces)] on by default

``

``

13

+

``

14

`` +

error[E0446]: private type Priv in public interface

``

``

15

`+

--> $DIR/projections.rs:24:5

`

``

16

`+

|

`

``

17

`+

LL | struct Priv;

`

``

18

`` +

| ----------- Priv declared as private

``

``

19

`+

...

`

``

20

`+

LL | type A = m::Leak;

`

``

21

`+

| ^^^^^^^^^ can't leak private type

`

``

22

+

``

23

`` +

error[E0446]: private type Priv in public interface

``

``

24

`+

--> $DIR/projections.rs:39:5

`

``

25

`+

|

`

``

26

`+

LL | struct Priv;

`

``

27

`` +

| ----------- Priv declared as private

``

``

28

`+

...

`

``

29

`+

LL | type A<T: Trait> = T::A<m::Leak>;

`

``

30

`+

| ^^^^^^^^^^^^^^^^ can't leak private type

`

``

31

+

``

32

`` +

error: type Priv is private

``

``

33

`+

--> $DIR/projections.rs:14:15

`

``

34

`+

|

`

``

35

`+

LL | fn check() -> ::A<m::Leak> {

`

``

36

`+

| ^^^^^^^^^^^^^^^^^^^^^^^^^ private type

`

``

37

+

``

38

`` +

error: type Priv is private

``

``

39

`+

--> $DIR/projections.rs:29:39

`

``

40

`+

|

`

``

41

`+

LL | fn check2() -> ::A {

`

``

42

`+

| _______________________________________^

`

``

43

`+

LL | |

`

``

44

`+

LL | | todo!()

`

``

45

`+

LL | | }

`

``

46

`+

| |_^ private type

`

``

47

+

``

48

`` +

error: type Priv is private

``

``

49

`+

--> $DIR/projections.rs:24:17

`

``

50

`+

|

`

``

51

`+

LL | type A = m::Leak;

`

``

52

`+

| ^^^^^^^ private type

`

``

53

+

``

54

`` +

error: type Priv is private

``

``

55

`+

--> $DIR/projections.rs:39:24

`

``

56

`+

|

`

``

57

`+

LL | type A<T: Trait> = T::A<m::Leak>;

`

``

58

`+

| ^^^^^^^^^^^^^ private type

`

``

59

+

``

60

`+

error: aborting due to 6 previous errors; 1 warning emitted

`

``

61

+

``

62

`` +

For more information about this error, try rustc --explain E0446.

``