Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E0015] Signs of constant return value are lost when "impl" is used. #66439

Closed
denisandroid opened this issue Nov 15, 2019 · 2 comments
Closed
Labels
requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@denisandroid
Copy link

rustc 1.41.0-nightly (ded5ee001 2019-11-13)

Play: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=99f578dfc7ea70cf59bc59fe86485cd6

#![feature(const_fn)]
use core::mem::ManuallyDrop;

const fn check() -> impl Fn() {
	const fn my_function() {
		
	}
	
	my_function
}

const fn main() {
	let function = check();
	function(); //<--- error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
	
	let _e = ManuallyDrop::new(function);
}
@Centril Centril added requires-nightly This issue requires a nightly compiler in some way. F-const_fn labels Nov 15, 2019
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Nov 17, 2019
@ecstatic-morse
Copy link
Contributor

I believe this is a duplicate of #63997. const function pointers are not yet supported.

@jonas-schievink
Copy link
Contributor

Closing as duplicate / "working as currently intended"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants