Skip to content

rusti: Cannot print not-implicitly-copyable variables #7692

Closed

Description

@gifnksm
$ rusti                                                                                                              (git)-[master] -
WARNING: The Rust REPL is experimental and may be
unstable. If you encounter problems, please use the
compiler instead. Type :help for help.
rusti> let v = ~[1,2,3];
rusti> v
<anon>:43:36: 43:37 error: use of moved value: `v`
<anon>:43                 let local: ~[int] = v;
                                              ^
<anon>:41:0: 41:1 note: `v` moved here because it has type `~[int]`, which is moved by default (use `copy` to override)
<anon>:41 v
          ^
error: aborting due to previous error
rust: task failed at 'explicit failure', /home/nksm/pkg/rust/src/rust/src/libsyntax/diagnostic.rs:95

I think rusti should prints the value of v.

Activity

  1. gifnksm commented on Jul 10, 2013

    @gifnksm
    ContributorAuthor

    workaround for this issue.

    rusti> let v = ~[1,2,3];
    rusti> copy v
    ~[1, 2, 3]
    
  2. alexcrichton commented on Aug 27, 2013

    @alexcrichton
    Member

    I was thinking about this awhile back. I think that the best way to go about doing this would be to just don't re-serialize moved variables. Basically after the user-input code is executed, detect if any of the local bound variables were moved, and don't reserialize them.

    The bad part is that you can move out of a variable and then use it in a later statement, but this is purely a debugging repl so I don't think that it's too bad.

  3. added a commit that references this issue on Oct 17, 2013
    386fa1d
  4. added a commit that references this issue on Sep 28, 2021
  5. added a commit that references this issue on Aug 21, 2026
    0af9d1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions