thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (THRIFT-4662) Rust const string calls function at compile time
Date Sat, 10 Nov 2018 15:34:00 GMT


ASF GitHub Bot commented on THRIFT-4662:

allengeorge commented on issue #1624: THRIFT-4662: Rust const string calls function at compile
   @jake-ruyi Thank you for the PR. I've some minor comments, but overall this looks good.
If you can address them, I'll approve and this can be merged in.

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Rust const string calls function at compile time
> ------------------------------------------------
>                 Key: THRIFT-4662
>                 URL:
>             Project: Thrift
>          Issue Type: Bug
>          Components: Rust - Compiler
>    Affects Versions: 0.11.0
>         Environment: C:\Users\jake>rustup show
> Default host: x86_64-pc-windows-msvc
> stable-x86_64-pc-windows-msvc (default)
> rustc 1.30.0 (da5f414c2 2018-10-24)
>            Reporter: J W
>            Assignee: Allen George
>            Priority: Major
> *For this thrift:*
> const string broker_playback_message = "mmi.developer.playback"
> *Generates:*
> // thrift -gen rs -out ../rust/thrift/src const_string.thrift
> pub const BROKER_PLAYBACK_MESSAGE: String = "mmi.developer.playback".to_owned();
> *Fails to compile:*
> error[E0015]: calls in constants are limited to tuple structs and tuple variants
> note: a limited form of compile-time function evaluation is available on a nightly compiler
via `const fn`
> *Fix:*
> Probably want to output:
> pub const BROKER_PLAYBACK_MESSAGE: &str = "mmi.developer.playback";
> Looking at render_const_value() it looks like byte arrays will have the same issue.

This message was sent by Atlassian JIRA

View raw message