Skip to content

const complex new#48

Closed
burrbull wants to merge 0 commit into
rust-num:masterfrom
burrbull:const
Closed

const complex new#48
burrbull wants to merge 0 commit into
rust-num:masterfrom
burrbull:const

Conversation

@burrbull

Copy link
Copy Markdown
Contributor

No description provided.

@burrbull

Copy link
Copy Markdown
Contributor Author

Is it possible to specify rust version feature gate?

@cuviper

cuviper commented Jun 4, 2019

Copy link
Copy Markdown
Member

You can use emit_rustc_version in the build script to get a cfg flag. The entire fn would have to be duplicated with and without the const qualifier.

However, do we really need const fn new? The fields are public, so Complex { re, im } should work just fine in constant expressions. (I suppose that could also argue against having new at all...)

@cuviper

cuviper commented Jul 26, 2019

Copy link
Copy Markdown
Member

I added conditional const functions in rust-num/num-rational#48, if that helps you here.

@burrbull burrbull closed this Jul 26, 2019
@burrbull

Copy link
Copy Markdown
Contributor Author

Does not work:

error[E0592]: duplicate definitions with name `new`

Accidentally close PR.

@burrbull

Copy link
Copy Markdown
Contributor Author

Sorry. All fine.

Created new #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants