{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/1440","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1440/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1440/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1440/events","html_url":"https://github.com/rust-lang/rfcs/pull/1440","id":124545207,"number":1440,"title":"RFC - Allow Drop types in statics/const functions","user":{"login":"thepowersgang","id":955596,"avatar_url":"https://avatars.githubusercontent.com/u/955596?v=3","gravatar_id":"","url":"https://api.github.com/users/thepowersgang","html_url":"https://github.com/thepowersgang","followers_url":"https://api.github.com/users/thepowersgang/followers","following_url":"https://api.github.com/users/thepowersgang/following{/other_user}","gists_url":"https://api.github.com/users/thepowersgang/gists{/gist_id}","starred_url":"https://api.github.com/users/thepowersgang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thepowersgang/subscriptions","organizations_url":"https://api.github.com/users/thepowersgang/orgs","repos_url":"https://api.github.com/users/thepowersgang/repos","events_url":"https://api.github.com/users/thepowersgang/events{/privacy}","received_events_url":"https://api.github.com/users/thepowersgang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-01T13:46:10Z","updated_at":"2016-01-01T16:23:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rust-lang/rfcs/pulls/1440","html_url":"https://github.com/rust-lang/rfcs/pull/1440","diff_url":"https://github.com/rust-lang/rfcs/pull/1440.diff","patch_url":"https://github.com/rust-lang/rfcs/pull/1440.patch"},"body":"This addresses #913 and rust-lang/rust#30667"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/168314813","html_url":"https://github.com/rust-lang/rfcs/pull/1440#issuecomment-168314813","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/1440","id":168314813,"user":{"login":"eddyb","id":77424,"avatar_url":"https://avatars.githubusercontent.com/u/77424?v=3","gravatar_id":"","url":"https://api.github.com/users/eddyb","html_url":"https://github.com/eddyb","followers_url":"https://api.github.com/users/eddyb/followers","following_url":"https://api.github.com/users/eddyb/following{/other_user}","gists_url":"https://api.github.com/users/eddyb/gists{/gist_id}","starred_url":"https://api.github.com/users/eddyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eddyb/subscriptions","organizations_url":"https://api.github.com/users/eddyb/orgs","repos_url":"https://api.github.com/users/eddyb/repos","events_url":"https://api.github.com/users/eddyb/events{/privacy}","received_events_url":"https://api.github.com/users/eddyb/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T16:23:20Z","updated_at":"2016-01-01T16:23:20Z","body":"@mahkoh That's because it's impossible to check that property from the type, i.e. the body of a `const fn` is not technically part of the public API (this may change in the future, not sure if necessary).\r\n\r\nWhereas we already compute \"had `UnsafeCell`\" differently for `const fn` than for `const` expressions: The former is based on the type, the latter is based on the value and allows `&None::<Cell<i32>>` as there is no `UnsafeCell` value that could ever be accessed.\r\n\r\nTherefore, computing \"has `UnsafeCell<D>` where `D` requires drop\" is a trivial addition, and does not require inspecting the body of the `const fn` either.\r\n\r\nAllowing `const fn` to return references to statics would require inspecting the returned value, not just the return type.\r\n\r\nOTOH, the restriction on `const` items I suggested in rust-lang/rust#30667 is to prevent logical construction of a value with a destructor from a constant path, i.e. `{CONST;}` calling a destructor.\r\n\r\nI felt that `const fn` being permitted to return such values would be less confusing or controversial, but the `const` item restriction is *merely* a conservative choice and not actually required for safety, AFAIK."}}