{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/54579","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/54579/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/54579/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/54579/events","html_url":"https://github.com/rust-lang/rust/issues/54579","id":363791272,"node_id":"MDU6SXNzdWUzNjM3OTEyNzI=","number":54579,"title":"rust rejects functions of the same type, when a Fn trait bound is used.","user":{"login":"xieyuheng","id":4354888,"node_id":"MDQ6VXNlcjQzNTQ4ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/4354888?v=4","gravatar_id":"","url":"https://api.github.com/users/xieyuheng","html_url":"https://github.com/xieyuheng","followers_url":"https://api.github.com/users/xieyuheng/followers","following_url":"https://api.github.com/users/xieyuheng/following{/other_user}","gists_url":"https://api.github.com/users/xieyuheng/gists{/gist_id}","starred_url":"https://api.github.com/users/xieyuheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xieyuheng/subscriptions","organizations_url":"https://api.github.com/users/xieyuheng/orgs","repos_url":"https://api.github.com/users/xieyuheng/repos","events_url":"https://api.github.com/users/xieyuheng/events{/privacy}","received_events_url":"https://api.github.com/users/xieyuheng/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-09-25T22:32:47Z","updated_at":"2018-09-25T22:42:20Z","closed_at":"2018-09-25T22:38:21Z","author_association":"NONE","body":"(I am on nightly)\r\n\r\nwhen impl Trait is used, it is fine :: https://github.com/xieyuheng/sicp-rs/blob/2d1a7cdae50eb1e7abfa8b01deaf1fa7a6b97072/sicp/src/ch_1_3.rs#L81\r\n```\r\nfn sum (\r\n    term: impl Fn (f64) -> f64, a: f64,\r\n    next: impl Fn (f64) -> f64, b: f64,\r\n) -> f64 {\r\n    if a > b {\r\n        0.0\r\n    } else {\r\n        term (a) +\r\n            sum (term, next (a),\r\n                 next, b)\r\n    }\r\n}\r\n```\r\nbut when trait bound is used :: https://github.com/xieyuheng/sicp-rs/blob/2d1a7cdae50eb1e7abfa8b01deaf1fa7a6b97072/sicp/src/ch_1_3.rs#L58\r\n```\r\nfn sum <F> (\r\n    term: F, a: f64,\r\n    next: F, b: f64,\r\n) -> f64\r\nwhere F: Fn (f64) -> f64 {\r\n    if a > b {\r\n        0.0\r\n    } else {\r\n        term (a) +\r\n            sum (term, next (a),\r\n                 next, b)\r\n    }\r\n}\r\n```\r\nI got the following error :: https://github.com/xieyuheng/sicp-rs/blob/2d1a7cdae50eb1e7abfa8b01deaf1fa7a6b97072/sicp/src/ch_1_3.rs#L72\r\n```\r\nerror[E0308]: mismatched types\r\n  --> sicp/src/ch_1_3.rs:90:23\r\n   |\r\n90 |         sum (cube, a, inc, b)\r\n   |                       ^^^ expected fn item, found a different fn item\r\n   |\r\n   = note: expected type `fn(f64) -> f64 {ch_1_3::cube}`\r\n              found type `fn(f64) -> f64 {ch_1_3::with_sum::inc}`\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/424526014","html_url":"https://github.com/rust-lang/rust/issues/54579#issuecomment-424526014","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/54579","id":424526014,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDUyNjAxNA==","user":{"login":"xieyuheng","id":4354888,"node_id":"MDQ6VXNlcjQzNTQ4ODg=","avatar_url":"https://avatars0.githubusercontent.com/u/4354888?v=4","gravatar_id":"","url":"https://api.github.com/users/xieyuheng","html_url":"https://github.com/xieyuheng","followers_url":"https://api.github.com/users/xieyuheng/followers","following_url":"https://api.github.com/users/xieyuheng/following{/other_user}","gists_url":"https://api.github.com/users/xieyuheng/gists{/gist_id}","starred_url":"https://api.github.com/users/xieyuheng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xieyuheng/subscriptions","organizations_url":"https://api.github.com/users/xieyuheng/orgs","repos_url":"https://api.github.com/users/xieyuheng/repos","events_url":"https://api.github.com/users/xieyuheng/events{/privacy}","received_events_url":"https://api.github.com/users/xieyuheng/received_events","type":"User","site_admin":false},"created_at":"2018-09-25T22:42:20Z","updated_at":"2018-09-25T22:42:20Z","author_association":"NONE","body":"@Mark-Simulacrum \r\nDo you care to explain why  `fn(f64) -> f64 {ch_1_3::cube}` and `fn(f64) -> f64 {ch_1_3::with_sum::inc}` are different types ?"}}
{"actor":{"display_login":"xieyuheng"}}