{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/50614","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/50614/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/50614/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/50614/events","html_url":"https://github.com/rust-lang/rust/issues/50614","id":322013716,"node_id":"MDU6SXNzdWUzMjIwMTM3MTY=","number":50614,"title":"Long compile time due to privacy checking private alias of public type","user":{"login":"iliekturtles","id":5081378,"node_id":"MDQ6VXNlcjUwODEzNzg=","avatar_url":"https://avatars3.githubusercontent.com/u/5081378?v=4","gravatar_id":"","url":"https://api.github.com/users/iliekturtles","html_url":"https://github.com/iliekturtles","followers_url":"https://api.github.com/users/iliekturtles/followers","following_url":"https://api.github.com/users/iliekturtles/following{/other_user}","gists_url":"https://api.github.com/users/iliekturtles/gists{/gist_id}","starred_url":"https://api.github.com/users/iliekturtles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iliekturtles/subscriptions","organizations_url":"https://api.github.com/users/iliekturtles/orgs","repos_url":"https://api.github.com/users/iliekturtles/repos","events_url":"https://api.github.com/users/iliekturtles/events{/privacy}","received_events_url":"https://api.github.com/users/iliekturtles/received_events","type":"User","site_admin":false},"labels":[{"id":650731663,"node_id":"MDU6TGFiZWw2NTA3MzE2NjM=","url":"https://api.github.com/repos/rust-lang/rust/labels/C-bug","name":"C-bug","color":"f5f1fd","default":false},{"id":64037154,"node_id":"MDU6TGFiZWw2NDAzNzE1NA==","url":"https://api.github.com/repos/rust-lang/rust/labels/I-compiletime","name":"I-compiletime","color":"e11d21","default":false},{"id":211668100,"node_id":"MDU6TGFiZWwyMTE2NjgxMDA=","url":"https://api.github.com/repos/rust-lang/rust/labels/T-compiler","name":"T-compiler","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-10T17:26:08Z","updated_at":"2018-08-25T21:07:47Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Private type aliases of public types (e.g. `type V = f32;`) cause long compile times in the privacy checking phase. Making the type alias public resolves the issue. See https://github.com/iliekturtles/uom/issues/52 where the issue was originally identified and the work-around was found. See [privacy_checking.rs](https://gist.github.com/iliekturtles/1ca45b239c7133cdc259d5089535bc87) for a simple example to reproduce the problem.\r\n\r\nThe following command can be used to reproduce the problem with a private type alias.\r\n```sh\r\ntime rustc +nightly --crate-type lib privacy_checking.rs -Ztime-passes --cfg 'feature=\"priv\"' --cfg 'feature=\"T6\"' --cfg 'feature=\"I5\"'\r\n```\r\n\r\nReplacing the `priv` feature with `pub` shows that the issue is corrected when using a public type alias.\r\n```sh\r\ntime rustc +nightly --crate-type lib privacy_checking.rs -Ztime-passes --cfg 'feature=\"pub\"' --cfg 'feature=\"T6\"' --cfg 'feature=\"I5\"'\r\n```\r\n\r\nVarying the `T_` (number of types) and `I_` (number of trait `impl`s) features shows how compile times change. See the below test data from my machine. It looks like privacy checking of a private type alias of a public type is exponential with the number of types and becomes linear with a very slight slope when checking public aliases.\r\n\r\n![image](https://user-images.githubusercontent.com/5081378/39883600-54fffb44-5455-11e8-9b9d-8f7ea0ece4ec.png)\r\n\r\nTypes | Impls | Ty x Impl | Time | Privacy checking | Time (pub) | Privacy checking (pub)\r\n-- | -- | -- | -- | -- | -- | --\r\n1 | 5 | 5 | 1.324 | 0.206 | 1.123 | 0.023\r\n2 | 5 | 10 | 2.816 | 0.823 | 1.999 | 0.061\r\n3 | 5 | 15 | 4.641 | 1.853 | 2.827 | 0.080\r\n4 | 5 | 20 | 6.968 | 3.243 | 3.714 | 0.103\r\n5 | 5 | 25 | 9.219 | 4.700 | 4.686 | 0.129\r\n6 | 5 | 30 | 12.721 | 7.371 | 5.598 | 0.163\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/415996618","html_url":"https://github.com/rust-lang/rust/issues/50614#issuecomment-415996618","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/50614","id":415996618,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk5NjYxOA==","user":{"login":"memoryruins","id":6868531,"node_id":"MDQ6VXNlcjY4Njg1MzE=","avatar_url":"https://avatars2.githubusercontent.com/u/6868531?v=4","gravatar_id":"","url":"https://api.github.com/users/memoryruins","html_url":"https://github.com/memoryruins","followers_url":"https://api.github.com/users/memoryruins/followers","following_url":"https://api.github.com/users/memoryruins/following{/other_user}","gists_url":"https://api.github.com/users/memoryruins/gists{/gist_id}","starred_url":"https://api.github.com/users/memoryruins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/memoryruins/subscriptions","organizations_url":"https://api.github.com/users/memoryruins/orgs","repos_url":"https://api.github.com/users/memoryruins/repos","events_url":"https://api.github.com/users/memoryruins/events{/privacy}","received_events_url":"https://api.github.com/users/memoryruins/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T21:07:47Z","updated_at":"2018-08-25T21:07:47Z","author_association":"CONTRIBUTOR","body":"[privacy_checking.rs](https://gist.githubusercontent.com/iliekturtles/1ca45b239c7133cdc259d5089535bc87/raw/4e26f32c038070542b1d7cd40cecd62b79c6a5ca/privacy_checking.rs) continues to have a notable difference in\r\n``rustc 1.30.0-nightly (d41f21f11 2018-08-24)``\r\n\r\n```\r\ntime rustc +nightly --crate-type lib privacy_checking.rs -Ztime-passes --cfg 'feature=\"priv\"' --cfg 'feature=\"T6\"' --cfg 'feature=\"I5\"'\r\n```\r\n> real    0m53.449s\r\nuser    0m49.484s\r\nsys     0m3.563s\r\n\r\n---\r\n```\r\ntime rustc +nightly --crate-type lib privacy_checking.rs -Ztime-passes --cfg 'feature=\"pub\"' --cfg 'feature=\"T6\"' --cfg 'feature=\"I5\"'\r\n```\r\n>real    0m21.467s\r\nuser    0m18.000s\r\nsys     0m3.328s\r\n\r\n"}}
{"actor":{"display_login":"memoryruins"}}