mw8 / white_keyboard_layout

An optimized personal keyboard layout and the tools to create your own
MIT License
100 stars 13 forks source link

Errors when running layout generator with rust #3

Closed tirefire777 closed 7 years ago

tirefire777 commented 7 years ago

I got the following errors when trying to use the layout generator with Rust. From what I could discern via google, this might just be due to the functionality of newer versions of rust?

error[E0432]: unresolved import std::num::Float --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.7/src/distributions/mod.rs:20:16 | 20 | use std::num::{Float, Int}; | ^^^^^ no Float in num

error[E0432]: unresolved import std::num::Int --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.7/src/distributions/mod.rs:20:23 | 20 | use std::num::{Float, Int}; | ^^^ no Int in num

error[E0277]: the trait bound Self: std::marker::Sized is not satisfied --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.7/src/distributions/range.rs:83:5 83 fn construct_range(low: Self, high: Self) -> Range; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait std::marker::Sized is not implemented for Self

= help: consider adding a where Self: std::marker::Sized bound = note: required by distributions::range::Range

error[E0277]: the trait bound Self: std::marker::Sized is not satisfied --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.7/src/distributions/range.rs:87:5 87 fn sample_range(r: &Range, rng: &mut R) -> Self; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait std::marker::Sized is not implemented for Self

= help: consider adding a where Self: std::marker::Sized bound = note: required by distributions::range::Range

error: aborting due to 2 previous errors

error: Could not compile rand.

tirefire777 commented 7 years ago

Fixed via: diff --git a/Cargo.toml b/Cargo.toml index 07650e2..9e0459c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,5 @@ version = "0.0.0" authors = [ "Michael White mwhite85@gmail.com" ]

[dependencies] -rand = "0.3.7" +rand = "0.3.15"

diff --git a/src/main.rs b/src/main.rs index 5843037..2dfab88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,12 +41,11 @@ // 46 . 62 > 78 N 94 ^ 110 n 126 ~ // 47 / 63 ? 79 O 95 _ 111 o

-#![feature(path_ext)] extern crate rand; use std::ops::Add; use std::path::Path; use std::io::{Read, Write}; -use std::fs::{File, PathExt}; +use std::fs::File; use std::collections::HashMap; use std::collections::hash_map::Entry::{Vacant, Occupied};

mw8 commented 7 years ago

Yeah, it was only up to date with Rust 1.0. Thanks a lot!