Skip to content

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

Closed
@denisandroid

Description

@denisandroid
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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions