prepend
This commit is contained in:
parent
368a5b6db9
commit
30d6dd9027
191 changed files with 476 additions and 0 deletions
91
prepend_digit_primes/Cargo.lock
generated
Normal file
91
prepend_digit_primes/Cargo.lock
generated
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "autocfg"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hamming"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "65043da274378d68241eb9a8f8f8aa54e349136f7b8e12f63e3ef44043cc30e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-integer"
|
||||||
|
version = "0.1.43"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-traits"
|
||||||
|
version = "0.2.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "prepend_digit_primes"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"primal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primal"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7bf9e0aea92a2e2a931fafb1b5d4c6e438197bbca4943a9984b3327fb8e3b5d0"
|
||||||
|
dependencies = [
|
||||||
|
"primal-check",
|
||||||
|
"primal-estimate",
|
||||||
|
"primal-sieve",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primal-bit"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2837edc85364907810b0ec880f1010dab1a9cc6e75bacb3655c7fd22e125ec1b"
|
||||||
|
dependencies = [
|
||||||
|
"hamming",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primal-check"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "01419cee72c1a1ca944554e23d83e483e1bccf378753344e881de28b5487511d"
|
||||||
|
dependencies = [
|
||||||
|
"num-integer",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primal-estimate"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "12e07b550a7cbfcaa567bcd28042919548016ad615b5731633fa5239992d853f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "primal-sieve"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bd0113d948c8f955a7ae96520023fe1e730eadbf26e67c4452f801a485e9d357"
|
||||||
|
dependencies = [
|
||||||
|
"primal-bit",
|
||||||
|
"primal-estimate",
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "1.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
|
||||||
10
prepend_digit_primes/Cargo.toml
Normal file
10
prepend_digit_primes/Cargo.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[package]
|
||||||
|
name = "prepend_digit_primes"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["William Ball <wball1@swarthmore.edu>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
primal = "0.3.0"
|
||||||
105
prepend_digit_primes/src/main.rs
Normal file
105
prepend_digit_primes/src/main.rs
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
struct Tree {
|
||||||
|
value: u128,
|
||||||
|
children: Vec<Tree>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Tree {
|
||||||
|
fn new(value: u128, children: Vec<u128>) -> Tree {
|
||||||
|
let mut tree_children = Vec::with_capacity(children.len());
|
||||||
|
for child in children {
|
||||||
|
tree_children.push(Tree::new(child, Vec::new()));
|
||||||
|
}
|
||||||
|
Tree {
|
||||||
|
value,
|
||||||
|
children: tree_children,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
let mut retval = format!("[{}: ", self.value);
|
||||||
|
for child in &self.children {
|
||||||
|
retval.push_str(&child.to_string()[..]);
|
||||||
|
}
|
||||||
|
retval.push(']');
|
||||||
|
retval
|
||||||
|
}
|
||||||
|
|
||||||
|
fn step(&mut self, primes: &mut HashMap<u128, bool>) {
|
||||||
|
if self.children.is_empty() {
|
||||||
|
let xs = step(self.value, primes);
|
||||||
|
for val in xs {
|
||||||
|
self.children.push(Tree::new(val, Vec::new()));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for child in &mut self.children {
|
||||||
|
child.step(primes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn longest_path(&self) -> Vec<u128> {
|
||||||
|
if self.children.is_empty() {
|
||||||
|
return vec![self.value];
|
||||||
|
}
|
||||||
|
let mut max_path = vec![];
|
||||||
|
let mut max_length = 0;
|
||||||
|
for child in &self.children {
|
||||||
|
let temp = child.longest_path();
|
||||||
|
if temp.len() > max_length {
|
||||||
|
max_length = temp.len();
|
||||||
|
max_path = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut retval = vec![self.value];
|
||||||
|
retval.append(&mut max_path);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_prime(n: u128, primes: &mut HashMap<u128, bool>) -> bool {
|
||||||
|
let res = primes.get(&n);
|
||||||
|
match res {
|
||||||
|
Some(val) => return *val,
|
||||||
|
None => {
|
||||||
|
let mut i = 2;
|
||||||
|
while i * i <= n {
|
||||||
|
if n % i == 0 {
|
||||||
|
primes.insert(n, false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
primes.insert(n, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn digits(n: u128) -> u32 {
|
||||||
|
n.to_string().len() as u32
|
||||||
|
}
|
||||||
|
|
||||||
|
fn step(x: u128, primes: &mut HashMap<u128, bool>) -> Vec<u128> {
|
||||||
|
let mut new_xs = Vec::new();
|
||||||
|
let digits: u32 = digits(x);
|
||||||
|
for d in 1..10 {
|
||||||
|
let temp = d * 10u128.pow(digits) + x;
|
||||||
|
if is_prime(temp, primes) {
|
||||||
|
new_xs.push(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new_xs;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut tree = Tree::new(0, vec![2, 3, 5, 7]);
|
||||||
|
let mut primes = HashMap::new();
|
||||||
|
for i in 0..20 {
|
||||||
|
tree.step(&mut primes);
|
||||||
|
println!("{}: {:?}", i, tree.longest_path());
|
||||||
|
}
|
||||||
|
println!("{}", tree.to_string());
|
||||||
|
}
|
||||||
1
prepend_digit_primes/target/.rustc_info.json
Normal file
1
prepend_digit_primes/target/.rustc_info.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc_fingerprint":8820382293931632979,"outputs":{"1164083562126845933":["rustc 1.44.1 (c7087fe00 2020-06-17)\nbinary: rustc\ncommit-hash: c7087fe00d2ba919df1d813c040a5d47e43b0fe7\ncommit-date: 2020-06-17\nhost: x86_64-unknown-linux-gnu\nrelease: 1.44.1\nLLVM version: 9.0\n",""],"4476964694761187371":["___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/wball1/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n",""]},"successes":{}}
|
||||||
0
prepend_digit_primes/target/debug/.cargo-lock
Normal file
0
prepend_digit_primes/target/debug/.cargo-lock
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
c5528a5f14600894
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":8574161726611873773,"profile":9935990280773120926,"path":2231583120935216222,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/autocfg-1448277b90571096/dep-lib-autocfg-1448277b90571096"}}],"rustflags":[],"metadata":13102859075309379048}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
aaaa1509f24bbb11
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":2322925091997197464,"profile":9935990280773120926,"path":9881501164722877471,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/hamming-f7cd00fddb2c0dde/dep-lib-hamming-f7cd00fddb2c0dde"}}],"rustflags":[],"metadata":11435927085409730030}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
9b051c300bfdadce
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[\"default\", \"std\"]","target":7800718724727423882,"profile":9935990280773120926,"path":18360201026855538313,"deps":[[74873448883125965,"num_traits",false,5214679006096731788],[13053465359523334410,"build_script_build",false,2720251519998876714]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/num-integer-10062f162ce3dcba/dep-lib-num_integer-10062f162ce3dcba"}}],"rustflags":[],"metadata":58200369117550911}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
2adc3f4d5846c025
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"","target":0,"profile":0,"path":0,"deps":[[13053465359523334410,"build_script_build",false,4308177619064313783]],"local":[{"RerunIfChanged":{"output":"debug/build/num-integer-5388b70d3d6e3c6d/output","paths":["build.rs"]}}],"rustflags":[],"metadata":0}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
b7d79d05b8b8c93b
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[\"default\", \"std\"]","target":10088282520713642473,"profile":9935990280773120926,"path":17268280674213731948,"deps":[[9245478811527615946,"autocfg",false,10666881358045532869]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/num-integer-86e8599f0ba8be3b/dep-build-script-build_script_build-86e8599f0ba8be3b"}}],"rustflags":[],"metadata":58200369117550911}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
8c2e1570ed425e48
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[\"std\"]","target":16894502179009968931,"profile":9935990280773120926,"path":12734757048507417164,"deps":[[74873448883125965,"build_script_build",false,1177636347299814283]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/num-traits-2d7b6f05babe375a/dep-lib-num_traits-2d7b6f05babe375a"}}],"rustflags":[],"metadata":14621636500951049976}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
8bdb64bb04ce5710
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"","target":0,"profile":0,"path":0,"deps":[[74873448883125965,"build_script_build",false,7876043645613464414]],"local":[{"RerunIfChanged":{"output":"debug/build/num-traits-30608ef2ad545d45/output","paths":["build.rs"]}}],"rustflags":[],"metadata":0}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
5e5b4374f7534d6d
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[\"std\"]","target":10088282520713642473,"profile":9935990280773120926,"path":8738564288946884329,"deps":[[9245478811527615946,"autocfg",false,10666881358045532869]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/num-traits-91eaf6e1267a55a4/dep-build-script-build_script_build-91eaf6e1267a55a4"}}],"rustflags":[],"metadata":14621636500951049976}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
{"message":"failed to resolve: use of undeclared type or module `primal`","code":{"code":"E0433","explanation":"An undeclared type or module was used.\n\nErroneous code example:\n\n```compile_fail,E0433\nlet map = HashMap::new();\n// error: failed to resolve: use of undeclared type or module `HashMap`\n```\n\nPlease verify you didn't misspell the type/module's name or that you didn't\nforget to import it:\n\n\n```\nuse std::collections::HashMap; // HashMap has been imported.\nlet map: HashMap<u32, u32> = HashMap::new(); // So it can be used!\n```\n"},"level":"error","spans":[{"file_name":"src/main.rs","byte_start":1714,"byte_end":1720,"line_start":69,"line_end":69,"column_start":12,"column_end":18,"is_primary":true,"text":[{"text":" if primal::is_prime(temp) {","highlight_start":12,"highlight_end":18}],"label":"use of undeclared type or module `primal`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0433]\u001b[0m\u001b[0m\u001b[1m: failed to resolve: use of undeclared type or module `primal`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:69:12\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m69\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m if primal::is_prime(temp) {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9muse of undeclared type or module `primal`\u001b[0m\n\n"}
|
||||||
|
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.\n\nErroneous code example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can happen in several cases, the most common being a mismatch\nbetween the type that the compiler inferred for a variable based on its\ninitializing expression, on the one hand, and the type the author explicitly\nassigned to the variable, on the other hand.\n"},"level":"error","spans":[{"file_name":"src/main.rs","byte_start":1522,"byte_end":1541,"line_start":61,"line_end":61,"column_start":5,"column_end":24,"is_primary":true,"text":[{"text":" n.to_string().len()","highlight_start":5,"highlight_end":24}],"label":"expected `u64`, found `usize`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null},{"file_name":"src/main.rs","byte_start":1512,"byte_end":1515,"line_start":60,"line_end":60,"column_start":22,"column_end":25,"is_primary":false,"text":[{"text":"fn digits(n: u64) -> u64 {","highlight_start":22,"highlight_end":25}],"label":"expected `u64` because of return type","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"you can convert an `usize` to `u64` and panic if the converted value wouldn't fit","code":null,"level":"help","spans":[{"file_name":"src/main.rs","byte_start":1522,"byte_end":1541,"line_start":61,"line_end":61,"column_start":5,"column_end":24,"is_primary":true,"text":[{"text":" n.to_string().len()","highlight_start":5,"highlight_end":24}],"label":null,"suggested_replacement":"n.to_string().len().try_into().unwrap()","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0308]\u001b[0m\u001b[0m\u001b[1m: mismatched types\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:61:5\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m60\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0mfn digits(n: u64) -> u64 {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m---\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12mexpected `u64` because of return type\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m61\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m n.to_string().len()\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mexpected `u64`, found `usize`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: you can convert an `usize` to `u64` and panic if the converted value wouldn't fit\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m61\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m n.to_string().len().try_into().unwrap()\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\n"}
|
||||||
|
{"message":"mismatched types","code":{"code":"E0308","explanation":"Expected type did not match the received type.\n\nErroneous code example:\n\n```compile_fail,E0308\nlet x: i32 = \"I am not a number!\";\n// ~~~ ~~~~~~~~~~~~~~~~~~~~\n// | |\n// | initializing expression;\n// | compiler infers type `&str`\n// |\n// type `i32` assigned to variable `x`\n```\n\nThis error occurs when the compiler was unable to infer the concrete type of a\nvariable. It can happen in several cases, the most common being a mismatch\nbetween the type that the compiler inferred for a variable based on its\ninitializing expression, on the one hand, and the type the author explicitly\nassigned to the variable, on the other hand.\n"},"level":"error","spans":[{"file_name":"src/main.rs","byte_start":1694,"byte_end":1700,"line_start":68,"line_end":68,"column_start":34,"column_end":40,"is_primary":true,"text":[{"text":" let temp = d * 10u64.pow(digits);","highlight_start":34,"highlight_end":40}],"label":"expected `u32`, found `u64`","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"you can convert an `u64` to `u32` and panic if the converted value wouldn't fit","code":null,"level":"help","spans":[{"file_name":"src/main.rs","byte_start":1694,"byte_end":1700,"line_start":68,"line_end":68,"column_start":34,"column_end":40,"is_primary":true,"text":[{"text":" let temp = d * 10u64.pow(digits);","highlight_start":34,"highlight_end":40}],"label":null,"suggested_replacement":"digits.try_into().unwrap()","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0308]\u001b[0m\u001b[0m\u001b[1m: mismatched types\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/main.rs:68:34\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m68\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let temp = d * 10u64.pow(digits);\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mexpected `u32`, found `u64`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: you can convert an `u64` to `u32` and panic if the converted value wouldn't fit\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m68\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m let temp = d * 10u64.pow(digits.try_into().unwrap());\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m| \u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;14m^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\n"}
|
||||||
|
{"message":"aborting due to 3 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 3 previous errors\u001b[0m\n\n"}
|
||||||
|
{"message":"Some errors have detailed explanations: E0308, E0433.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mSome errors have detailed explanations: E0308, E0433.\u001b[0m\n"}
|
||||||
|
{"message":"For more information about an error, try `rustc --explain E0308`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mFor more information about an error, try `rustc --explain E0308`.\u001b[0m\n"}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
6ce7934f67432c1e
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":3956642137505464643,"profile":14996655781355331481,"path":1036222786711178230,"deps":[[17532073805171608632,"primal",false,4480843508244492526]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/prepend_digit_primes-a1cb9ebc92515835/dep-bin-prepend_digit_primes-a1cb9ebc92515835"}}],"rustflags":[],"metadata":18079067696405074419}
|
||||||
Binary file not shown.
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
ee3007236e272f3e
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":4513600356512600704,"profile":9935990280773120926,"path":9794512189424769904,"deps":[[2637431931613344447,"primal_check",false,2927607459513826153],[14235317146973303535,"primal_sieve",false,8235806422586020816],[16083193364972783737,"primal_estimate",false,1336457528261984209]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/primal-7f7bbfb91418db8c/dep-lib-primal-7f7bbfb91418db8c"}}],"rustflags":[],"metadata":10541863805242775778}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
ef2f911a59d2bf81
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":4659132901410725190,"profile":9935990280773120926,"path":8929134705354873327,"deps":[[8531466953748503375,"hamming",false,1277698422196251306]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/primal-bit-96677df9de002578/dep-lib-primal_bit-96677df9de002578"}}],"rustflags":[],"metadata":16167354259392498579}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
69fb1a2a79f3a028
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":9822319782654175482,"profile":9935990280773120926,"path":13545799632343095798,"deps":[[13053465359523334410,"num_integer",false,14892837767277708699]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/primal-check-45820c184352cf6a/dep-lib-primal_check-45820c184352cf6a"}}],"rustflags":[],"metadata":7493097427140581252}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
d1bf73850a0d8c12
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":6950886450152894389,"profile":9935990280773120926,"path":14615040360027345179,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/primal-estimate-501c201e57ed9082/dep-lib-primal_estimate-501c201e57ed9082"}}],"rustflags":[],"metadata":8867417447345094579}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
d0d31e614e764b72
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":4535063106481711439,"profile":9935990280773120926,"path":3258652851284269613,"deps":[[7853083695984070762,"smallvec",false,16010109303002512792],[16083193364972783737,"primal_estimate",false,1336457528261984209],[16094930107278604660,"primal_bit",false,9349422631584083951]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/primal-sieve-6c2809511c80f371/dep-lib-primal_sieve-6c2809511c80f371"}}],"rustflags":[],"metadata":5969421905829136718}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
983da4fc95552fde
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
{"rustc":11295616921483704964,"features":"[]","target":11680772787092534394,"profile":9935990280773120926,"path":17915281146219452528,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/smallvec-786a9391403f62be/dep-lib-smallvec-786a9391403f62be"}}],"rustflags":[],"metadata":11511323240339246835}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
; ModuleID = 'probe0.3a1fbbbh-cgu.0'
|
||||||
|
source_filename = "probe0.3a1fbbbh-cgu.0"
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
|
||||||
|
!0 = !{i32 7, !"PIC Level", i32 2}
|
||||||
|
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
; ModuleID = 'probe1.3a1fbbbh-cgu.0'
|
||||||
|
source_filename = "probe1.3a1fbbbh-cgu.0"
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
|
||||||
|
!0 = !{i32 7, !"PIC Level", i32 2}
|
||||||
|
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
cargo:rustc-cfg=has_i128
|
||||||
|
cargo:rerun-if-changed=build.rs
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-integer-5388b70d3d6e3c6d/out
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,5 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-integer-86e8599f0ba8be3b/build_script_build-86e8599f0ba8be3b: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.43/build.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-integer-86e8599f0ba8be3b/build_script_build-86e8599f0ba8be3b.d: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.43/build.rs
|
||||||
|
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.43/build.rs:
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
This file has an mtime of when this was started.
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
; ModuleID = 'probe0.3a1fbbbh-cgu.0'
|
||||||
|
source_filename = "probe0.3a1fbbbh-cgu.0"
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
|
||||||
|
!0 = !{i32 7, !"PIC Level", i32 2}
|
||||||
|
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
; ModuleID = 'probe1.3a1fbbbh-cgu.0'
|
||||||
|
source_filename = "probe1.3a1fbbbh-cgu.0"
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
|
||||||
|
!0 = !{i32 7, !"PIC Level", i32 2}
|
||||||
|
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
; ModuleID = 'probe2.3a1fbbbh-cgu.0'
|
||||||
|
source_filename = "probe2.3a1fbbbh-cgu.0"
|
||||||
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||||
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
|
; core::f64::<impl f64>::to_int_unchecked
|
||||||
|
; Function Attrs: inlinehint nonlazybind uwtable
|
||||||
|
define i32 @"_ZN4core3f6421_$LT$impl$u20$f64$GT$16to_int_unchecked17h35ddf94b83fa670eE"(double %self) unnamed_addr #0 {
|
||||||
|
start:
|
||||||
|
; call <f64 as core::convert::num::FloatToInt<i32>>::to_int_unchecked
|
||||||
|
%0 = call i32 @"_ZN65_$LT$f64$u20$as$u20$core..convert..num..FloatToInt$LT$i32$GT$$GT$16to_int_unchecked17h83890e443cecc86cE"(double %self)
|
||||||
|
br label %bb1
|
||||||
|
|
||||||
|
bb1: ; preds = %start
|
||||||
|
ret i32 %0
|
||||||
|
}
|
||||||
|
|
||||||
|
; <f64 as core::convert::num::FloatToInt<i32>>::to_int_unchecked
|
||||||
|
; Function Attrs: inlinehint nonlazybind uwtable
|
||||||
|
define internal i32 @"_ZN65_$LT$f64$u20$as$u20$core..convert..num..FloatToInt$LT$i32$GT$$GT$16to_int_unchecked17h83890e443cecc86cE"(double %self) unnamed_addr #0 {
|
||||||
|
start:
|
||||||
|
%0 = alloca i32, align 4
|
||||||
|
%1 = fptosi double %self to i32
|
||||||
|
store i32 %1, i32* %0, align 4
|
||||||
|
%2 = load i32, i32* %0, align 4
|
||||||
|
br label %bb1
|
||||||
|
|
||||||
|
bb1: ; preds = %start
|
||||||
|
ret i32 %2
|
||||||
|
}
|
||||||
|
|
||||||
|
; probe2::probe
|
||||||
|
; Function Attrs: nonlazybind uwtable
|
||||||
|
define void @_ZN6probe25probe17h22946313ba01cf45E() unnamed_addr #1 {
|
||||||
|
start:
|
||||||
|
; call core::f64::<impl f64>::to_int_unchecked
|
||||||
|
%_1 = call i32 @"_ZN4core3f6421_$LT$impl$u20$f64$GT$16to_int_unchecked17h35ddf94b83fa670eE"(double 1.000000e+00)
|
||||||
|
br label %bb1
|
||||||
|
|
||||||
|
bb1: ; preds = %start
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes #0 = { inlinehint nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
|
||||||
|
attributes #1 = { nonlazybind uwtable "probe-stack"="__rust_probestack" "target-cpu"="x86-64" }
|
||||||
|
|
||||||
|
!llvm.module.flags = !{!0, !1}
|
||||||
|
|
||||||
|
!0 = !{i32 7, !"PIC Level", i32 2}
|
||||||
|
!1 = !{i32 2, !"RtLibUseGOT", i32 1}
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
cargo:rustc-cfg=has_i128
|
||||||
|
cargo:rustc-cfg=has_to_int_unchecked
|
||||||
|
cargo:rerun-if-changed=build.rs
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-traits-30608ef2ad545d45/out
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,5 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-traits-91eaf6e1267a55a4/build_script_build-91eaf6e1267a55a4: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/build/num-traits-91eaf6e1267a55a4/build_script_build-91eaf6e1267a55a4.d: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs
|
||||||
|
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.2.12/build.rs:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/autocfg-1448277b90571096.rmeta: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/error.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/version.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/libautocfg-1448277b90571096.rlib: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/error.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/version.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/autocfg-1448277b90571096.d: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/error.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/version.rs
|
||||||
|
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/lib.rs:
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/error.rs:
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/autocfg-1.0.0/src/version.rs:
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/hamming-f7cd00fddb2c0dde.rmeta: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/weight_.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/distance_.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/libhamming-f7cd00fddb2c0dde.rlib: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/weight_.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/distance_.rs
|
||||||
|
|
||||||
|
/home/wball1/math/prepend_digit_primes/target/debug/deps/hamming-f7cd00fddb2c0dde.d: /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/lib.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/weight_.rs /home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/distance_.rs
|
||||||
|
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/lib.rs:
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/weight_.rs:
|
||||||
|
/home/wball1/.cargo/registry/src/github.com-1ecc6299db9ec823/hamming-0.1.3/src/distance_.rs:
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue