repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/parameter/range_step.rs
src/parameter/range_step.rs
use std::convert::TryInto; use std::ops::{Add, AddAssign, Div, Sub}; use crate::error::ParameterScanError; use crate::util::number::Number; pub trait Numeric: Add<Output = Self> + Sub<Output = Self> + Div<Output = Self> + AddAssign + PartialOrd + Copy + Clone + From<i32> + Into<Num...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/parameter/mod.rs
src/parameter/mod.rs
use crate::util::number::Number; use std::fmt::Display; pub mod range_step; pub mod tokenize; #[derive(Debug, Clone, PartialEq, Eq)] pub enum ParameterValue { Text(String), Numeric(Number), } impl Display for ParameterValue { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { le...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/parameter/tokenize.rs
src/parameter/tokenize.rs
pub fn tokenize(values: &str) -> Vec<String> { let mut tokens = vec![]; let mut buf = String::new(); let mut iter = values.chars(); while let Some(c) = iter.next() { match c { '\\' => match iter.next() { Some(c2 @ ',') | Some(c2 @ '\\') => { buf.p...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/timer/windows_timer.rs
src/timer/windows_timer.rs
#![cfg(windows)] #![warn(unsafe_op_in_unsafe_fn)] use std::{mem, os::windows::io::AsRawHandle, process, ptr}; use windows_sys::Win32::{ Foundation::{CloseHandle, HANDLE}, System::JobObjects::{ AssignProcessToJobObject, CreateJobObjectW, JobObjectBasicAccountingInformation, QueryInformationJobO...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/timer/mod.rs
src/timer/mod.rs
mod wall_clock_timer; #[cfg(windows)] mod windows_timer; #[cfg(not(windows))] mod unix_timer; #[cfg(target_os = "linux")] use nix::fcntl::{splice, SpliceFFlags}; #[cfg(target_os = "linux")] use std::fs::File; #[cfg(target_os = "linux")] use std::os::fd::AsFd; #[cfg(target_os = "windows")] use windows_sys::Win32::Sy...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/timer/wall_clock_timer.rs
src/timer/wall_clock_timer.rs
use std::time::Instant; use crate::util::units::Second; pub struct WallClockTimer { start: Instant, } impl WallClockTimer { pub fn start() -> WallClockTimer { WallClockTimer { start: Instant::now(), } } pub fn stop(&self) -> Second { let duration = self.start.elap...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/timer/unix_timer.rs
src/timer/unix_timer.rs
#![cfg(not(windows))] use std::convert::TryFrom; use std::mem; use crate::timer::CPUTimes; use crate::util::units::Second; #[derive(Debug, Copy, Clone)] pub struct CPUInterval { /// Total amount of time spent executing in user mode pub user: Second, /// Total amount of time spent executing in kernel mod...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/markup.rs
src/export/markup.rs
use crate::benchmark::relative_speed::BenchmarkResultWithRelativeSpeed; use crate::benchmark::{benchmark_result::BenchmarkResult, relative_speed}; use crate::options::SortOrder; use crate::output::format::format_duration_value; use crate::util::units::Unit; use super::Exporter; use anyhow::Result; pub enum Alignment ...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/orgmode.rs
src/export/orgmode.rs
use super::markup::Alignment; use crate::export::markup::MarkupExporter; #[derive(Default)] pub struct OrgmodeExporter {} impl MarkupExporter for OrgmodeExporter { fn table_row(&self, cells: &[&str]) -> String { format!( "| {} | {} |\n", cells.first().unwrap(), &cells...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/tests.rs
src/export/tests.rs
use super::Exporter; use crate::benchmark::benchmark_result::BenchmarkResult; use crate::export::asciidoc::AsciidocExporter; use crate::export::orgmode::OrgmodeExporter; use crate::util::units::Unit; use crate::{export::markdown::MarkdownExporter, options::SortOrder}; use std::collections::BTreeMap; fn get_output<E: E...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/asciidoc.rs
src/export/asciidoc.rs
use super::markup::Alignment; use crate::export::markup::MarkupExporter; #[derive(Default)] pub struct AsciidocExporter {} impl MarkupExporter for AsciidocExporter { fn table_header(&self, cell_aligmnents: &[Alignment]) -> String { format!( "[cols=\"{}\"]\n|===", cell_aligmnents ...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/json.rs
src/export/json.rs
use serde::*; use serde_json::to_vec_pretty; use super::Exporter; use crate::benchmark::benchmark_result::BenchmarkResult; use crate::options::SortOrder; use crate::util::units::Unit; use anyhow::Result; #[derive(Serialize, Debug)] struct HyperfineSummary<'a> { results: &'a [BenchmarkResult], } #[derive(Default...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/markdown.rs
src/export/markdown.rs
use crate::export::markup::MarkupExporter; use super::markup::Alignment; #[derive(Default)] pub struct MarkdownExporter {} impl MarkupExporter for MarkdownExporter { fn table_row(&self, cells: &[&str]) -> String { format!("| {} |\n", cells.join(" | ")) } fn table_divider(&self, cell_aligmnents: ...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/mod.rs
src/export/mod.rs
use std::fs::{File, OpenOptions}; use std::io::Write; mod asciidoc; mod csv; mod json; mod markdown; mod markup; mod orgmode; #[cfg(test)] mod tests; use self::asciidoc::AsciidocExporter; use self::csv::CsvExporter; use self::json::JsonExporter; use self::markdown::MarkdownExporter; use self::orgmode::OrgmodeExporter...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/export/csv.rs
src/export/csv.rs
use std::borrow::Cow; use csv::WriterBuilder; use super::Exporter; use crate::benchmark::benchmark_result::BenchmarkResult; use crate::options::SortOrder; use crate::util::units::Unit; use anyhow::Result; #[derive(Default)] pub struct CsvExporter {} impl Exporter for CsvExporter { fn serialize( &self, ...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/output/progress_bar.rs
src/output/progress_bar.rs
use indicatif::{ProgressBar, ProgressStyle}; use std::time::Duration; use crate::options::OutputStyleOption; #[cfg(not(windows))] const TICK_SETTINGS: (&str, u64) = ("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏ ", 80); #[cfg(windows)] const TICK_SETTINGS: (&str, u64) = (r"+-x| ", 200); /// Return a pre-configured progress bar pub fn get_progress_b...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/output/mod.rs
src/output/mod.rs
pub mod format; pub mod progress_bar; pub mod warnings;
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/output/format.rs
src/output/format.rs
use crate::util::units::{Second, Unit}; /// Format the given duration as a string. The output-unit can be enforced by setting `unit` to /// `Some(target_unit)`. If `unit` is `None`, it will be determined automatically. pub fn format_duration(duration: Second, unit: Option<Unit>) -> String { let (duration_fmt, _) =...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/src/output/warnings.rs
src/output/warnings.rs
use std::fmt; use crate::benchmark::MIN_EXECUTION_TIME; use crate::output::format::format_duration; use crate::util::units::Second; pub struct OutlierWarningOptions { pub warmup_in_use: bool, pub prepare_in_use: bool, } /// A list of all possible warnings pub enum Warnings { FastExecutionTime, NonZer...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/tests/execution_order_tests.rs
tests/execution_order_tests.rs
use std::{fs::File, io::Read, path::PathBuf}; use tempfile::{tempdir, TempDir}; mod common; use common::hyperfine; struct ExecutionOrderTest { cmd: assert_cmd::Command, expected_content: String, logfile_path: PathBuf, #[allow(dead_code)] tempdir: TempDir, } impl ExecutionOrderTest { fn new()...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/tests/integration_tests.rs
tests/integration_tests.rs
mod common; use common::hyperfine; use predicates::prelude::*; /// Platform-specific I/O utility. /// - On Unix-like systems, defaults to `cat`. /// - On Windows, uses `findstr` as an alternative. /// See: <https://superuser.com/questions/853580/real-windows-equivalent-to-cat-stdin> const STDIN_READ_COMMAND: &str =...
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
sharkdp/hyperfine
https://github.com/sharkdp/hyperfine/blob/975fe108c4ee7bd2600d10758207b44ca3dae738/tests/common.rs
tests/common.rs
use std::process::Command; use assert_cmd::cargo::CommandCargoExt; pub fn hyperfine_raw_command() -> Command { let mut cmd = Command::cargo_bin("hyperfine").unwrap(); cmd.current_dir("tests/"); cmd } pub fn hyperfine() -> assert_cmd::Command { assert_cmd::Command::from_std(hyperfine_raw_command()) }
rust
Apache-2.0
975fe108c4ee7bd2600d10758207b44ca3dae738
2026-01-04T15:36:39.863758Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/.github/workflows/scripts/check-dep-versions/src/main.rs
.github/workflows/scripts/check-dep-versions/src/main.rs
use regex::Regex; use std::collections::HashSet; // Import HashSet use std::fs; use std::process::exit; use toml::Value; // Dependency name required to use x.y.z format const REQUIRED_XYZ_DEP: &str = "fuel-core-client"; // Dependency names allowed (but not required) to use x.y.z format // Add names of common dev-depe...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/.github/workflows/scripts/check-forc-manifest-version/src/main.rs
.github/workflows/scripts/check-forc-manifest-version/src/main.rs
use std::fs; use std::process; use toml::Value; fn main() { println!("Checking that sway-lib-std version matches Cargo.toml"); let workspace_root = std::env::current_dir().expect("Failed to get current directory"); let cargo_content = fs::read_to_string(workspace_root.join("Cargo.toml")) .expect("...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/scripts/mdbook-forc-documenter/src/lib.rs
scripts/mdbook-forc-documenter/src/lib.rs
use crate::formatter::format_index_entry; use anyhow::{anyhow, bail}; use commands::{ get_contents_from_commands, get_forc_command_from_file_name, possible_forc_commands, }; use mdbook::book::{Book, BookItem, Chapter}; use mdbook::errors::{Error, Result}; use mdbook::preprocess::{Preprocessor, PreprocessorContext}...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/scripts/mdbook-forc-documenter/src/commands.rs
scripts/mdbook-forc-documenter/src/commands.rs
use crate::formatter::{format_header_line, format_line}; use anyhow::{anyhow, Result}; use std::{collections::HashMap, ffi::OsString, process}; pub fn possible_forc_commands() -> Vec<String> { let output = process::Command::new("forc") .arg("--help") .output() .expect("Failed running forc -...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/scripts/mdbook-forc-documenter/src/plugins.rs
scripts/mdbook-forc-documenter/src/plugins.rs
use anyhow::{anyhow, Result}; use std::{collections::HashSet, process}; /// Detects plugins available via `PATH`. /// /// Note that plugin discovery works reliably within the Sway CI since the installed plugins are in /// a controlled environment. Building the book locally on your own machine may create a different //...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/scripts/mdbook-forc-documenter/src/formatter.rs
scripts/mdbook-forc-documenter/src/formatter.rs
#[derive(PartialEq, Eq)] pub enum LineKind { SubHeader, Arg, Option, Subcommand, Text, } fn get_line_kind(line: &str, has_parsed_subcommand_header: bool) -> LineKind { if SUBHEADERS.contains(&line) { LineKind::SubHeader } else if is_args_line(line) { LineKind::Arg } else...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/scripts/mdbook-forc-documenter/src/bin/mdbook-forc-documenter.rs
scripts/mdbook-forc-documenter/src/bin/mdbook-forc-documenter.rs
use clap::{Arg, ArgMatches, Command}; use mdbook::errors::Error; use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; use mdbook_forc_documenter::ForcDocumenter; use semver::{Version, VersionReq}; use std::io; use std::process; pub fn make_app() -> Command { Command::new("forc-documenter") .about("A md...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/source_map.rs
sway-core/src/source_map.rs
use dirs::home_dir; use std::{ collections::BTreeMap, path::{Path, PathBuf}, }; use sway_types::{LineCol, SourceEngine}; use serde::{Deserialize, Serialize}; use sway_types::span::Span; /// Index of an interned path string #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserial...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/lib.rs
sway-core/src/lib.rs
#![recursion_limit = "256"] #[macro_use] pub mod error; #[macro_use] pub mod engine_threading; pub mod abi_generation; pub mod asm_generation; mod asm_lang; mod build_config; pub mod compiler_generated; mod concurrent_slab; mod control_flow_analysis; mod debug_generation; pub mod decl_engine; pub mod ir_generation; ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/concurrent_slab.rs
sway-core/src/concurrent_slab.rs
use parking_lot::RwLock; use std::{fmt, sync::Arc}; #[derive(Debug, Clone)] pub struct Inner<T> { pub items: Vec<Option<Arc<T>>>, pub free_list: Vec<usize>, } impl<T> Default for Inner<T> { fn default() -> Self { Self { items: Default::default(), free_list: Default::default...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/semantic_analysis.rs
sway-core/src/semantic_analysis.rs
//! Type checking for Sway. pub mod ast_node; pub(crate) mod cei_pattern_analysis; pub(crate) mod coins_analysis; mod method_lookup; mod module; pub mod namespace; mod node_dependencies; pub mod program; pub mod symbol_collection_context; pub mod symbol_resolve; pub mod symbol_resolve_context; mod type_check_analysis; ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/build_config.rs
sway-core/src/build_config.rs
use itertools::Itertools; use serde::{Deserialize, Deserializer, Serialize}; use std::{ collections::{BTreeMap, HashSet}, path::PathBuf, sync::Arc, }; use strum::{Display, EnumString}; use sway_ir::{PassManager, PrintPassesOpts, VerifyPassesOpts}; #[derive( Clone, Copy, Debug, Display, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/engine_threading.rs
sway-core/src/engine_threading.rs
use crate::{ decl_engine::{parsed_engine::ParsedDeclEngine, DeclEngine}, language::CallPath, query_engine::QueryEngine, type_system::TypeEngine, ObservabilityEngine, }; use std::{ cmp::Ordering, fmt, hash::{BuildHasher, Hash, Hasher}, sync::Arc, }; use sway_types::{SourceEngine, Span...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/compiler_generated.rs
sway-core/src/compiler_generated.rs
//! This module encapsulates generation of various elements generated internally by the compiler, //! e.g., unique names of variables in desugared code and similar. //! It also provides functions for inspecting such generated elements. /// The prefix for the compiler generated names of tuples. const TUPLE_VAR_NAME_PRE...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/error.rs
sway-core/src/error.rs
//! Tools related to handling/recovering from Sway compile errors and reporting them to the user. use crate::{language::parsed::VariableDeclaration, namespace::ModulePath, Engines, Namespace}; /// Acts as the result of parsing `Declaration`s, `Expression`s, etc. /// Some `Expression`s need to be able to create `Varia...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/marker_traits.rs
sway-core/src/marker_traits.rs
use sway_types::{Ident, SourceEngine}; use crate::{ language::{parsed::ImplSelfOrTrait, ty::TyTraitDecl, CallPathType}, namespace::{Module, TraitEntry}, }; impl TyTraitDecl { pub(crate) fn is_marker_trait(&self) -> bool { assert!( matches!(self.call_path.callpath_type, CallPathType::Fu...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/metadata.rs
sway-core/src/metadata.rs
use crate::{ decl_engine::DeclId, language::{ty::TyFunctionDecl, CallPath, Inline, Purity, Trace}, }; use sway_ir::{Context, MetadataIndex, Metadatum, Value}; use sway_types::{span::Source, Ident, SourceId, Span, Spanned}; use std::{collections::HashMap, path::PathBuf, sync::Arc}; /// IR metadata needs to be...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/obs_engine.rs
sway-core/src/obs_engine.rs
use std::fmt::{Debug, Formatter, Result}; use std::sync::Mutex; use sway_ir::Type; use crate::decl_engine::DeclRefFunction; use crate::language::parsed::MethodName; use crate::semantic_analysis::TypeCheckContext; use crate::{Engines, TypeBinding, TypeId, TypeInfo}; pub trait Observer { fn on_trace(&self, _msg: &...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation.rs
sway-core/src/ir_generation.rs
pub(crate) mod compile; pub mod const_eval; mod convert; mod function; mod lexical_map; mod purity; pub mod storage; mod types; use std::{ collections::HashMap, hash::{DefaultHasher, Hasher}, }; use sway_error::error::CompileError; use sway_features::ExperimentalFeatures; use sway_ir::{ Backtrace, Context...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/engine.rs
sway-core/src/type_system/engine.rs
use crate::{ ast_elements::type_argument::GenericTypeArgument, concurrent_slab::{ConcurrentSlab, ListDisplay}, decl_engine::*, engine_threading::*, language::{ parsed::{EnumDeclaration, StructDeclaration}, ty::{TyEnumDecl, TyExpression, TyStructDecl}, QualifiedCallPath, }...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/id.rs
sway-core/src/type_system/id.rs
#![allow(clippy::mutable_key_type)] use indexmap::IndexMap; use serde::{Deserialize, Serialize}; use sway_error::{ error::CompileError, handler::{ErrorEmitted, Handler}, }; use sway_types::{BaseIdent, Named, Span, Spanned}; use crate::{ decl_engine::{ DeclEngineGet, DeclEngineGetParsedDecl, DeclEng...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/priv_prelude.rs
sway-core/src/type_system/priv_prelude.rs
pub(super) use super::unify::unifier::Unifier; pub(crate) use super::{ ast_elements::{ binding::{TypeArgs, TypeBinding, TypeCheckTypeBinding}, create_type_id::CreateTypeId, }, info::VecSet, substitute::{ subst_map::TypeSubstMap, subst_types::HasChanges, subst_typ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/monomorphization.rs
sway-core/src/type_system/monomorphization.rs
use crate::{ decl_engine::{engine::DeclEngineGetParsedDeclId, DeclEngineInsert, MaterializeConstGenerics}, language::{ ty::{self, TyExpression}, CallPath, }, namespace::{ModulePath, ResolvedDeclaration}, semantic_analysis::type_resolve::{resolve_type, VisibilityCheck}, type_syste...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/info.rs
sway-core/src/type_system/info.rs
use crate::{ decl_engine::{parsed_id::ParsedDeclId, DeclEngine, DeclEngineGet, DeclId}, engine_threading::{ DebugWithEngines, DisplayWithEngines, Engines, EqWithEngines, GetCallPathWithEngines, HashWithEngines, OrdWithEngines, OrdWithEnginesContext, PartialEqWithEngines, PartialEqWithEng...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/mod.rs
sway-core/src/type_system/mod.rs
pub mod ast_elements; mod engine; mod id; mod info; pub(crate) mod monomorphization; mod priv_prelude; mod substitute; pub(crate) mod unify; #[allow(unused)] use std::ops::Deref; pub use substitute::subst_types::SubstTypesContext; #[cfg(test)] use crate::language::{CallPath, CallPathType}; #[cfg(test)] use crate::{l...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/type_parameter.rs
sway-core/src/type_system/ast_elements/type_parameter.rs
use crate::{ abi_generation::abi_str::AbiStrContext, decl_engine::{ parsed_id::ParsedDeclId, DeclEngineGet, DeclEngineInsert as _, DeclMapping, InterfaceItemMap, ItemMap, MaterializeConstGenerics, ParsedDeclEngineGet as _, }, engine_threading::*, has_changes, language::{ ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/mod.rs
sway-core/src/type_system/ast_elements/mod.rs
pub mod binding; pub(crate) mod create_type_id; pub(crate) mod length; pub(crate) mod trait_constraint; pub(crate) mod type_argument; pub(crate) mod type_parameter;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/binding.rs
sway-core/src/type_system/ast_elements/binding.rs
use std::collections::BTreeMap; use crate::{ decl_engine::{ parsed_id::ParsedDeclId, DeclEngineGetParsedDeclId, DeclEngineInsert, DeclId, DeclRef, }, engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext}, language::{ parsed::{FunctionDeclaration, StructDec...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/create_type_id.rs
sway-core/src/type_system/ast_elements/create_type_id.rs
use crate::{type_system::priv_prelude::*, Engines}; pub(crate) trait CreateTypeId { fn create_type_id(&self, engines: &Engines) -> TypeId; }
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/length.rs
sway-core/src/type_system/ast_elements/length.rs
use crate::{ ast_elements::type_parameter::ConstGenericExprTyDecl, decl_engine::DeclEngineGet as _, Engines, }; use super::type_parameter::ConstGenericExpr; /// Describes a fixed length for types that need it, e.g., [crate::TypeInfo::Array]. /// /// Optionally, if the length is coming from a literal in code, the ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/type_argument.rs
sway-core/src/type_system/ast_elements/type_argument.rs
use super::type_parameter::ConstGenericExpr; use crate::{ decl_engine::MaterializeConstGenerics, engine_threading::*, language::CallPathTree, type_system::priv_prelude::*, }; use serde::{Deserialize, Serialize}; use std::{ cmp::Ordering, fmt, hash::{Hash as _, Hasher}, }; use sway_types::{Span, Span...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/ast_elements/trait_constraint.rs
sway-core/src/type_system/ast_elements/trait_constraint.rs
use crate::{ engine_threading::*, language::{parsed::Supertrait, ty, CallPath, CallPathDisplayType}, semantic_analysis::{ declaration::{insert_supertraits_into_namespace, SupertraitOf}, TypeCheckContext, }, type_system::priv_prelude::*, types::{CollectTypesMetadata, CollectTypesM...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/substitute/subst_map.rs
sway-core/src/type_system/substitute/subst_map.rs
use crate::{ ast_elements::type_parameter::ConstGenericExpr, decl_engine::{DeclEngineGetParsedDeclId, DeclEngineInsert, ParsedDeclEngineInsert}, engine_threading::{ DebugWithEngines, Engines, PartialEqWithEngines, PartialEqWithEnginesContext, }, type_system::priv_prelude::*, }; use std::{col...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/substitute/subst_types.rs
sway-core/src/type_system/substitute/subst_types.rs
use crate::{engine_threading::Engines, type_system::priv_prelude::*}; use sway_error::handler::Handler; use sway_types::Ident; #[derive(Default)] pub enum HasChanges { Yes, #[default] No, } impl HasChanges { pub fn has_changes(&self) -> bool { matches!(self, HasChanges::Yes) } } impl std:...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/substitute/mod.rs
sway-core/src/type_system/substitute/mod.rs
pub(crate) mod subst_map; pub(crate) mod subst_types;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/unify/unifier.rs
sway-core/src/type_system/unify/unifier.rs
use std::fmt; use crate::{ ast_elements::{type_argument::GenericTypeArgument, type_parameter::ConstGenericExpr}, decl_engine::{DeclEngineGet, DeclId}, engine_threading::{Engines, PartialEqWithEngines, PartialEqWithEnginesContext, WithEngines}, language::ty::{TyEnumDecl, TyStructDecl}, type_system::...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/unify/mod.rs
sway-core/src/type_system/unify/mod.rs
pub(crate) mod occurs_check; pub(crate) mod unifier; pub(super) mod unify_check;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/unify/occurs_check.rs
sway-core/src/type_system/unify/occurs_check.rs
#![allow(clippy::mutable_key_type)] use crate::{engine_threading::Engines, type_system::priv_prelude::*}; /// Helper struct to perform the occurs check. /// /// --- /// /// "causes unification of a variable V and a structure S to fail if S /// contains V" /// https://en.wikipedia.org/wiki/Occurs_check /// /// "occurs ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/type_system/unify/unify_check.rs
sway-core/src/type_system/unify/unify_check.rs
use crate::{ ast_elements::type_parameter::ConstGenericExpr, engine_threading::{Engines, PartialEqWithEngines, PartialEqWithEnginesContext}, language::{ ty::{TyEnumDecl, TyStructDecl}, CallPathType, }, type_system::priv_prelude::*, }; #[derive(Debug, Clone)] enum UnifyCheckMode { ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/query_engine/mod.rs
sway-core/src/query_engine/mod.rs
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::{ collections::HashMap, ops::{Deref, DerefMut}, path::PathBuf, sync::Arc, time::SystemTime, }; use sway_error::{ error::CompileError, warning::{CompileInfo, CompileWarning}, }; use sway_types::{IdentUnique, ProgramId, Sou...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/control_flow_analysis/dead_code_analysis.rs
sway-core/src/control_flow_analysis/dead_code_analysis.rs
use super::*; use crate::{ decl_engine::*, language::{ parsed::TreeType, ty::{ self, ConfigurableDecl, ConstantDecl, FunctionDecl, ProjectionKind, StructDecl, TraitDecl, TyAstNode, TyAstNodeContent, TyDecl, TyImplItem, TypeAliasDecl, }, CallPath, CallPathT...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/control_flow_analysis/analyze_return_paths.rs
sway-core/src/control_flow_analysis/analyze_return_paths.rs
//! This is the flow graph, a graph which contains edges that represent possible steps of program //! execution. use crate::{ control_flow_analysis::*, language::{ ty::{self, TyImplItem}, CallPath, }, type_system::*, Engines, }; use petgraph::prelude::NodeIndex; use sway_error::erro...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/control_flow_analysis/mod.rs
sway-core/src/control_flow_analysis/mod.rs
//! //! This module contains all of the logic related to control flow analysis. //! //! # Synopsis of Dead-Code Analysis Algorithm //! The dead code analysis algorithm constructs a node for every declaration, expression, and //! statement. Then, from the entry points of the AST, we begin drawing edges along the control...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/control_flow_analysis/flow_graph/mod.rs
sway-core/src/control_flow_analysis/flow_graph/mod.rs
//! This is the flow graph, a graph which contains edges that represent possible steps of program //! execution. use std::{collections::HashMap, fs}; use crate::{ decl_engine::*, engine_threading::DebugWithEngines, language::ty::{self, GetDeclIdent}, transform, Engines, Ident, }; use sway_types::{spa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/control_flow_analysis/flow_graph/namespace.rs
sway-core/src/control_flow_analysis/flow_graph/namespace.rs
use super::{EntryPoint, ExitPoint}; use crate::{ language::{ parsed::TreeType, ty::{ self, TyConfigurableDecl, TyConstGenericDecl, TyConstantDecl, TyFunctionDecl, TyFunctionSig, }, CallPath, }, type_system::TypeInfo, Ident, }; use indexmap::IndexMa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/lexical_map.rs
sway-core/src/ir_generation/lexical_map.rs
// Nested mappings between symbol strings. Allows shadowing and/or nested scopes for local // symbols. // // NOTE: ALL symbols should be represented in this data structure to be sure that we // don't accidentally ignore (i.e., neglect to shadow with) a new binding. // // A further complication is although we have ente...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/convert.rs
sway-core/src/ir_generation/convert.rs
use crate::{ ir_generation::function::FnCompiler, language::Literal, metadata::MetadataManager, type_system::{TypeId, TypeInfo}, Engines, }; use super::types::{create_tagged_union_type, create_tuple_aggregate}; use sway_error::error::CompileError; use sway_ir::{module::Module, Constant, ConstantCo...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/compile.rs
sway-core/src/ir_generation/compile.rs
use crate::{ decl_engine::{DeclEngineGet, DeclId, DeclRefFunction}, ir_generation::{KeyedTyFunctionDecl, PanickingFunctionCache}, language::{ty, Visibility}, metadata::MetadataManager, namespace::ResolvedDeclaration, semantic_analysis::namespace, type_system::TypeId, types::{LogId, Messa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/function.rs
sway-core/src/ir_generation/function.rs
//! Engine for compiling a function and all of the AST nodes within. //! //! This is mostly recursively compiling expressions, as Sway is fairly heavily expression based. use super::{ convert::*, lexical_map::LexicalMap, storage::{add_to_b256, get_storage_field_path_and_field_id, get_storage_key}, type...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/storage.rs
sway-core/src/ir_generation/storage.rs
use crate::fuel_prelude::{ fuel_crypto::Hasher, fuel_tx::StorageSlot, fuel_types::{Bytes32, Bytes8}, }; use sway_ir::{ constant::{ConstantContent, ConstantValue}, context::Context, irtype::Type, Constant, }; use sway_types::u256::U256; /// Determines how values that are less then a word in ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/types.rs
sway-core/src/ir_generation/types.rs
use crate::{ ast_elements::type_argument::GenericTypeArgument, decl_engine::DeclEngine, language::ty, metadata::MetadataManager, type_system::{TypeId, TypeInfo}, Engines, TypeEngine, }; use super::convert::convert_resolved_typeid_no_span; use sway_error::error::CompileError; use sway_ir::{Cont...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/const_eval.rs
sway-core/src/ir_generation/const_eval.rs
use std::{ hash::{DefaultHasher, Hash}, io::Read, ops::{BitAnd, BitOr, BitXor, Not, Rem}, }; use crate::{ engine_threading::*, ir_generation::function::{get_encoding_representation_by_id, get_memory_id}, language::{ ty::{self, TyConstantDecl, TyIntrinsicFunctionKind}, CallPath, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/ir_generation/purity.rs
sway-core/src/ir_generation/purity.rs
use crate::{ language::{ promote_purity, Purity::{self, *}, }, metadata::MetadataManager, }; use sway_error::{error::CompileError, handler::Handler}; use sway_error::{ error::StorageAccess, warning::{CompileWarning, Warning}, }; use sway_ir::{Context, FuelVmInstruction, Function, In...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/debug_generation/dwarf.rs
sway-core/src/debug_generation/dwarf.rs
use std::fs::File; use std::os::unix::ffi::OsStringExt; use std::path::Path; use gimli::write::{ self, DebugLine, DebugLineStrOffsets, DebugStrOffsets, DwarfUnit, EndianVec, LineProgram, LineString, }; use gimli::{BigEndian, Encoding, LineEncoding}; use sway_error::error::CompileError; use sway_types::Span; u...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/debug_generation/mod.rs
sway-core/src/debug_generation/mod.rs
pub mod dwarf; pub use dwarf::*;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/mapping.rs
sway-core/src/decl_engine/mapping.rs
use std::{collections::HashSet, fmt}; use sway_error::handler::{ErrorEmitted, Handler}; use crate::{ engine_threading::DebugWithEngines, language::ty::{TyTraitInterfaceItem, TyTraitItem}, Engines, TypeId, UnifyCheck, }; use super::{AssociatedItemDeclId, InterfaceItemMap, ItemMap}; type SourceDecl = (Ass...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/ref.rs
sway-core/src/decl_engine/ref.rs
//! Represents the use of / syntactic reference to a declaration. //! //! ### Is a [DeclRef] effectively the same as a [DeclId]? //! //! A [DeclRef] is a smart wrapper around a [DeclId] and canonically represents //! the use / syntactic reference to a declaration. This does not include the //! syntactic locations for w...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/engine.rs
sway-core/src/decl_engine/engine.rs
use parking_lot::RwLock; use std::{ collections::{HashMap, HashSet, VecDeque}, fmt::Write, sync::Arc, }; use sway_types::{Named, ProgramId, SourceId, Spanned}; use crate::{ concurrent_slab::ConcurrentSlab, decl_engine::{parsed_id::ParsedDeclId, *}, engine_threading::*, language::{ ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/replace_decls.rs
sway-core/src/decl_engine/replace_decls.rs
use sway_error::handler::{ErrorEmitted, Handler}; use crate::{ engine_threading::Engines, language::ty::{self, TyDecl, TyExpression}, semantic_analysis::TypeCheckContext, }; use super::DeclMapping; pub trait ReplaceDecls { fn replace_decls_inner( &mut self, decl_mapping: &DeclMapping,...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/parsed_id.rs
sway-core/src/decl_engine/parsed_id.rs
use super::{ parsed_engine::{ParsedDeclEngine, ParsedDeclEngineGet, ParsedDeclEngineIndex}, DeclUniqueId, }; use crate::{ engine_threading::{ DebugWithEngines, EqWithEngines, HashWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext, }, Engines, }; use serde::{Deserialize, S...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/interface_decl_id.rs
sway-core/src/decl_engine/interface_decl_id.rs
use super::{parsed_engine::ParsedDeclEngineGet, parsed_id::ParsedDeclId}; use crate::{ decl_engine::*, engine_threading::{EqWithEngines, PartialEqWithEngines, PartialEqWithEnginesContext}, language::{ parsed::{AbiDeclaration, TraitDeclaration}, ty, }, }; use serde::{Deserialize, Serializ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/id.rs
sway-core/src/decl_engine/id.rs
use crate::{ decl_engine::*, engine_threading::*, language::ty::{ TyConstantDecl, TyDeclParsedType, TyEnumDecl, TyFunctionDecl, TyImplSelfOrTrait, TyStructDecl, TyTraitDecl, TyTraitFn, TyTraitType, TyTypeAliasDecl, }, type_system::*, }; use serde::{Deserialize, Serialize}; use std::{...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/mod.rs
sway-core/src/decl_engine/mod.rs
//! The [DeclEngine](engine::DeclEngine) allows the compiler to add a layer of //! separation between [AST nodes](crate::semantic_analysis::ast_node) and //! declarations. //! //! As an interface, you can think of the [DeclEngine](engine::DeclEngine) as a //! mapping from [DeclId](id::DeclId) to [DeclWrapper](wrapper::...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/parsed_engine.rs
sway-core/src/decl_engine/parsed_engine.rs
use crate::{ concurrent_slab::ConcurrentSlab, language::parsed::{ AbiDeclaration, ConfigurableDeclaration, ConstGenericDeclaration, ConstantDeclaration, EnumDeclaration, EnumVariant, FunctionDeclaration, ImplSelfOrTrait, StorageDeclaration, StructDeclaration, TraitDeclaration, TraitFn, T...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/decl_engine/associated_item_decl_id.rs
sway-core/src/decl_engine/associated_item_decl_id.rs
use sway_error::error::CompileError; use sway_types::{Named, Span, Spanned}; use crate::{ decl_engine::*, engine_threading::{DebugWithEngines, DisplayWithEngines}, language::ty::{self, TyFunctionDecl}, Engines, }; #[derive(Debug, Eq, PartialEq, Hash, Clone)] pub enum AssociatedItemDeclId { TraitFn...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/types/collect_types_metadata.rs
sway-core/src/types/collect_types_metadata.rs
//! This module handles the process of iterating through the typed AST and ensuring that all types //! are well-defined and well-formed. This process is run on the AST before we pass it into the IR, //! as the IR assumes all types are well-formed and will throw an ICE (internal compiler error) if //! that is not the ca...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/types/mod.rs
sway-core/src/types/mod.rs
mod collect_types_metadata; pub(crate) use collect_types_metadata::*;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/abi_generation/evm_abi.rs
sway-core/src/abi_generation/evm_abi.rs
use sway_types::{integer_bits::IntegerBits, Named}; use crate::{ asm_generation::EvmAbiResult, ast_elements::type_argument::GenericTypeArgument, decl_engine::DeclId, language::ty::{TyFunctionDecl, TyProgram, TyProgramKind}, Engines, TypeId, TypeInfo, }; pub fn generate_abi_program(program: &TyProg...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/abi_generation/abi_str.rs
sway-core/src/abi_generation/abi_str.rs
use crate::{ ast_elements::type_argument::GenericTypeArgument, language::CallPath, transform, Engines, TypeId, TypeInfo, }; use sway_error::handler::{ErrorEmitted, Handler}; use sway_types::{integer_bits::IntegerBits, Ident, Named}; #[derive(Clone)] pub struct AbiStrContext { pub program_name: String, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/abi_generation/mod.rs
sway-core/src/abi_generation/mod.rs
pub mod abi_str; pub mod evm_abi; pub mod fuel_abi;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/abi_generation/fuel_abi.rs
sway-core/src/abi_generation/fuel_abi.rs
use fuel_abi_types::abi::program::{ self as program_abi, ConcreteTypeId, ErrorDetails, ErrorPosition, MetadataTypeId, PanickingCall, TypeConcreteDeclaration, }; use sha2::{Digest, Sha256}; use std::collections::{BTreeMap, HashMap, HashSet}; use sway_error::{ error::CompileError, handler::{ErrorEmitted, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/transform/attribute.rs
sway-core/src/transform/attribute.rs
//! Each item may have a list of attributes, each with a name and a list of zero or more args. //! Attributes may be specified more than once in which case we use the union of their args. //! //! E.g., //! //! ```ignore //! #[foo(bar)] //! #[foo(baz, xyzzy)] //! ``` //! //! is essentially equivalent to //! //! ```ignor...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/transform/mod.rs
sway-core/src/transform/mod.rs
mod attribute; pub(crate) mod to_parsed_lang; pub use attribute::*;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs
sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs
use crate::{ ast_elements::type_parameter::ConstGenericParameter, attr_decls_to_attributes, compiler_generated::{ generate_destructured_struct_var_name, generate_matched_value_var_name, generate_tuple_var_name, }, decl_engine::{parsed_engine::ParsedDeclEngineInsert, parsed_id::Parsed...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/transform/to_parsed_lang/mod.rs
sway-core/src/transform/to_parsed_lang/mod.rs
mod context; mod convert_parse_tree; pub(crate) use context::*; pub(crate) use convert_parse_tree::*;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/transform/to_parsed_lang/context.rs
sway-core/src/transform/to_parsed_lang/context.rs
use sway_features::ExperimentalFeatures; use crate::{ build_config::DbgGeneration, language::parsed::{Declaration, TreeType}, BuildTarget, }; pub struct Context { pub experimental: ExperimentalFeatures, /// Indicates whether the module being parsed has a `configurable` block. module_has_confi...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/asm_lang/virtual_ops.rs
sway-core/src/asm_lang/virtual_ops.rs
//! This module contains abstracted versions of bytecode primitives that the compiler uses to //! ensure correctness and safety. //! //! The immediate types are used to safely construct numbers that are within their bounds, and the //! ops are clones of the actual opcodes, but with the safe primitives as arguments. us...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-core/src/asm_lang/virtual_immediate.rs
sway-core/src/asm_lang/virtual_immediate.rs
use crate::asm_generation::fuel::compiler_constants; use fuel_vm::fuel_asm::Imm18; use sway_error::error::CompileError; use sway_types::span::Span; use std::convert::TryInto; use std::fmt; #[repr(u8)] pub enum WideOperations { Add = 0, Sub = 1, Not = 2, Or = 3, Xor = 4, And = 5, Lsh = 6, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false