Stream: general

Topic: slicing in constants


Luca Barbato (Jan 11 2019 at 13:11, on Zulip):

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7887d3ee9100c4f5d39b6a243e8bf00e

How hard would be to have this compiling correctly?

RalfJ (Jan 11 2019 at 13:12, on Zulip):

@Luca Barbato not easy. as the msg awkwardly indicates, slicing is a function call. it's calling a method on a trait, to be precise.

Luca Barbato (Jan 11 2019 at 13:12, on Zulip):

I know about Index :)

RalfJ (Jan 11 2019 at 13:12, on Zulip):

so fixing this requires finding a solution for "which trait methods can const code call"

RalfJ (Jan 11 2019 at 13:13, on Zulip):

and that's a tough question because you have to make sure that the trait method was implemented with const code only

RalfJ (Jan 11 2019 at 13:13, on Zulip):

see https://github.com/rust-rfcs/const-eval/pull/8 for the current discussion about that

Luca Barbato (Jan 11 2019 at 13:16, on Zulip):

I guess I should rethink that part for the time being :)

Last update: Nov 21 2019 at 23:25UTC