From 3afb8af7cd9d094087f13c3065ddcdb4f68c767f Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 12:51:39 +1000 Subject: [PATCH 01/11] add criterion benchmarking --- sway-lsp/Cargo.toml | 5 +++++ sway-lsp/benches/bench_main.rs | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 sway-lsp/benches/bench_main.rs diff --git a/sway-lsp/Cargo.toml b/sway-lsp/Cargo.toml index f4bc0a3b04c..ca092222a95 100644 --- a/sway-lsp/Cargo.toml +++ b/sway-lsp/Cargo.toml @@ -40,7 +40,12 @@ urlencoding = "2.1.2" [dev-dependencies] assert-json-diff = "2.0" +criterion = "0.5" dirs = "4.0" futures = { version = "0.3", default-features = false, features = ["std", "async-await"] } sway-lsp-test-utils = { path = "tests/utils" } tower = { version = "0.4.12", default-features = false, features = ["util"] } + +[[bench]] +name = "bench_main" +harness = false \ No newline at end of file diff --git a/sway-lsp/benches/bench_main.rs b/sway-lsp/benches/bench_main.rs new file mode 100644 index 00000000000..4ebd5946a3b --- /dev/null +++ b/sway-lsp/benches/bench_main.rs @@ -0,0 +1,7 @@ +mod benchmarks; +use criterion::criterion_main; + +criterion_main! { + benchmarks::token_map::benches, + benchmarks::requests::benches, +} From 1b673768948fd73c3ac4e3824d5267b8d96f85c6 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 12:52:12 +1000 Subject: [PATCH 02/11] make some lsp types pub --- sway-lsp/src/core/mod.rs | 2 +- sway-lsp/src/core/session.rs | 2 +- sway-lsp/src/lib.rs | 4 ++-- sway-lsp/src/utils/mod.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sway-lsp/src/core/mod.rs b/sway-lsp/src/core/mod.rs index a6889da7a0a..76e9a9ab7e0 100644 --- a/sway-lsp/src/core/mod.rs +++ b/sway-lsp/src/core/mod.rs @@ -2,5 +2,5 @@ pub mod document; pub mod session; pub(crate) mod sync; pub(crate) mod token; -pub(crate) mod token_map; +pub mod token_map; pub mod token_map_ext; diff --git a/sway-lsp/src/core/session.rs b/sway-lsp/src/core/session.rs index f12a6debc69..1cd8c1e36a8 100644 --- a/sway-lsp/src/core/session.rs +++ b/sway-lsp/src/core/session.rs @@ -138,7 +138,7 @@ impl Session { /// Write the result of parsing to the session. /// This function should only be called after successfully parsing. - pub(crate) fn write_parse_result(&self, res: ParseResult) { + pub fn write_parse_result(&self, res: ParseResult) { self.token_map.clear(); self.runnables.clear(); diff --git a/sway-lsp/src/lib.rs b/sway-lsp/src/lib.rs index aae6aafe170..83b63a1bd62 100644 --- a/sway-lsp/src/lib.rs +++ b/sway-lsp/src/lib.rs @@ -1,8 +1,8 @@ #![recursion_limit = "256"] -mod capabilities; +pub mod capabilities; pub mod config; -mod core; +pub mod core; pub mod error; pub mod server_state; mod handlers { diff --git a/sway-lsp/src/utils/mod.rs b/sway-lsp/src/utils/mod.rs index 971653cf83c..8c291008e3f 100644 --- a/sway-lsp/src/utils/mod.rs +++ b/sway-lsp/src/utils/mod.rs @@ -1,6 +1,6 @@ pub(crate) mod attributes; pub mod debug; pub(crate) mod document; -pub(crate) mod keyword_docs; +pub mod keyword_docs; pub mod markdown; pub(crate) mod markup; From cb81359d4cc8224491e2cf906cbaf0a8cd88d85e Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 12:56:10 +1000 Subject: [PATCH 03/11] add lsp_benchmarks --- sway-lsp/benches/lsp_benchmarks/mod.rs | 17 +++++++++ sway-lsp/benches/lsp_benchmarks/requests.rs | 36 ++++++++++++++++++++ sway-lsp/benches/lsp_benchmarks/token_map.rs | 34 ++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 sway-lsp/benches/lsp_benchmarks/mod.rs create mode 100644 sway-lsp/benches/lsp_benchmarks/requests.rs create mode 100644 sway-lsp/benches/lsp_benchmarks/token_map.rs diff --git a/sway-lsp/benches/lsp_benchmarks/mod.rs b/sway-lsp/benches/lsp_benchmarks/mod.rs new file mode 100644 index 00000000000..96876a505d1 --- /dev/null +++ b/sway-lsp/benches/lsp_benchmarks/mod.rs @@ -0,0 +1,17 @@ +pub mod requests; +pub mod token_map; + +use lsp_types::Url; +use std::{path::PathBuf, sync::Arc}; +use sway_lsp::core::session::{self, Session}; + +pub fn compile_test_project() -> (Url, Arc) { + let session = Session::new(); + // Load the test project + let uri = Url::from_file_path(PathBuf::from("/Users/josh/Documents/rust/fuel/lsp-test-projects/lsp_benchmarking/sway_project/src/main.sw")).unwrap(); + session.handle_open_file(&uri); + // Compile the project and write the parse result to the session + let parse_result = session::parse_project(&uri).unwrap(); + session.write_parse_result(parse_result); + (uri, Arc::new(session)) +} diff --git a/sway-lsp/benches/lsp_benchmarks/requests.rs b/sway-lsp/benches/lsp_benchmarks/requests.rs new file mode 100644 index 00000000000..75d89e53982 --- /dev/null +++ b/sway-lsp/benches/lsp_benchmarks/requests.rs @@ -0,0 +1,36 @@ +use criterion::{black_box, criterion_group, Criterion}; +use lsp_types::Position; +use sway_lsp::{capabilities, utils::keyword_docs::KeywordDocs}; + +fn benchmarks(c: &mut Criterion) { + let (uri, session) = black_box(super::compile_test_project()); + let keyword_docs = KeywordDocs::new(); + let position = Position::new(1716, 24); + + c.bench_function("hover", |b| { + b.iter(|| capabilities::hover::hover_data(session.clone(), &keyword_docs, uri.clone(), position)) + }); + + c.bench_function("highlight", |b| { + b.iter(|| capabilities::highlight::get_highlights(session.clone(), uri.clone(), position)) + }); + + c.bench_function("goto_definition", |b| { + b.iter(|| session.token_definition_response(uri.clone(), position)) + }); + + c.bench_function("prepare_rename", |b| { + b.iter(|| capabilities::rename::prepare_rename(session.clone(), uri.clone(), position)) + }); + + c.bench_function("rename", |b| { + b.iter(|| capabilities::rename::rename(session.clone(), "new_token_name".to_string(), uri.clone(), position)) + }); + +} + +criterion_group!{ + name = benches; + config = Criterion::default().measurement_time(std::time::Duration::from_secs(60)); + targets = benchmarks +} diff --git a/sway-lsp/benches/lsp_benchmarks/token_map.rs b/sway-lsp/benches/lsp_benchmarks/token_map.rs new file mode 100644 index 00000000000..feb7f7f0dc0 --- /dev/null +++ b/sway-lsp/benches/lsp_benchmarks/token_map.rs @@ -0,0 +1,34 @@ +use lsp_types::Position; +use criterion::{black_box, criterion_group, Criterion}; + +fn benchmarks(c: &mut Criterion) { + let (uri, session) = black_box(super::compile_test_project()); + let engines = session.engines.read(); + let position = Position::new(1716, 24); + + c.bench_function("tokens_for_file", |b| { + b.iter(|| session.token_map().tokens_for_file(engines.se(), &uri)) + }); + + c.bench_function("idents_at_position", |b| { + b.iter(|| session.token_map().idents_at_position(position, session.token_map().iter())) + }); + + c.bench_function("tokens_at_position", |b| { + b.iter(|| session.token_map().tokens_at_position(engines.se(), &uri, position, None)) + }); + + c.bench_function("token_at_position", |b| { + b.iter(|| session.token_map().token_at_position(engines.se(), &uri, position)) + }); + + c.bench_function("parent_decl_at_position", |b| { + b.iter(|| session.token_map().parent_decl_at_position(engines.se(), &uri, position)) + }); +} + +criterion_group!{ + name = benches; + config = Criterion::default().measurement_time(std::time::Duration::from_secs(60)); + targets = benchmarks +} From feb2d6feccf0abbfd467caecb73af586874f5944 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 13:04:34 +1000 Subject: [PATCH 04/11] change bench time to 10 secs --- sway-lsp/benches/bench_main.rs | 6 ++-- sway-lsp/benches/lsp_benchmarks/mod.rs | 14 ++++++++- sway-lsp/benches/lsp_benchmarks/requests.rs | 18 ++++++++---- sway-lsp/benches/lsp_benchmarks/token_map.rs | 30 +++++++++++++++----- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/sway-lsp/benches/bench_main.rs b/sway-lsp/benches/bench_main.rs index 4ebd5946a3b..af0e06a27b9 100644 --- a/sway-lsp/benches/bench_main.rs +++ b/sway-lsp/benches/bench_main.rs @@ -1,7 +1,7 @@ -mod benchmarks; +mod lsp_benchmarks; use criterion::criterion_main; criterion_main! { - benchmarks::token_map::benches, - benchmarks::requests::benches, + lsp_benchmarks::token_map::benches, + lsp_benchmarks::requests::benches, } diff --git a/sway-lsp/benches/lsp_benchmarks/mod.rs b/sway-lsp/benches/lsp_benchmarks/mod.rs index 96876a505d1..121161a1a10 100644 --- a/sway-lsp/benches/lsp_benchmarks/mod.rs +++ b/sway-lsp/benches/lsp_benchmarks/mod.rs @@ -8,10 +8,22 @@ use sway_lsp::core::session::{self, Session}; pub fn compile_test_project() -> (Url, Arc) { let session = Session::new(); // Load the test project - let uri = Url::from_file_path(PathBuf::from("/Users/josh/Documents/rust/fuel/lsp-test-projects/lsp_benchmarking/sway_project/src/main.sw")).unwrap(); + let uri = Url::from_file_path(benchmark_dir().join("src/main.sw")).unwrap(); session.handle_open_file(&uri); // Compile the project and write the parse result to the session let parse_result = session::parse_project(&uri).unwrap(); session.write_parse_result(parse_result); (uri, Arc::new(session)) } + +pub fn sway_workspace_dir() -> PathBuf { + std::env::current_dir() + .unwrap() + .parent() + .unwrap() + .to_path_buf() +} + +pub fn benchmark_dir() -> PathBuf { + sway_workspace_dir().join("sway-lsp/tests/fixtures/benchmark") +} diff --git a/sway-lsp/benches/lsp_benchmarks/requests.rs b/sway-lsp/benches/lsp_benchmarks/requests.rs index 75d89e53982..a53a35dd3a7 100644 --- a/sway-lsp/benches/lsp_benchmarks/requests.rs +++ b/sway-lsp/benches/lsp_benchmarks/requests.rs @@ -8,7 +8,9 @@ fn benchmarks(c: &mut Criterion) { let position = Position::new(1716, 24); c.bench_function("hover", |b| { - b.iter(|| capabilities::hover::hover_data(session.clone(), &keyword_docs, uri.clone(), position)) + b.iter(|| { + capabilities::hover::hover_data(session.clone(), &keyword_docs, uri.clone(), position) + }) }); c.bench_function("highlight", |b| { @@ -24,13 +26,19 @@ fn benchmarks(c: &mut Criterion) { }); c.bench_function("rename", |b| { - b.iter(|| capabilities::rename::rename(session.clone(), "new_token_name".to_string(), uri.clone(), position)) + b.iter(|| { + capabilities::rename::rename( + session.clone(), + "new_token_name".to_string(), + uri.clone(), + position, + ) + }) }); - } -criterion_group!{ +criterion_group! { name = benches; - config = Criterion::default().measurement_time(std::time::Duration::from_secs(60)); + config = Criterion::default().measurement_time(std::time::Duration::from_secs(10)); targets = benchmarks } diff --git a/sway-lsp/benches/lsp_benchmarks/token_map.rs b/sway-lsp/benches/lsp_benchmarks/token_map.rs index feb7f7f0dc0..b021f1c49fb 100644 --- a/sway-lsp/benches/lsp_benchmarks/token_map.rs +++ b/sway-lsp/benches/lsp_benchmarks/token_map.rs @@ -1,5 +1,5 @@ -use lsp_types::Position; use criterion::{black_box, criterion_group, Criterion}; +use lsp_types::Position; fn benchmarks(c: &mut Criterion) { let (uri, session) = black_box(super::compile_test_project()); @@ -11,24 +11,40 @@ fn benchmarks(c: &mut Criterion) { }); c.bench_function("idents_at_position", |b| { - b.iter(|| session.token_map().idents_at_position(position, session.token_map().iter())) + b.iter(|| { + session + .token_map() + .idents_at_position(position, session.token_map().iter()) + }) }); c.bench_function("tokens_at_position", |b| { - b.iter(|| session.token_map().tokens_at_position(engines.se(), &uri, position, None)) + b.iter(|| { + session + .token_map() + .tokens_at_position(engines.se(), &uri, position, None) + }) }); c.bench_function("token_at_position", |b| { - b.iter(|| session.token_map().token_at_position(engines.se(), &uri, position)) + b.iter(|| { + session + .token_map() + .token_at_position(engines.se(), &uri, position) + }) }); c.bench_function("parent_decl_at_position", |b| { - b.iter(|| session.token_map().parent_decl_at_position(engines.se(), &uri, position)) + b.iter(|| { + session + .token_map() + .parent_decl_at_position(engines.se(), &uri, position) + }) }); } -criterion_group!{ +criterion_group! { name = benches; - config = Criterion::default().measurement_time(std::time::Duration::from_secs(60)); + config = Criterion::default().measurement_time(std::time::Duration::from_secs(10)); targets = benchmarks } From e0f6aae41d505d2e219b896e755c94b696e3918f Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 13:05:03 +1000 Subject: [PATCH 05/11] add benchmarking fixture --- sway-lsp/tests/fixtures/benchmark/Forc.lock | 13 + sway-lsp/tests/fixtures/benchmark/Forc.toml | 8 + sway-lsp/tests/fixtures/benchmark/src/main.sw | 1728 +++++++++++++++++ 3 files changed, 1749 insertions(+) create mode 100644 sway-lsp/tests/fixtures/benchmark/Forc.lock create mode 100644 sway-lsp/tests/fixtures/benchmark/Forc.toml create mode 100644 sway-lsp/tests/fixtures/benchmark/src/main.sw diff --git a/sway-lsp/tests/fixtures/benchmark/Forc.lock b/sway-lsp/tests/fixtures/benchmark/Forc.lock new file mode 100644 index 00000000000..46d06f591d8 --- /dev/null +++ b/sway-lsp/tests/fixtures/benchmark/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = 'core' +source = 'path+from-root-B6DA1594080EA6DA' + +[[package]] +name = 'std' +source = 'git+https://github.com/fuellabs/sway?tag=v0.43.2#d8cf6118405164359fdf420c95cd07342e0eca8b' +dependencies = ['core'] + +[[package]] +name = 'sway_project' +source = 'member' +dependencies = ['std'] diff --git a/sway-lsp/tests/fixtures/benchmark/Forc.toml b/sway-lsp/tests/fixtures/benchmark/Forc.toml new file mode 100644 index 00000000000..b048b248d6b --- /dev/null +++ b/sway-lsp/tests/fixtures/benchmark/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Joshua Batty"] +entry = "main.sw" +license = "Apache-2.0" +name = "sway_project" +# implicit-std = false + +[dependencies] diff --git a/sway-lsp/tests/fixtures/benchmark/src/main.sw b/sway-lsp/tests/fixtures/benchmark/src/main.sw new file mode 100644 index 00000000000..ee70376ccb7 --- /dev/null +++ b/sway-lsp/tests/fixtures/benchmark/src/main.sw @@ -0,0 +1,1728 @@ +script; +use core::ops::*; + +/// I am a random doc comment. +struct Struct1 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct1(s: Struct1) -> u16 { + s.field2 +} + +/// I am a random doc comment. +struct Struct2 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct2(s: Struct2) -> u32 { + s.field3 +} + +/// I am a random doc comment. +struct Struct3 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct3(s: Struct3) -> u64 { + s.field4 +} + +/// I am a random doc comment. +struct Struct4 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct4(s: Struct4) -> u8 { + s.field1 +} + +/// I am a random doc comment. +struct Struct5 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct5(s: Struct5) -> u16 { + s.field2 +} + +/// I am a random doc comment. +struct Struct6 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct6(s: Struct6) -> u32 { + s.field3 +} + +/// I am a random doc comment. +struct Struct7 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct7(s: Struct7) -> u64 { + s.field4 +} + +/// I am a random doc comment. +struct Struct8 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct8(s: Struct8) -> u8 { + s.field1 +} + +/// I am a random doc comment. +struct Struct9 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct9(s: Struct9) -> u16 { + s.field2 +} + +/// I am a random doc comment. +struct Struct10 { + /// I am a random doc comment. + field1: u8, + /// I am a random doc comment. + field2: u16, + /// I am a random doc comment. + field3: u32, + /// I am a random doc comment. + field4: u64, +} + +/// I am a random doc comment. +fn func_struct10(s: Struct10) -> u32 { + s.field3 +} + +/// I am a random doc comment. +enum Enum11 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + + +/// I am a random doc comment. +fn func_enum11(e: Enum11) -> u64 { + match e { + Enum11::Variant1(_) => (), + Enum11::Variant2(_) => (), + Enum11::Variant3(_) => (), + Enum11::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum12 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum12(e: Enum12) -> u8 { + match e { + Enum12::Variant1(_) => (), + Enum12::Variant2(_) => (), + Enum12::Variant3(_) => (), + Enum12::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum13 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum13(e: Enum13) -> u16 { + match e { + Enum13::Variant1(_) => (), + Enum13::Variant2(_) => (), + Enum13::Variant3(_) => (), + Enum13::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum14 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum14(e: Enum14) -> u32 { + match e { + Enum14::Variant1(_) => (), + Enum14::Variant2(_) => (), + Enum14::Variant3(_) => (), + Enum14::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum15 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum15(e: Enum15) -> u64 { + match e { + Enum15::Variant1(_) => (), + Enum15::Variant2(_) => (), + Enum15::Variant3(_) => (), + Enum15::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum16 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum16(e: Enum16) -> u8 { + match e { + Enum16::Variant1(_) => (), + Enum16::Variant2(_) => (), + Enum16::Variant3(_) => (), + Enum16::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum17 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum17(e: Enum17) -> u16 { + match e { + Enum17::Variant1(_) => (), + Enum17::Variant2(_) => (), + Enum17::Variant3(_) => (), + Enum17::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum18 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum18(e: Enum18) -> u32 { + match e { + Enum18::Variant1(_) => (), + Enum18::Variant2(_) => (), + Enum18::Variant3(_) => (), + Enum18::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum19 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum19(e: Enum19) -> u64 { + match e { + Enum19::Variant1(_) => (), + Enum19::Variant2(_) => (), + Enum19::Variant3(_) => (), + Enum19::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +enum Enum20 { + /// I am a random doc comment. + Variant1: u8, + /// I am a random doc comment. + Variant2: u16, + /// I am a random doc comment. + Variant3: u32, + /// I am a random doc comment. + Variant4: u64, +} + +/// I am a random doc comment. +fn func_enum20(e: Enum20) -> u8 { + match e { + Enum20::Variant1(_) => (), + Enum20::Variant2(_) => (), + Enum20::Variant3(_) => (), + Enum20::Variant4(_) => (), + } + 0 +} + +/// I am a random doc comment. +fn func21(x: u64, y: u64) -> u64 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func22(x: u8, y: u8) -> u8 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func23(x: u16, y: u16) -> u16 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func24(x: u32, y: u32) -> u32 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func25(x: u64, y: u64) -> u64 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func26(x: u8, y: u8) -> u8 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func27(x: u16, y: u16) -> u16 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func28(x: u32, y: u32) -> u32 { + if x - y > 10 { + x / y + } else { + y / x + } +} + +/// I am a random doc comment. +fn func29(x: u16, y: u16) -> u16 { + if x - y > 10 { + x / y + } else { + y / x + } +} + + +/// I am a random doc comment. +fn func30(x: u32, y: u32) -> u32 { + if x - y > 10 { + x + y + } else { + y - x + } +} + + +fn main() { + let varb_u8: u8 = 1; + let varb_u16: u16 = 1; + let varb_u32: u32 = 1; + let varb_u64: u64 = 1; + let varc_u8: u8 = 2; + let varc_u16: u16 = 2; + let varc_u32: u32 = 2; + let varc_u64: u64 = 2; + let vard_u8: u8 = 3; + let vard_u16: u16 = 3; + let vard_u32: u32 = 3; + let vard_u64: u64 = 3; + let vare_u8: u8 = 4; + let vare_u16: u16 = 4; + let vare_u32: u32 = 4; + let vare_u64: u64 = 4; + let varf_u8: u8 = 5; + let varf_u16: u16 = 5; + let varf_u32: u32 = 5; + let varf_u64: u64 = 5; + let varg_u8: u8 = 6; + let varg_u16: u16 = 6; + let varg_u32: u32 = 6; + let varg_u64: u64 = 6; + let varh_u8: u8 = 7; + let varh_u16: u16 = 7; + let varh_u32: u32 = 7; + let varh_u64: u64 = 7; + let vari_u8: u8 = 8; + let vari_u16: u16 = 8; + let vari_u32: u32 = 8; + let vari_u64: u64 = 8; + let varj_u8: u8 = 9; + let varj_u16: u16 = 9; + let varj_u32: u32 = 9; + let varj_u64: u64 = 9; + let vark_u8: u8 = 10; + let vark_u16: u16 = 10; + let vark_u32: u32 = 10; + let vark_u64: u64 = 10; + let varl_u8: u8 = 11; + let varl_u16: u16 = 11; + let varl_u32: u32 = 11; + let varl_u64: u64 = 11; + let varm_u8: u8 = 12; + let varm_u16: u16 = 12; + let varm_u32: u32 = 12; + let varm_u64: u64 = 12; + let varn_u8: u8 = 13; + let varn_u16: u16 = 13; + let varn_u32: u32 = 13; + let varn_u64: u64 = 13; + let varo_u8: u8 = 14; + let varo_u16: u16 = 14; + let varo_u32: u32 = 14; + let varo_u64: u64 = 14; + let varp_u8: u8 = 15; + let varp_u16: u16 = 15; + let varp_u32: u32 = 15; + let varp_u64: u64 = 15; + let varq_u8: u8 = 16; + let varq_u16: u16 = 16; + let varq_u32: u32 = 16; + let varq_u64: u64 = 16; + let varr_u8: u8 = 17; + let varr_u16: u16 = 17; + let varr_u32: u32 = 17; + let varr_u64: u64 = 17; + let vars_u8: u8 = 18; + let vars_u16: u16 = 18; + let vars_u32: u32 = 18; + let vars_u64: u64 = 18; + let vart_u8: u8 = 19; + let vart_u16: u16 = 19; + let vart_u32: u32 = 19; + let vart_u64: u64 = 19; + let varu_u8: u8 = 20; + let varu_u16: u16 = 20; + let varu_u32: u32 = 20; + let varu_u64: u64 = 20; + let varv_u8: u8 = 21; + let varv_u16: u16 = 21; + let varv_u32: u32 = 21; + let varv_u64: u64 = 21; + let varw_u8: u8 = 22; + let varw_u16: u16 = 22; + let varw_u32: u32 = 22; + let varw_u64: u64 = 22; + let varx_u8: u8 = 23; + let varx_u16: u16 = 23; + let varx_u32: u32 = 23; + let varx_u64: u64 = 23; + let vary_u8: u8 = 24; + let vary_u16: u16 = 24; + let vary_u32: u32 = 24; + let vary_u64: u64 = 24; + let varz_u8: u8 = 25; + let varz_u16: u16 = 25; + let varz_u32: u32 = 25; + let varz_u64: u64 = 25; + let vara_u8: u8 = 26; + let vara_u16: u16 = 26; + let vara_u32: u32 = 26; + let vara_u64: u64 = 26; + let varb_u8: u8 = 27; + let varb_u16: u16 = 27; + let varb_u32: u32 = 27; + let varb_u64: u64 = 27; + let varc_u8: u8 = 28; + let varc_u16: u16 = 28; + let varc_u32: u32 = 28; + let varc_u64: u64 = 28; + let vard_u8: u8 = 29; + let vard_u16: u16 = 29; + let vard_u32: u32 = 29; + let vard_u64: u64 = 29; + let vare_u8: u8 = 30; + let vare_u16: u16 = 30; + let vare_u32: u32 = 30; + let vare_u64: u64 = 30; + let varf_u8: u8 = 31; + let varf_u16: u16 = 31; + let varf_u32: u32 = 31; + let varf_u64: u64 = 31; + let varg_u8: u8 = 32; + let varg_u16: u16 = 32; + let varg_u32: u32 = 32; + let varg_u64: u64 = 32; + let varh_u8: u8 = 33; + let varh_u16: u16 = 33; + let varh_u32: u32 = 33; + let varh_u64: u64 = 33; + let vari_u8: u8 = 34; + let vari_u16: u16 = 34; + let vari_u32: u32 = 34; + let vari_u64: u64 = 34; + let varj_u8: u8 = 35; + let varj_u16: u16 = 35; + let varj_u32: u32 = 35; + let varj_u64: u64 = 35; + let vark_u8: u8 = 36; + let vark_u16: u16 = 36; + let vark_u32: u32 = 36; + let vark_u64: u64 = 36; + let varl_u8: u8 = 37; + let varl_u16: u16 = 37; + let varl_u32: u32 = 37; + let varl_u64: u64 = 37; + let varm_u8: u8 = 38; + let varm_u16: u16 = 38; + let varm_u32: u32 = 38; + let varm_u64: u64 = 38; + let varn_u8: u8 = 39; + let varn_u16: u16 = 39; + let varn_u32: u32 = 39; + let varn_u64: u64 = 39; + let varo_u8: u8 = 40; + let varo_u16: u16 = 40; + let varo_u32: u32 = 40; + let varo_u64: u64 = 40; + let varp_u8: u8 = 41; + let varp_u16: u16 = 41; + let varp_u32: u32 = 41; + let varp_u64: u64 = 41; + let varq_u8: u8 = 42; + let varq_u16: u16 = 42; + let varq_u32: u32 = 42; + let varq_u64: u64 = 42; + let varr_u8: u8 = 43; + let varr_u16: u16 = 43; + let varr_u32: u32 = 43; + let varr_u64: u64 = 43; + let vars_u8: u8 = 44; + let vars_u16: u16 = 44; + let vars_u32: u32 = 44; + let vars_u64: u64 = 44; + let vart_u8: u8 = 45; + let vart_u16: u16 = 45; + let vart_u32: u32 = 45; + let vart_u64: u64 = 45; + let varu_u8: u8 = 46; + let varu_u16: u16 = 46; + let varu_u32: u32 = 46; + let varu_u64: u64 = 46; + let varv_u8: u8 = 47; + let varv_u16: u16 = 47; + let varv_u32: u32 = 47; + let varv_u64: u64 = 47; + let varw_u8: u8 = 48; + let varw_u16: u16 = 48; + let varw_u32: u32 = 48; + let varw_u64: u64 = 48; + let varx_u8: u8 = 49; + let varx_u16: u16 = 49; + let varx_u32: u32 = 49; + let varx_u64: u64 = 49; + let vary_u8: u8 = 50; + let vary_u16: u16 = 50; + let vary_u32: u32 = 50; + let vary_u64: u64 = 50; + let varz_u8: u8 = 51; + let varz_u16: u16 = 51; + let varz_u32: u32 = 51; + let varz_u64: u64 = 51; + let vara_u8: u8 = 52; + let vara_u16: u16 = 52; + let vara_u32: u32 = 52; + let vara_u64: u64 = 52; + let varb_u8: u8 = 53; + let varb_u16: u16 = 53; + let varb_u32: u32 = 53; + let varb_u64: u64 = 53; + let varc_u8: u8 = 54; + let varc_u16: u16 = 54; + let varc_u32: u32 = 54; + let varc_u64: u64 = 54; + let vard_u8: u8 = 55; + let vard_u16: u16 = 55; + let vard_u32: u32 = 55; + let vard_u64: u64 = 55; + let vare_u8: u8 = 56; + let vare_u16: u16 = 56; + let vare_u32: u32 = 56; + let vare_u64: u64 = 56; + let varf_u8: u8 = 57; + let varf_u16: u16 = 57; + let varf_u32: u32 = 57; + let varf_u64: u64 = 57; + let varg_u8: u8 = 58; + let varg_u16: u16 = 58; + let varg_u32: u32 = 58; + let varg_u64: u64 = 58; + let varh_u8: u8 = 59; + let varh_u16: u16 = 59; + let varh_u32: u32 = 59; + let varh_u64: u64 = 59; + let vari_u8: u8 = 60; + let vari_u16: u16 = 60; + let vari_u32: u32 = 60; + let vari_u64: u64 = 60; + let varj_u8: u8 = 61; + let varj_u16: u16 = 61; + let varj_u32: u32 = 61; + let varj_u64: u64 = 61; + let vark_u8: u8 = 62; + let vark_u16: u16 = 62; + let vark_u32: u32 = 62; + let vark_u64: u64 = 62; + let varl_u8: u8 = 63; + let varl_u16: u16 = 63; + let varl_u32: u32 = 63; + let varl_u64: u64 = 63; + let varm_u8: u8 = 64; + let varm_u16: u16 = 64; + let varm_u32: u32 = 64; + let varm_u64: u64 = 64; + let varn_u8: u8 = 65; + let varn_u16: u16 = 65; + let varn_u32: u32 = 65; + let varn_u64: u64 = 65; + let varo_u8: u8 = 66; + let varo_u16: u16 = 66; + let varo_u32: u32 = 66; + let varo_u64: u64 = 66; + let varp_u8: u8 = 67; + let varp_u16: u16 = 67; + let varp_u32: u32 = 67; + let varp_u64: u64 = 67; + let varq_u8: u8 = 68; + let varq_u16: u16 = 68; + let varq_u32: u32 = 68; + let varq_u64: u64 = 68; + let varr_u8: u8 = 69; + let varr_u16: u16 = 69; + let varr_u32: u32 = 69; + let varr_u64: u64 = 69; + let vars_u8: u8 = 70; + let vars_u16: u16 = 70; + let vars_u32: u32 = 70; + let vars_u64: u64 = 70; + let vart_u8: u8 = 71; + let vart_u16: u16 = 71; + let vart_u32: u32 = 71; + let vart_u64: u64 = 71; + let varu_u8: u8 = 72; + let varu_u16: u16 = 72; + let varu_u32: u32 = 72; + let varu_u64: u64 = 72; + let varv_u8: u8 = 73; + let varv_u16: u16 = 73; + let varv_u32: u32 = 73; + let varv_u64: u64 = 73; + let varw_u8: u8 = 74; + let varw_u16: u16 = 74; + let varw_u32: u32 = 74; + let varw_u64: u64 = 74; + let varx_u8: u8 = 75; + let varx_u16: u16 = 75; + let varx_u32: u32 = 75; + let varx_u64: u64 = 75; + let vary_u8: u8 = 76; + let vary_u16: u16 = 76; + let vary_u32: u32 = 76; + let vary_u64: u64 = 76; + let varz_u8: u8 = 77; + let varz_u16: u16 = 77; + let varz_u32: u32 = 77; + let varz_u64: u64 = 77; + let vara_u8: u8 = 78; + let vara_u16: u16 = 78; + let vara_u32: u32 = 78; + let vara_u64: u64 = 78; + let varb_u8: u8 = 79; + let varb_u16: u16 = 79; + let varb_u32: u32 = 79; + let varb_u64: u64 = 79; + let varc_u8: u8 = 80; + let varc_u16: u16 = 80; + let varc_u32: u32 = 80; + let varc_u64: u64 = 80; + let vard_u8: u8 = 81; + let vard_u16: u16 = 81; + let vard_u32: u32 = 81; + let vard_u64: u64 = 81; + let vare_u8: u8 = 82; + let vare_u16: u16 = 82; + let vare_u32: u32 = 82; + let vare_u64: u64 = 82; + let varf_u8: u8 = 83; + let varf_u16: u16 = 83; + let varf_u32: u32 = 83; + let varf_u64: u64 = 83; + let varg_u8: u8 = 84; + let varg_u16: u16 = 84; + let varg_u32: u32 = 84; + let varg_u64: u64 = 84; + let varh_u8: u8 = 85; + let varh_u16: u16 = 85; + let varh_u32: u32 = 85; + let varh_u64: u64 = 85; + let vari_u8: u8 = 86; + let vari_u16: u16 = 86; + let vari_u32: u32 = 86; + let vari_u64: u64 = 86; + let varj_u8: u8 = 87; + let varj_u16: u16 = 87; + let varj_u32: u32 = 87; + let varj_u64: u64 = 87; + let vark_u8: u8 = 88; + let vark_u16: u16 = 88; + let vark_u32: u32 = 88; + let vark_u64: u64 = 88; + let varl_u8: u8 = 89; + let varl_u16: u16 = 89; + let varl_u32: u32 = 89; + let varl_u64: u64 = 89; + let varm_u8: u8 = 90; + let varm_u16: u16 = 90; + let varm_u32: u32 = 90; + let varm_u64: u64 = 90; + let varn_u8: u8 = 91; + let varn_u16: u16 = 91; + let varn_u32: u32 = 91; + let varn_u64: u64 = 91; + let varo_u8: u8 = 92; + let varo_u16: u16 = 92; + let varo_u32: u32 = 92; + let varo_u64: u64 = 92; + let varp_u8: u8 = 93; + let varp_u16: u16 = 93; + let varp_u32: u32 = 93; + let varp_u64: u64 = 93; + let varq_u8: u8 = 94; + let varq_u16: u16 = 94; + let varq_u32: u32 = 94; + let varq_u64: u64 = 94; + let varr_u8: u8 = 95; + let varr_u16: u16 = 95; + let varr_u32: u32 = 95; + let varr_u64: u64 = 95; + let vars_u8: u8 = 96; + let vars_u16: u16 = 96; + let vars_u32: u32 = 96; + let vars_u64: u64 = 96; + let vart_u8: u8 = 97; + let vart_u16: u16 = 97; + let vart_u32: u32 = 97; + let vart_u64: u64 = 97; + let varu_u8: u8 = 98; + let varu_u16: u16 = 98; + let varu_u32: u32 = 98; + let varu_u64: u64 = 98; + let varv_u8: u8 = 99; + let varv_u16: u16 = 99; + let varv_u32: u32 = 99; + let varv_u64: u64 = 99; + let varw_u8: u8 = 100; + let varw_u16: u16 = 100; + let varw_u32: u32 = 100; + let varw_u64: u64 = 100; + let varx_u8: u8 = 101; + let varx_u16: u16 = 101; + let varx_u32: u32 = 101; + let varx_u64: u64 = 101; + let vary_u8: u8 = 102; + let vary_u16: u16 = 102; + let vary_u32: u32 = 102; + let vary_u64: u64 = 102; + let varz_u8: u8 = 103; + let varz_u16: u16 = 103; + let varz_u32: u32 = 103; + let varz_u64: u64 = 103; + let vara_u8: u8 = 104; + let vara_u16: u16 = 104; + let vara_u32: u32 = 104; + let vara_u64: u64 = 104; + let varb_u8: u8 = 105; + let varb_u16: u16 = 105; + let varb_u32: u32 = 105; + let varb_u64: u64 = 105; + let varc_u8: u8 = 106; + let varc_u16: u16 = 106; + let varc_u32: u32 = 106; + let varc_u64: u64 = 106; + let vard_u8: u8 = 107; + let vard_u16: u16 = 107; + let vard_u32: u32 = 107; + let vard_u64: u64 = 107; + let vare_u8: u8 = 108; + let vare_u16: u16 = 108; + let vare_u32: u32 = 108; + let vare_u64: u64 = 108; + let varf_u8: u8 = 109; + let varf_u16: u16 = 109; + let varf_u32: u32 = 109; + let varf_u64: u64 = 109; + let varg_u8: u8 = 110; + let varg_u16: u16 = 110; + let varg_u32: u32 = 110; + let varg_u64: u64 = 110; + let varh_u8: u8 = 111; + let varh_u16: u16 = 111; + let varh_u32: u32 = 111; + let varh_u64: u64 = 111; + let vari_u8: u8 = 112; + let vari_u16: u16 = 112; + let vari_u32: u32 = 112; + let vari_u64: u64 = 112; + let varj_u8: u8 = 113; + let varj_u16: u16 = 113; + let varj_u32: u32 = 113; + let varj_u64: u64 = 113; + let vark_u8: u8 = 114; + let vark_u16: u16 = 114; + let vark_u32: u32 = 114; + let vark_u64: u64 = 114; + let varl_u8: u8 = 115; + let varl_u16: u16 = 115; + let varl_u32: u32 = 115; + let varl_u64: u64 = 115; + let varm_u8: u8 = 116; + let varm_u16: u16 = 116; + let varm_u32: u32 = 116; + let varm_u64: u64 = 116; + let varn_u8: u8 = 117; + let varn_u16: u16 = 117; + let varn_u32: u32 = 117; + let varn_u64: u64 = 117; + let varo_u8: u8 = 118; + let varo_u16: u16 = 118; + let varo_u32: u32 = 118; + let varo_u64: u64 = 118; + let varp_u8: u8 = 119; + let varp_u16: u16 = 119; + let varp_u32: u32 = 119; + let varp_u64: u64 = 119; + let varq_u8: u8 = 120; + let varq_u16: u16 = 120; + let varq_u32: u32 = 120; + let varq_u64: u64 = 120; + let varr_u8: u8 = 121; + let varr_u16: u16 = 121; + let varr_u32: u32 = 121; + let varr_u64: u64 = 121; + let vars_u8: u8 = 122; + let vars_u16: u16 = 122; + let vars_u32: u32 = 122; + let vars_u64: u64 = 122; + let vart_u8: u8 = 123; + let vart_u16: u16 = 123; + let vart_u32: u32 = 123; + let vart_u64: u64 = 123; + let varu_u8: u8 = 124; + let varu_u16: u16 = 124; + let varu_u32: u32 = 124; + let varu_u64: u64 = 124; + let varv_u8: u8 = 125; + let varv_u16: u16 = 125; + let varv_u32: u32 = 125; + let varv_u64: u64 = 125; + let varw_u8: u8 = 126; + let varw_u16: u16 = 126; + let varw_u32: u32 = 126; + let varw_u64: u64 = 126; + let varx_u8: u8 = 127; + let varx_u16: u16 = 127; + let varx_u32: u32 = 127; + let varx_u64: u64 = 127; + let vary_u8: u8 = 128; + let vary_u16: u16 = 128; + let vary_u32: u32 = 128; + let vary_u64: u64 = 128; + let varz_u8: u8 = 129; + let varz_u16: u16 = 129; + let varz_u32: u32 = 129; + let varz_u64: u64 = 129; + let vara_u8: u8 = 130; + let vara_u16: u16 = 130; + let vara_u32: u32 = 130; + let vara_u64: u64 = 130; + let varb_u8: u8 = 131; + let varb_u16: u16 = 131; + let varb_u32: u32 = 131; + let varb_u64: u64 = 131; + let varc_u8: u8 = 132; + let varc_u16: u16 = 132; + let varc_u32: u32 = 132; + let varc_u64: u64 = 132; + let vard_u8: u8 = 133; + let vard_u16: u16 = 133; + let vard_u32: u32 = 133; + let vard_u64: u64 = 133; + let vare_u8: u8 = 134; + let vare_u16: u16 = 134; + let vare_u32: u32 = 134; + let vare_u64: u64 = 134; + let varf_u8: u8 = 135; + let varf_u16: u16 = 135; + let varf_u32: u32 = 135; + let varf_u64: u64 = 135; + let varg_u8: u8 = 136; + let varg_u16: u16 = 136; + let varg_u32: u32 = 136; + let varg_u64: u64 = 136; + let varh_u8: u8 = 137; + let varh_u16: u16 = 137; + let varh_u32: u32 = 137; + let varh_u64: u64 = 137; + let vari_u8: u8 = 138; + let vari_u16: u16 = 138; + let vari_u32: u32 = 138; + let vari_u64: u64 = 138; + let varj_u8: u8 = 139; + let varj_u16: u16 = 139; + let varj_u32: u32 = 139; + let varj_u64: u64 = 139; + let vark_u8: u8 = 140; + let vark_u16: u16 = 140; + let vark_u32: u32 = 140; + let vark_u64: u64 = 140; + let varl_u8: u8 = 141; + let varl_u16: u16 = 141; + let varl_u32: u32 = 141; + let varl_u64: u64 = 141; + let varm_u8: u8 = 142; + let varm_u16: u16 = 142; + let varm_u32: u32 = 142; + let varm_u64: u64 = 142; + let varn_u8: u8 = 143; + let varn_u16: u16 = 143; + let varn_u32: u32 = 143; + let varn_u64: u64 = 143; + let varo_u8: u8 = 144; + let varo_u16: u16 = 144; + let varo_u32: u32 = 144; + let varo_u64: u64 = 144; + let varp_u8: u8 = 145; + let varp_u16: u16 = 145; + let varp_u32: u32 = 145; + let varp_u64: u64 = 145; + let varq_u8: u8 = 146; + let varq_u16: u16 = 146; + let varq_u32: u32 = 146; + let varq_u64: u64 = 146; + let varr_u8: u8 = 147; + let varr_u16: u16 = 147; + let varr_u32: u32 = 147; + let varr_u64: u64 = 147; + let vars_u8: u8 = 148; + let vars_u16: u16 = 148; + let vars_u32: u32 = 148; + let vars_u64: u64 = 148; + let vart_u8: u8 = 149; + let vart_u16: u16 = 149; + let vart_u32: u32 = 149; + let vart_u64: u64 = 149; + let varu_u8: u8 = 150; + let varu_u16: u16 = 150; + let varu_u32: u32 = 150; + let varu_u64: u64 = 150; + let varv_u8: u8 = 151; + let varv_u16: u16 = 151; + let varv_u32: u32 = 151; + let varv_u64: u64 = 151; + let varw_u8: u8 = 152; + let varw_u16: u16 = 152; + let varw_u32: u32 = 152; + let varw_u64: u64 = 152; + let varx_u8: u8 = 153; + let varx_u16: u16 = 153; + let varx_u32: u32 = 153; + let varx_u64: u64 = 153; + let vary_u8: u8 = 154; + let vary_u16: u16 = 154; + let vary_u32: u32 = 154; + let vary_u64: u64 = 154; + let varz_u8: u8 = 155; + let varz_u16: u16 = 155; + let varz_u32: u32 = 155; + let varz_u64: u64 = 155; + let vara_u8: u8 = 156; + let vara_u16: u16 = 156; + let vara_u32: u32 = 156; + let vara_u64: u64 = 156; + let varb_u8: u8 = 157; + let varb_u16: u16 = 157; + let varb_u32: u32 = 157; + let varb_u64: u64 = 157; + let varc_u8: u8 = 158; + let varc_u16: u16 = 158; + let varc_u32: u32 = 158; + let varc_u64: u64 = 158; + let vard_u8: u8 = 159; + let vard_u16: u16 = 159; + let vard_u32: u32 = 159; + let vard_u64: u64 = 159; + let vare_u8: u8 = 160; + let vare_u16: u16 = 160; + let vare_u32: u32 = 160; + let vare_u64: u64 = 160; + let varf_u8: u8 = 161; + let varf_u16: u16 = 161; + let varf_u32: u32 = 161; + let varf_u64: u64 = 161; + let varg_u8: u8 = 162; + let varg_u16: u16 = 162; + let varg_u32: u32 = 162; + let varg_u64: u64 = 162; + let varh_u8: u8 = 163; + let varh_u16: u16 = 163; + let varh_u32: u32 = 163; + let varh_u64: u64 = 163; + let vari_u8: u8 = 164; + let vari_u16: u16 = 164; + let vari_u32: u32 = 164; + let vari_u64: u64 = 164; + let varj_u8: u8 = 165; + let varj_u16: u16 = 165; + let varj_u32: u32 = 165; + let varj_u64: u64 = 165; + let vark_u8: u8 = 166; + let vark_u16: u16 = 166; + let vark_u32: u32 = 166; + let vark_u64: u64 = 166; + let varl_u8: u8 = 167; + let varl_u16: u16 = 167; + let varl_u32: u32 = 167; + let varl_u64: u64 = 167; + let varm_u8: u8 = 168; + let varm_u16: u16 = 168; + let varm_u32: u32 = 168; + let varm_u64: u64 = 168; + let varn_u8: u8 = 169; + let varn_u16: u16 = 169; + let varn_u32: u32 = 169; + let varn_u64: u64 = 169; + let varo_u8: u8 = 170; + let varo_u16: u16 = 170; + let varo_u32: u32 = 170; + let varo_u64: u64 = 170; + let varp_u8: u8 = 171; + let varp_u16: u16 = 171; + let varp_u32: u32 = 171; + let varp_u64: u64 = 171; + let varq_u8: u8 = 172; + let varq_u16: u16 = 172; + let varq_u32: u32 = 172; + let varq_u64: u64 = 172; + let varr_u8: u8 = 173; + let varr_u16: u16 = 173; + let varr_u32: u32 = 173; + let varr_u64: u64 = 173; + let vars_u8: u8 = 174; + let vars_u16: u16 = 174; + let vars_u32: u32 = 174; + let vars_u64: u64 = 174; + let vart_u8: u8 = 175; + let vart_u16: u16 = 175; + let vart_u32: u32 = 175; + let vart_u64: u64 = 175; + let varu_u8: u8 = 176; + let varu_u16: u16 = 176; + let varu_u32: u32 = 176; + let varu_u64: u64 = 176; + let varv_u8: u8 = 177; + let varv_u16: u16 = 177; + let varv_u32: u32 = 177; + let varv_u64: u64 = 177; + let varw_u8: u8 = 178; + let varw_u16: u16 = 178; + let varw_u32: u32 = 178; + let varw_u64: u64 = 178; + let varx_u8: u8 = 179; + let varx_u16: u16 = 179; + let varx_u32: u32 = 179; + let varx_u64: u64 = 179; + let vary_u8: u8 = 180; + let vary_u16: u16 = 180; + let vary_u32: u32 = 180; + let vary_u64: u64 = 180; + let varz_u8: u8 = 181; + let varz_u16: u16 = 181; + let varz_u32: u32 = 181; + let varz_u64: u64 = 181; + let vara_u8: u8 = 182; + let vara_u16: u16 = 182; + let vara_u32: u32 = 182; + let vara_u64: u64 = 182; + let varb_u8: u8 = 183; + let varb_u16: u16 = 183; + let varb_u32: u32 = 183; + let varb_u64: u64 = 183; + let varc_u8: u8 = 184; + let varc_u16: u16 = 184; + let varc_u32: u32 = 184; + let varc_u64: u64 = 184; + let vard_u8: u8 = 185; + let vard_u16: u16 = 185; + let vard_u32: u32 = 185; + let vard_u64: u64 = 185; + let vare_u8: u8 = 186; + let vare_u16: u16 = 186; + let vare_u32: u32 = 186; + let vare_u64: u64 = 186; + let varf_u8: u8 = 187; + let varf_u16: u16 = 187; + let varf_u32: u32 = 187; + let varf_u64: u64 = 187; + let varg_u8: u8 = 188; + let varg_u16: u16 = 188; + let varg_u32: u32 = 188; + let varg_u64: u64 = 188; + let varh_u8: u8 = 189; + let varh_u16: u16 = 189; + let varh_u32: u32 = 189; + let varh_u64: u64 = 189; + let vari_u8: u8 = 190; + let vari_u16: u16 = 190; + let vari_u32: u32 = 190; + let vari_u64: u64 = 190; + let varj_u8: u8 = 191; + let varj_u16: u16 = 191; + let varj_u32: u32 = 191; + let varj_u64: u64 = 191; + let vark_u8: u8 = 192; + let vark_u16: u16 = 192; + let vark_u32: u32 = 192; + let vark_u64: u64 = 192; + let varl_u8: u8 = 193; + let varl_u16: u16 = 193; + let varl_u32: u32 = 193; + let varl_u64: u64 = 193; + let varm_u8: u8 = 194; + let varm_u16: u16 = 194; + let varm_u32: u32 = 194; + let varm_u64: u64 = 194; + let varn_u8: u8 = 195; + let varn_u16: u16 = 195; + let varn_u32: u32 = 195; + let varn_u64: u64 = 195; + let varo_u8: u8 = 196; + let varo_u16: u16 = 196; + let varo_u32: u32 = 196; + let varo_u64: u64 = 196; + let varp_u8: u8 = 197; + let varp_u16: u16 = 197; + let varp_u32: u32 = 197; + let varp_u64: u64 = 197; + let varq_u8: u8 = 198; + let varq_u16: u16 = 198; + let varq_u32: u32 = 198; + let varq_u64: u64 = 198; + let varr_u8: u8 = 199; + let varr_u16: u16 = 199; + let varr_u32: u32 = 199; + let varr_u64: u64 = 199; + let vars_u8: u8 = 200; + let vars_u16: u16 = 200; + let vars_u32: u32 = 200; + let vars_u64: u64 = 200; + let vart_u8: u8 = 201; + let vart_u16: u16 = 201; + let vart_u32: u32 = 201; + let vart_u64: u64 = 201; + let varu_u8: u8 = 202; + let varu_u16: u16 = 202; + let varu_u32: u32 = 202; + let varu_u64: u64 = 202; + let varv_u8: u8 = 203; + let varv_u16: u16 = 203; + let varv_u32: u32 = 203; + let varv_u64: u64 = 203; + let varw_u8: u8 = 204; + let varw_u16: u16 = 204; + let varw_u32: u32 = 204; + let varw_u64: u64 = 204; + let varx_u8: u8 = 205; + let varx_u16: u16 = 205; + let varx_u32: u32 = 205; + let varx_u64: u64 = 205; + let vary_u8: u8 = 206; + let vary_u16: u16 = 206; + let vary_u32: u32 = 206; + let vary_u64: u64 = 206; + let varz_u8: u8 = 207; + let varz_u16: u16 = 207; + let varz_u32: u32 = 207; + let varz_u64: u64 = 207; + let vara_u8: u8 = 208; + let vara_u16: u16 = 208; + let vara_u32: u32 = 208; + let vara_u64: u64 = 208; + let varb_u8: u8 = 209; + let varb_u16: u16 = 209; + let varb_u32: u32 = 209; + let varb_u64: u64 = 209; + let varc_u8: u8 = 210; + let varc_u16: u16 = 210; + let varc_u32: u32 = 210; + let varc_u64: u64 = 210; + let vard_u8: u8 = 211; + let vard_u16: u16 = 211; + let vard_u32: u32 = 211; + let vard_u64: u64 = 211; + let vare_u8: u8 = 212; + let vare_u16: u16 = 212; + let vare_u32: u32 = 212; + let vare_u64: u64 = 212; + let varf_u8: u8 = 213; + let varf_u16: u16 = 213; + let varf_u32: u32 = 213; + let varf_u64: u64 = 213; + let varg_u8: u8 = 214; + let varg_u16: u16 = 214; + let varg_u32: u32 = 214; + let varg_u64: u64 = 214; + let varh_u8: u8 = 215; + let varh_u16: u16 = 215; + let varh_u32: u32 = 215; + let varh_u64: u64 = 215; + let vari_u8: u8 = 216; + let vari_u16: u16 = 216; + let vari_u32: u32 = 216; + let vari_u64: u64 = 216; + let varj_u8: u8 = 217; + let varj_u16: u16 = 217; + let varj_u32: u32 = 217; + let varj_u64: u64 = 217; + let vark_u8: u8 = 218; + let vark_u16: u16 = 218; + let vark_u32: u32 = 218; + let vark_u64: u64 = 218; + let varl_u8: u8 = 219; + let varl_u16: u16 = 219; + let varl_u32: u32 = 219; + let varl_u64: u64 = 219; + let varm_u8: u8 = 220; + let varm_u16: u16 = 220; + let varm_u32: u32 = 220; + let varm_u64: u64 = 220; + let varn_u8: u8 = 221; + let varn_u16: u16 = 221; + let varn_u32: u32 = 221; + let varn_u64: u64 = 221; + let varo_u8: u8 = 222; + let varo_u16: u16 = 222; + let varo_u32: u32 = 222; + let varo_u64: u64 = 222; + let varp_u8: u8 = 223; + let varp_u16: u16 = 223; + let varp_u32: u32 = 223; + let varp_u64: u64 = 223; + let varq_u8: u8 = 224; + let varq_u16: u16 = 224; + let varq_u32: u32 = 224; + let varq_u64: u64 = 224; + let varr_u8: u8 = 225; + let varr_u16: u16 = 225; + let varr_u32: u32 = 225; + let varr_u64: u64 = 225; + let vars_u8: u8 = 226; + let vars_u16: u16 = 226; + let vars_u32: u32 = 226; + let vars_u64: u64 = 226; + let vart_u8: u8 = 227; + let vart_u16: u16 = 227; + let vart_u32: u32 = 227; + let vart_u64: u64 = 227; + let varu_u8: u8 = 228; + let varu_u16: u16 = 228; + let varu_u32: u32 = 228; + let varu_u64: u64 = 228; + let varv_u8: u8 = 229; + let varv_u16: u16 = 229; + let varv_u32: u32 = 229; + let varv_u64: u64 = 229; + let varw_u8: u8 = 230; + let varw_u16: u16 = 230; + let varw_u32: u32 = 230; + let varw_u64: u64 = 230; + let varx_u8: u8 = 231; + let varx_u16: u16 = 231; + let varx_u32: u32 = 231; + let varx_u64: u64 = 231; + let vary_u8: u8 = 232; + let vary_u16: u16 = 232; + let vary_u32: u32 = 232; + let vary_u64: u64 = 232; + let varz_u8: u8 = 233; + let varz_u16: u16 = 233; + let varz_u32: u32 = 233; + let varz_u64: u64 = 233; + let vara_u8: u8 = 234; + let vara_u16: u16 = 234; + let vara_u32: u32 = 234; + let vara_u64: u64 = 234; + let varb_u8: u8 = 235; + let varb_u16: u16 = 235; + let varb_u32: u32 = 235; + let varb_u64: u64 = 235; + let varc_u8: u8 = 236; + let varc_u16: u16 = 236; + let varc_u32: u32 = 236; + let varc_u64: u64 = 236; + let vard_u8: u8 = 237; + let vard_u16: u16 = 237; + let vard_u32: u32 = 237; + let vard_u64: u64 = 237; + let vare_u8: u8 = 238; + let vare_u16: u16 = 238; + let vare_u32: u32 = 238; + let vare_u64: u64 = 238; + let varf_u8: u8 = 239; + let varf_u16: u16 = 239; + let varf_u32: u32 = 239; + let varf_u64: u64 = 239; + let varg_u8: u8 = 240; + let varg_u16: u16 = 240; + let varg_u32: u32 = 240; + let varg_u64: u64 = 240; + let varh_u8: u8 = 241; + let varh_u16: u16 = 241; + let varh_u32: u32 = 241; + let varh_u64: u64 = 241; + let vari_u8: u8 = 242; + let vari_u16: u16 = 242; + let vari_u32: u32 = 242; + let vari_u64: u64 = 242; + let varj_u8: u8 = 243; + let varj_u16: u16 = 243; + let varj_u32: u32 = 243; + let varj_u64: u64 = 243; + let vark_u8: u8 = 244; + let vark_u16: u16 = 244; + let vark_u32: u32 = 244; + let vark_u64: u64 = 244; + let varl_u8: u8 = 245; + let varl_u16: u16 = 245; + let varl_u32: u32 = 245; + let varl_u64: u64 = 245; + let varm_u8: u8 = 246; + let varm_u16: u16 = 246; + let varm_u32: u32 = 246; + let varm_u64: u64 = 246; + let varn_u8: u8 = 247; + let varn_u16: u16 = 247; + let varn_u32: u32 = 247; + let varn_u64: u64 = 247; + let varo_u8: u8 = 248; + let varo_u16: u16 = 248; + let varo_u32: u32 = 248; + let varo_u64: u64 = 248; + let varp_u8: u8 = 249; + let varp_u16: u16 = 249; + let varp_u32: u32 = 249; + let varp_u64: u64 = 249; + let varq_u8: u8 = 250; + let varq_u16: u16 = 250; + let varq_u32: u32 = 250; + let varq_u64: u64 = 250; + let varr_u8: u8 = 251; + let varr_u16: u16 = 251; + let varr_u32: u32 = 251; + let varr_u64: u64 = 251; + let vars_u8: u8 = 252; + let vars_u16: u16 = 252; + let vars_u32: u32 = 252; + let vars_u64: u64 = 252; + let vart_u8: u8 = 253; + let vart_u16: u16 = 253; + let vart_u32: u32 = 253; + let vart_u64: u64 = 253; + let varu_u8: u8 = 254; + let varu_u16: u16 = 254; + let varu_u32: u32 = 254; + let varu_u64: u64 = 254; + let varv_u8: u8 = 255; + let varv_u16: u16 = 255; + let varv_u32: u32 = 255; + let varv_u64: u64 = 255; + let varw_u8: u8 = 56; + let varw_u16: u16 = 256; + let varw_u32: u32 = 256; + let varw_u64: u64 = 256; + let varx_u8: u8 = 57; + let varx_u16: u16 = 257; + let varx_u32: u32 = 257; + let varx_u64: u64 = 257; + let vary_u8: u8 = 58; + let vary_u16: u16 = 258; + let vary_u32: u32 = 258; + let vary_u64: u64 = 258; + let varz_u8: u8 = 59; + let varz_u16: u16 = 259; + let varz_u32: u32 = 259; + let varz_u64: u64 = 259; + let vara_u8: u8 = 60; + let vara_u16: u16 = 260; + let vara_u32: u32 = 260; + let vara_u64: u64 = 260; + let varb_u8: u8 = 61; + let varb_u16: u16 = 261; + let varb_u32: u32 = 261; + let varb_u64: u64 = 261; + let varc_u8: u8 = 62; + let varc_u16: u16 = 262; + let varc_u32: u32 = 262; + let varc_u64: u64 = 262; + let vard_u8: u8 = 63; + let vard_u16: u16 = 263; + let vard_u32: u32 = 263; + let vard_u64: u64 = 263; + let vare_u8: u8 = 64; + let vare_u16: u16 = 264; + let vare_u32: u32 = 264; + let vare_u64: u64 = 264; + let varf_u8: u8 = 65; + let varf_u16: u16 = 265; + let varf_u32: u32 = 265; + let varf_u64: u64 = 265; + let varg_u8: u8 = 66; + let varg_u16: u16 = 266; + let varg_u32: u32 = 266; + let varg_u64: u64 = 266; + let varh_u8: u8 = 67; + let varh_u16: u16 = 267; + let varh_u32: u32 = 267; + let varh_u64: u64 = 267; + let vari_u8: u8 = 68; + let vari_u16: u16 = 268; + let vari_u32: u32 = 268; + let vari_u64: u64 = 268; + let varj_u8: u8 = 69; + let varj_u16: u16 = 269; + let varj_u32: u32 = 269; + let varj_u64: u64 = 269; + let vark_u8: u8 = 70; + let vark_u16: u16 = 270; + let vark_u32: u32 = 270; + let vark_u64: u64 = 270; + let varl_u8: u8 = 71; + let varl_u16: u16 = 271; + let varl_u32: u32 = 271; + let varl_u64: u64 = 271; + let varm_u8: u8 = 72; + let varm_u16: u16 = 272; + let varm_u32: u32 = 272; + let varm_u64: u64 = 272; + let varn_u8: u8 = 73; + let varn_u16: u16 = 273; + let varn_u32: u32 = 273; + let varn_u64: u64 = 273; + let varo_u8: u8 = 74; + let varo_u16: u16 = 274; + let varo_u32: u32 = 274; + let varo_u64: u64 = 274; + let varp_u8: u8 = 75; + let varp_u16: u16 = 275; + let varp_u32: u32 = 275; + let varp_u64: u64 = 275; + let varq_u8: u8 = 76; + let varq_u16: u16 = 276; + let varq_u32: u32 = 276; + let varq_u64: u64 = 276; + let varr_u8: u8 = 77; + let varr_u16: u16 = 277; + let varr_u32: u32 = 277; + let varr_u64: u64 = 277; + let vars_u8: u8 = 78; + let vars_u16: u16 = 278; + let vars_u32: u32 = 278; + let vars_u64: u64 = 278; + let vart_u8: u8 = 79; + let vart_u16: u16 = 279; + let vart_u32: u32 = 279; + let vart_u64: u64 = 279; + let varu_u8: u8 = 20; + let varu_u16: u16 = 280; + let varu_u32: u32 = 280; + let varu_u64: u64 = 280; + let varv_u8: u8 = 28; + let varv_u16: u16 = 281; + let varv_u32: u32 = 281; + let varv_u64: u64 = 281; + let varw_u8: u8 = 82; + let varw_u16: u16 = 282; + let varw_u32: u32 = 282; + let varw_u64: u64 = 282; + let varx_u8: u8 = 83; + let varx_u16: u16 = 283; + let varx_u32: u32 = 283; + let varx_u64: u64 = 283; + let vary_u8: u8 = 84; + let vary_u16: u16 = 284; + let vary_u32: u32 = 284; + let vary_u64: u64 = 284; + let varz_u8: u8 = 85; + let varz_u16: u16 = 285; + let varz_u32: u32 = 285; + let varz_u64: u64 = 285; + let vara_u8: u8 = 86; + let vara_u16: u16 = 286; + let vara_u32: u32 = 286; + let vara_u64: u64 = 286; + let varb_u8: u8 = 87; + let varb_u16: u16 = 287; + let varb_u32: u32 = 287; + let varb_u64: u64 = 287; + let varc_u8: u8 = 28; + let varc_u16: u16 = 288; + let varc_u32: u32 = 288; + let varc_u64: u64 = 288; + let vard_u8: u8 = 29; + let vard_u16: u16 = 289; + let vard_u32: u32 = 289; + let vard_u64: u64 = 289; + let vare_u8: u8 = 20; + let vare_u16: u16 = 290; + let vare_u32: u32 = 290; + let vare_u64: u64 = 290; + let varf_u8: u8 = 21; + let varf_u16: u16 = 291; + let varf_u32: u32 = 291; + let varf_u64: u64 = 291; + let varg_u8: u8 = 22; + let varg_u16: u16 = 292; + let varg_u32: u32 = 292; + let varg_u64: u64 = 292; + let varh_u8: u8 = 23; + let varh_u16: u16 = 293; + let varh_u32: u32 = 293; + let varh_u64: u64 = 293; + let vari_u8: u8 = 24; + let vari_u16: u16 = 294; + let vari_u32: u32 = 294; + let vari_u64: u64 = 294; + let varj_u8: u8 = 25; + let varj_u16: u16 = 295; + let varj_u32: u32 = 295; + let varj_u64: u64 = 295; + let vark_u8: u8 = 26; + let vark_u16: u16 = 296; + let vark_u32: u32 = 296; + let vark_u64: u64 = 296; + let varl_u8: u8 = 27; + let varl_u16: u16 = 297; + let varl_u32: u32 = 297; + let varl_u64: u64 = 297; + let varm_u8: u8 = 28; + let varm_u16: u16 = 298; + let varm_u32: u32 = 298; + let varm_u64: u64 = 298; + let varn_u8: u8 = 29; + let varn_u16: u16 = 299; + let varn_u32: u32 = 299; + let varn_u64: u64 = 299; + let varo_u8: u8 = 30; + let varo_u16: u16 = 300; + let varo_u32: u32 = 300; + let varo_u64: u64 = 300; + let a = func_struct1(Struct1 { field1: varb_u8, field2: varb_u16, field3: varb_u32, field4: varb_u64 }); + let b = func_struct2(Struct2 { field1: varc_u8, field2: varc_u16, field3: varc_u32, field4: varc_u64 }); + let c = func_struct3(Struct3 { field1: vard_u8, field2: vard_u16, field3: vard_u32, field4: vard_u64 }); + let d = func_struct4(Struct4 { field1: vare_u8, field2: vare_u16, field3: vare_u32, field4: vare_u64 }); + let e = func_struct5(Struct5 { field1: varf_u8, field2: varf_u16, field3: varf_u32, field4: varf_u64 }); + let f = func_struct6(Struct6 { field1: varg_u8, field2: varg_u16, field3: varg_u32, field4: varg_u64 }); + let g = func_struct7(Struct7 { field1: varh_u8, field2: varh_u16, field3: varh_u32, field4: varh_u64 }); + let h = func_struct8(Struct8 { field1: vari_u8, field2: vari_u16, field3: vari_u32, field4: vari_u64 }); + let i = func_struct9(Struct9 { field1: varj_u8, field2: varj_u16, field3: varj_u32, field4: varj_u64 }); + let j = Struct10 { field1: vark_u8, field2: vark_u16, field3: vark_u32, field4: vark_u64 }; + let k = Enum11::Variant1(varl_u8); + let l = func_enum12(Enum12::Variant1(varm_u8)); + let m = func_enum13(Enum13::Variant1(varn_u8)); + let n = func_enum14(Enum14::Variant1(varo_u8)); + let o = func_enum15(Enum15::Variant1(varp_u8)); + let p = func_enum16(Enum16::Variant1(varq_u8)); + let q = func_enum17(Enum17::Variant1(varr_u8)); + let r = func_enum18(Enum18::Variant1(vars_u8)); + let s = func_enum19(Enum19::Variant1(vart_u8)); + let t = func_enum20(Enum20::Variant1(varu_u8)); + let u = func21(varv_u64, varv_u64); + let v = func22(varw_u8, varw_u8); + let w = func23(varx_u16, varx_u16); + let x = func24(vary_u32, vary_u32); + let y = func25(varz_u64, varz_u64); + let z = func26(vara_u8, vara_u8); + let _ = func27(varb_u16, varb_u16); + let _ = func28(varc_u32, varc_u32); + let _ = func29(vard_u16, vard_u16); + let _ = func30(vare_u32, vare_u32); +} From d3aeea43faade540cd40327acd6c11e8560a0813 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 13:05:22 +1000 Subject: [PATCH 06/11] add Cargo.lock --- Cargo.lock | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 7d8eb6a5ca5..175d49689bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,6 +88,12 @@ dependencies = [ "libc", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "annotate-snippets" version = "0.9.1" @@ -520,6 +526,12 @@ dependencies = [ "serde", ] +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.81" @@ -551,6 +563,33 @@ dependencies = [ "winapi", ] +[[package]] +name = "ciborium" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656" + +[[package]] +name = "ciborium-ll" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "cid" version = "0.10.1" @@ -946,6 +985,42 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f" +dependencies = [ + "anes", + "cast", + "ciborium", + "clap 4.3.19", + "criterion-plot", + "is-terminal", + "itertools", + "num-traits", + "once_cell", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + [[package]] name = "critical-section" version = "1.1.1" @@ -2628,6 +2703,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "handlebars" version = "4.3.7" @@ -3882,6 +3963,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "opaque-debug" version = "0.3.0" @@ -4284,6 +4371,34 @@ dependencies = [ "time 0.3.25", ] +[[package]] +name = "plotters" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45" +dependencies = [ + "num-traits", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609" + +[[package]] +name = "plotters-svg" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab" +dependencies = [ + "plotters-backend", +] + [[package]] name = "portpicker" version = "0.1.1" @@ -5627,6 +5742,7 @@ version = "0.43.2" dependencies = [ "anyhow", "assert-json-diff", + "criterion", "dashmap", "dirs 4.0.0", "forc-pkg", @@ -6090,6 +6206,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" From 3421e4c6f2cfd4506bcef38c91306051dbcae237 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 13:09:31 +1000 Subject: [PATCH 07/11] clean up toml --- sway-lsp/tests/fixtures/benchmark/Forc.lock | 4 ++-- sway-lsp/tests/fixtures/benchmark/Forc.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sway-lsp/tests/fixtures/benchmark/Forc.lock b/sway-lsp/tests/fixtures/benchmark/Forc.lock index 46d06f591d8..f12b9b9acc2 100644 --- a/sway-lsp/tests/fixtures/benchmark/Forc.lock +++ b/sway-lsp/tests/fixtures/benchmark/Forc.lock @@ -1,10 +1,10 @@ [[package]] name = 'core' -source = 'path+from-root-B6DA1594080EA6DA' +source = 'path+from-root-5D4308F3FD2F4B3B' [[package]] name = 'std' -source = 'git+https://github.com/fuellabs/sway?tag=v0.43.2#d8cf6118405164359fdf420c95cd07342e0eca8b' +source = 'path+from-root-5D4308F3FD2F4B3B' dependencies = ['core'] [[package]] diff --git a/sway-lsp/tests/fixtures/benchmark/Forc.toml b/sway-lsp/tests/fixtures/benchmark/Forc.toml index b048b248d6b..ffc25415e49 100644 --- a/sway-lsp/tests/fixtures/benchmark/Forc.toml +++ b/sway-lsp/tests/fixtures/benchmark/Forc.toml @@ -1,8 +1,8 @@ [project] -authors = ["Joshua Batty"] +authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" name = "sway_project" -# implicit-std = false [dependencies] +std = { path = "../../../../sway-lib-std" } \ No newline at end of file From 069a5cc0bd8ff07524bfc5817b4925a143f72434 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Wed, 9 Aug 2023 13:41:11 +1000 Subject: [PATCH 08/11] clippy --- sway-lsp/src/core/session.rs | 6 ++++++ sway-lsp/src/core/token_map.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sway-lsp/src/core/session.rs b/sway-lsp/src/core/session.rs index 1cd8c1e36a8..0625c18e5ef 100644 --- a/sway-lsp/src/core/session.rs +++ b/sway-lsp/src/core/session.rs @@ -86,6 +86,12 @@ pub struct Session { pub diagnostics: Arc>, } +impl Default for Session { + fn default() -> Self { + Self::new() + } +} + impl Session { pub fn new() -> Self { Session { diff --git a/sway-lsp/src/core/token_map.rs b/sway-lsp/src/core/token_map.rs index 0c088b978d1..03e41bbc89f 100644 --- a/sway-lsp/src/core/token_map.rs +++ b/sway-lsp/src/core/token_map.rs @@ -11,7 +11,7 @@ pub use crate::core::token_map_ext::TokenMapExt; /// It stores all of the tokens that have been parsed and typechecked by the sway compiler. /// /// The TokenMap is a wrapper around a [DashMap], which is a concurrent HashMap. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct TokenMap(DashMap<(Ident, Span), Token>); impl TokenMap { From f3ed0c5fc82fa613284f3e5f3e4a3072eb4466ab Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Thu, 10 Aug 2023 11:40:20 +1000 Subject: [PATCH 09/11] add missing requests --- sway-lsp/benches/bench_main.rs | 2 +- sway-lsp/benches/lsp_benchmarks/requests.rs | 76 ++++++++++++++++++- sway-lsp/benches/lsp_benchmarks/token_map.rs | 7 +- sway-lsp/src/capabilities/code_actions/mod.rs | 8 +- sway-lsp/src/capabilities/inlay_hints.rs | 2 +- sway-lsp/src/capabilities/on_enter.rs | 2 +- sway-lsp/src/core/session.rs | 2 +- sway-lsp/src/handlers/request.rs | 12 +-- sway-lsp/tests/fixtures/benchmark/src/main.sw | 11 +-- 9 files changed, 98 insertions(+), 24 deletions(-) diff --git a/sway-lsp/benches/bench_main.rs b/sway-lsp/benches/bench_main.rs index af0e06a27b9..02795a468d0 100644 --- a/sway-lsp/benches/bench_main.rs +++ b/sway-lsp/benches/bench_main.rs @@ -2,6 +2,6 @@ mod lsp_benchmarks; use criterion::criterion_main; criterion_main! { - lsp_benchmarks::token_map::benches, + // lsp_benchmarks::token_map::benches, lsp_benchmarks::requests::benches, } diff --git a/sway-lsp/benches/lsp_benchmarks/requests.rs b/sway-lsp/benches/lsp_benchmarks/requests.rs index a53a35dd3a7..167b3e13299 100644 --- a/sway-lsp/benches/lsp_benchmarks/requests.rs +++ b/sway-lsp/benches/lsp_benchmarks/requests.rs @@ -1,11 +1,37 @@ use criterion::{black_box, criterion_group, Criterion}; -use lsp_types::Position; -use sway_lsp::{capabilities, utils::keyword_docs::KeywordDocs}; +use lsp_types::{ + CodeLens, CompletionResponse, DocumentSymbolResponse, Position, Range, + TextDocumentContentChangeEvent, TextDocumentIdentifier, +}; +use sway_lsp::{capabilities, lsp_ext::OnEnterParams, utils::keyword_docs::KeywordDocs}; fn benchmarks(c: &mut Criterion) { let (uri, session) = black_box(super::compile_test_project()); + let config = sway_lsp::config::Config::default(); let keyword_docs = KeywordDocs::new(); - let position = Position::new(1716, 24); + let position = Position::new(1717, 24); + let range = Range::new(Position::new(1628, 0), Position::new(1728, 0)); + + c.bench_function("semantic_tokens", |b| { + b.iter(|| capabilities::semantic_tokens::semantic_tokens_full(session.clone(), &uri)) + }); + + c.bench_function("document_symbol", |b| { + b.iter(|| { + session + .symbol_information(&uri) + .map(DocumentSymbolResponse::Flat) + }) + }); + + c.bench_function("completion", |b| { + let position = Position::new(1698, 28); + b.iter(|| { + session + .completion_items(&uri, position, ".") + .map(CompletionResponse::Array) + }) + }); c.bench_function("hover", |b| { b.iter(|| { @@ -21,6 +47,17 @@ fn benchmarks(c: &mut Criterion) { b.iter(|| session.token_definition_response(uri.clone(), position)) }); + c.bench_function("inlay_hints", |b| { + b.iter(|| { + capabilities::inlay_hints::inlay_hints( + session.clone(), + &uri, + &range, + &config.inlay_hints, + ) + }) + }); + c.bench_function("prepare_rename", |b| { b.iter(|| capabilities::rename::prepare_rename(session.clone(), uri.clone(), position)) }); @@ -35,10 +72,41 @@ fn benchmarks(c: &mut Criterion) { ) }) }); + + c.bench_function("code_action", |b| { + let range = Range::new(Position::new(4, 10), Position::new(4, 10)); + b.iter(|| capabilities::code_actions::code_actions(session.clone(), &range, &uri, &uri)) + }); + + c.bench_function("code_lens", |b| { + b.iter(|| { + let mut result = vec![]; + session.runnables.iter().for_each(|item| { + let runnable = item.value(); + result.push(CodeLens { + range: runnable.range(), + command: Some(runnable.command()), + data: None, + }); + }); + }) + }); + + c.bench_function("on_enter", |b| { + let params = OnEnterParams { + text_document: TextDocumentIdentifier::new(uri.clone()), + content_changes: vec![TextDocumentContentChangeEvent { + range: Some(Range::new(Position::new(3, 30), Position::new(3, 30))), + range_length: Some(0), + text: "\n".to_string(), + }], + }; + b.iter(|| capabilities::on_enter::on_enter(&config.on_enter, &session, &uri, ¶ms)) + }); } criterion_group! { name = benches; - config = Criterion::default().measurement_time(std::time::Duration::from_secs(10)); + config = Criterion::default().measurement_time(std::time::Duration::from_secs(3)); targets = benchmarks } diff --git a/sway-lsp/benches/lsp_benchmarks/token_map.rs b/sway-lsp/benches/lsp_benchmarks/token_map.rs index b021f1c49fb..755f74c162c 100644 --- a/sway-lsp/benches/lsp_benchmarks/token_map.rs +++ b/sway-lsp/benches/lsp_benchmarks/token_map.rs @@ -7,7 +7,12 @@ fn benchmarks(c: &mut Criterion) { let position = Position::new(1716, 24); c.bench_function("tokens_for_file", |b| { - b.iter(|| session.token_map().tokens_for_file(engines.se(), &uri)) + b.iter(|| { + let _: Vec<_> = session + .token_map() + .tokens_for_file(engines.se(), &uri) + .collect(); + }) }); c.bench_function("idents_at_position", |b| { diff --git a/sway-lsp/src/capabilities/code_actions/mod.rs b/sway-lsp/src/capabilities/code_actions/mod.rs index 560ef6ff301..d4c910b4c8c 100644 --- a/sway-lsp/src/capabilities/code_actions/mod.rs +++ b/sway-lsp/src/capabilities/code_actions/mod.rs @@ -17,7 +17,7 @@ use crate::core::{ pub use crate::error::DocumentError; use lsp_types::{ CodeAction as LspCodeAction, CodeActionDisabled, CodeActionKind, CodeActionOrCommand, - CodeActionResponse, Position, Range, TextDocumentIdentifier, TextEdit, Url, WorkspaceEdit, + CodeActionResponse, Position, Range, TextEdit, Url, WorkspaceEdit, }; use serde_json::Value; use std::{collections::HashMap, sync::Arc}; @@ -36,10 +36,10 @@ pub(crate) struct CodeActionContext<'a> { uri: &'a Url, } -pub(crate) fn code_actions( +pub fn code_actions( session: Arc, range: &Range, - text_document: TextDocumentIdentifier, + uri: &Url, temp_uri: &Url, ) -> Option { let engines = session.engines.read(); @@ -51,7 +51,7 @@ pub(crate) fn code_actions( engines: &engines, tokens: session.token_map(), token: &token, - uri: &text_document.uri, + uri, }; match token.typed.as_ref()? { diff --git a/sway-lsp/src/capabilities/inlay_hints.rs b/sway-lsp/src/capabilities/inlay_hints.rs index dfed67c587b..baceceb6014 100644 --- a/sway-lsp/src/capabilities/inlay_hints.rs +++ b/sway-lsp/src/capabilities/inlay_hints.rs @@ -23,7 +23,7 @@ pub struct InlayHint { pub label: String, } -pub(crate) fn inlay_hints( +pub fn inlay_hints( session: Arc, uri: &Url, range: &Range, diff --git a/sway-lsp/src/capabilities/on_enter.rs b/sway-lsp/src/capabilities/on_enter.rs index 4716d91f48f..d2c14af7bd2 100644 --- a/sway-lsp/src/capabilities/on_enter.rs +++ b/sway-lsp/src/capabilities/on_enter.rs @@ -15,7 +15,7 @@ const DOC_COMMENT_START: &str = "///"; /// If the change was an enter keypress or pasting multiple lines in a comment, it prefixes the line(s) /// with the appropriate comment start pattern (// or ///). -pub(crate) fn on_enter( +pub fn on_enter( config: &OnEnterConfig, session: &Arc, temp_uri: &Url, diff --git a/sway-lsp/src/core/session.rs b/sway-lsp/src/core/session.rs index 0625c18e5ef..246525d483a 100644 --- a/sway-lsp/src/core/session.rs +++ b/sway-lsp/src/core/session.rs @@ -204,7 +204,7 @@ impl Session { &self, uri: &Url, position: Position, - trigger_char: String, + trigger_char: &str, ) -> Option> { let shifted_position = Position { line: position.line, diff --git a/sway-lsp/src/handlers/request.rs b/sway-lsp/src/handlers/request.rs index 9d48cefa680..e18b7cfdd60 100644 --- a/sway-lsp/src/handlers/request.rs +++ b/sway-lsp/src/handlers/request.rs @@ -91,9 +91,9 @@ pub(crate) fn handle_completion( ) -> Result> { let trigger_char = params .context - .map(|ctx| ctx.trigger_character) - .unwrap_or_default() - .unwrap_or("".to_string()); + .as_ref() + .and_then(|ctx| ctx.trigger_character.as_deref()) + .unwrap_or(""); let position = params.text_document_position.position; match state .sessions @@ -229,7 +229,7 @@ pub(crate) fn handle_code_action( Ok((temp_uri, session)) => Ok(capabilities::code_actions( session, ¶ms.range, - params.text_document, + ¶ms.text_document.uri, &temp_uri, )), Err(err) => { @@ -422,14 +422,14 @@ pub(crate) fn on_enter( state: &ServerState, params: lsp_ext::OnEnterParams, ) -> Result> { - let config = state.config.read().on_enter.clone(); + let config = &state.config.read().on_enter; match state .sessions .uri_and_session_from_workspace(¶ms.text_document.uri) { Ok((uri, session)) => { // handle on_enter capabilities if they are enabled - Ok(capabilities::on_enter(&config, &session, &uri, ¶ms)) + Ok(capabilities::on_enter(config, &session, &uri, ¶ms)) } Err(err) => { tracing::error!("{}", err.to_string()); diff --git a/sway-lsp/tests/fixtures/benchmark/src/main.sw b/sway-lsp/tests/fixtures/benchmark/src/main.sw index ee70376ccb7..f2b2e7ef38c 100644 --- a/sway-lsp/tests/fixtures/benchmark/src/main.sw +++ b/sway-lsp/tests/fixtures/benchmark/src/main.sw @@ -1695,7 +1695,8 @@ fn main() { let varo_u16: u16 = 300; let varo_u32: u32 = 300; let varo_u64: u64 = 300; - let a = func_struct1(Struct1 { field1: varb_u8, field2: varb_u16, field3: varb_u32, field4: varb_u64 }); + let s1 = Struct1 { field1: varb_u8, field2: varb_u16, field3: varb_u32, field4: varb_u64 }; + let a = func_struct1(s1); let b = func_struct2(Struct2 { field1: varc_u8, field2: varc_u16, field3: varc_u32, field4: varc_u64 }); let c = func_struct3(Struct3 { field1: vard_u8, field2: vard_u16, field3: vard_u32, field4: vard_u64 }); let d = func_struct4(Struct4 { field1: vare_u8, field2: vare_u16, field3: vare_u32, field4: vare_u64 }); @@ -1721,8 +1722,8 @@ fn main() { let x = func24(vary_u32, vary_u32); let y = func25(varz_u64, varz_u64); let z = func26(vara_u8, vara_u8); - let _ = func27(varb_u16, varb_u16); - let _ = func28(varc_u32, varc_u32); - let _ = func29(vard_u16, vard_u16); - let _ = func30(vare_u32, vare_u32); + let func27 = func27(varb_u16, varb_u16); + let func28 = func28(varc_u32, varc_u32); + let func29 = func29(vard_u16, vard_u16); + let func30 = func30(vare_u32, vare_u32); } From a2a78b178f591049d799e00f83a61069b6ee15e9 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Thu, 10 Aug 2023 11:42:24 +1000 Subject: [PATCH 10/11] clippy --- sway-lsp/benches/bench_main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lsp/benches/bench_main.rs b/sway-lsp/benches/bench_main.rs index 02795a468d0..af0e06a27b9 100644 --- a/sway-lsp/benches/bench_main.rs +++ b/sway-lsp/benches/bench_main.rs @@ -2,6 +2,6 @@ mod lsp_benchmarks; use criterion::criterion_main; criterion_main! { - // lsp_benchmarks::token_map::benches, + lsp_benchmarks::token_map::benches, lsp_benchmarks::requests::benches, } From 280164045b5bcd600e661dac93b1de072af428a7 Mon Sep 17 00:00:00 2001 From: JoshuaBatty Date: Fri, 11 Aug 2023 10:46:19 +1000 Subject: [PATCH 11/11] add compile benchmark --- sway-lsp/benches/bench_main.rs | 1 + sway-lsp/benches/lsp_benchmarks/compile.rs | 15 +++++++++++++++ sway-lsp/benches/lsp_benchmarks/mod.rs | 1 + 3 files changed, 17 insertions(+) create mode 100644 sway-lsp/benches/lsp_benchmarks/compile.rs diff --git a/sway-lsp/benches/bench_main.rs b/sway-lsp/benches/bench_main.rs index af0e06a27b9..b881124ef93 100644 --- a/sway-lsp/benches/bench_main.rs +++ b/sway-lsp/benches/bench_main.rs @@ -4,4 +4,5 @@ use criterion::criterion_main; criterion_main! { lsp_benchmarks::token_map::benches, lsp_benchmarks::requests::benches, + lsp_benchmarks::compile::benches, } diff --git a/sway-lsp/benches/lsp_benchmarks/compile.rs b/sway-lsp/benches/lsp_benchmarks/compile.rs new file mode 100644 index 00000000000..f2a2216ebc3 --- /dev/null +++ b/sway-lsp/benches/lsp_benchmarks/compile.rs @@ -0,0 +1,15 @@ +use criterion::{black_box, criterion_group, Criterion}; + +fn benchmarks(c: &mut Criterion) { + c.bench_function("compile_and_traverse", |b| { + b.iter(|| { + let _ = black_box(super::compile_test_project()); + }) + }); +} + +criterion_group! { + name = benches; + config = Criterion::default().measurement_time(std::time::Duration::from_secs(10)); + targets = benchmarks +} diff --git a/sway-lsp/benches/lsp_benchmarks/mod.rs b/sway-lsp/benches/lsp_benchmarks/mod.rs index 121161a1a10..eb140de96b2 100644 --- a/sway-lsp/benches/lsp_benchmarks/mod.rs +++ b/sway-lsp/benches/lsp_benchmarks/mod.rs @@ -1,3 +1,4 @@ +pub mod compile; pub mod requests; pub mod token_map;