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

Partially add string methods #17

Closed
wants to merge 1 commit into from
Closed

Partially add string methods #17

wants to merge 1 commit into from

Conversation

g-plane
Copy link
Contributor

@g-plane g-plane commented Mar 12, 2019

I have only added two functions -- len and byte.

Addition:
When I was trying adding more functions (not the len and byte function in this PR), I have encountered some issues about lifetime when using String::new, possibly due to my limitation of Rust knowledge.

[0] % cargo check
    Checking luster v0.1.0 (/mnt/working/Programming/Rust/luster)
error[E0477]: the type `[closure@src/stdlib/string.rs:12:41: 26:14 mc:&gc_arena::context::MutationContext<'gc, '_>]` does not fulfill the required lifetime
  --> src/stdlib/string.rs:12:13
   |
12 |             Callback::new_immediate(mc, |args| {
   |             ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: type must satisfy the static lifetime

error[E0621]: explicit lifetime required in the type of `mc`
  --> src/stdlib/string.rs:12:13
   |
5  | pub fn load_string<'gc>(mc: MutationContext<'gc, '_>, _: Root<'gc>, env: Table<'gc>) {
   |                             ------------------------ help: add explicit lifetime `'static` to the type of `mc`: `gc_arena::context::MutationContext<'gc, 'static>`
...
12 |             Callback::new_immediate(mc, |args| {
   |             ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required

error: aborting due to 2 previous errors

Some errors occurred: E0477, E0621.
For more information about an error, try `rustc --explain E0477`.
error: Could not compile `luster`.

To learn more, run the command again with --verbose.

@OmnipotentEntity
Copy link
Contributor

Do you have a gist of the code that errors?

@g-plane g-plane closed this Mar 28, 2019
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