Skip to content

Instantly share code, notes, and snippets.

@kazimuth
Last active August 29, 2015 14:08
Show Gist options
  • Save kazimuth/1948004db8537293d162 to your computer and use it in GitHub Desktop.
Save kazimuth/1948004db8537293d162 to your computer and use it in GitHub Desktop.
Copy problems
// ...
#[deriving(Copy)]
pub struct PrefixTree {
children: [Option<Box<PrefixTree>>, ..26]
}
// ...
$ cargo build
Compiling scrabbletest v0.0.1 (file:///...)
.../src/main.rs:5:12: 5:16 error: the trait `core::kinds::Copy` is not implemented for the type `PrefixTree`
.../src/main.rs:5 #[deriving(Copy)]
^~~~
note: in expansion of #[deriving]
.../src/main.rs:5:1: 5:18 note: expansion site
.../src/main.rs:5:12: 5:16 note: the trait `core::kinds::Copy` must be implemented because it is required by `core::kinds::Copy`
.../src/main.rs:5 #[deriving(Copy)]
^~~~
note: in expansion of #[deriving]
.../src/main.rs:5:1: 5:18 note: expansion site
error: aborting due to previous error
Could not compile `scrabbletest`.
To learn more, run the command again with --verbose.
$ rustc --pretty expanded src/main.rs
#![feature(phase)]
#![no_std]
#![feature(globs)]
#[phase(plugin, link)]
extern crate "std" as std;
extern crate "native" as rt;
#[prelude_import]
use std::prelude::*;
pub struct PrefixTree {
children: [Option<Box<PrefixTree>>, ..26],
}
#[automatically_derived]
impl ::std::kinds::Copy for PrefixTree { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment