Full Code of Kobzol/cargo-remark for AI

main 3f45243c77b8 cached
39 files
13.9 MB
748.4k tokens
150 symbols
1 requests
Download .txt
Showing preview only (2,993K chars total). Download the full file or copy to clipboard to get everything.
Repository: Kobzol/cargo-remark
Branch: main
Commit: 3f45243c77b8
Files: 39
Total size: 13.9 MB

Directory structure:
gitextract_4uul3359/

├── .github/
│   └── workflows/
│       └── check.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── LICENSE
├── README.md
├── src/
│   ├── bin/
│   │   └── analyze-remarks.rs
│   ├── cargo/
│   │   ├── mod.rs
│   │   └── version.rs
│   ├── lib.rs
│   ├── main.rs
│   ├── remark/
│   │   ├── mod.rs
│   │   └── parse.rs
│   ├── render.rs
│   └── utils/
│       ├── callback.rs
│       ├── cli.rs
│       ├── data_structures.rs
│       ├── io.rs
│       ├── mod.rs
│       └── timing.rs
├── templates/
│   ├── index.jinja
│   ├── layout.html
│   ├── menu.html
│   ├── remark-list.jinja
│   └── source-file.jinja
└── tests/
    ├── data/
    │   ├── remarks-1/
    │   │   ├── 37v4yjwjhlguzgkm.codegen.opt.yaml
    │   │   ├── 37v4yjwjhlguzgkm.opt.opt.yaml
    │   │   ├── remarks.67ea4a01cbc73fb0-cgu.0.codegen.opt.yaml
    │   │   └── remarks.67ea4a01cbc73fb0-cgu.0.opt.opt.yaml
    │   └── remarks-similarity-join/
    │       ├── src/
    │       │   ├── common.rs
    │       │   ├── main.rs
    │       │   ├── record.rs
    │       │   └── util.rs
    │       └── yaml/
    │           ├── similarity_join.548e4531baa98255-cgu.0.codegen.opt.yaml
    │           └── similarity_join.548e4531baa98255-cgu.0.opt.opt.yaml
    └── integration/
        ├── analyze.rs
        ├── build.rs
        ├── main.rs
        └── utils/
            └── mod.rs

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/check.yml
================================================
## Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md
name: Check

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  test:
    strategy:
      matrix:
        os: [ ubuntu-latest, windows-latest ]
    name: Test
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Install nightly toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly
          override: true
          components: clippy, rustfmt

      - uses: Swatinem/rust-cache@v2

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --all --all-targets

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test

      - name: Lint
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all -- -D warnings

      - name: Check Rust formatting
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check


================================================
FILE: .gitignore
================================================
/target


================================================
FILE: CHANGELOG.md
================================================
# 0.1.2 (28. 9. 2023)
## Fixes:
- Fix parsing of the `--filter` CLI parameter (https://github.com/Kobzol/cargo-remark/issues/11)
  (by [@joseluis](https://github.com/joseluis)).
- Fix normalization of source file paths on Windows (https://github.com/Kobzol/cargo-remark/issues/6).
- Fix missing images in remark table header (https://github.com/Kobzol/cargo-remark/issues/9).

# 0.1.1 (16. 8. 2023)
## Fixes
- Fix links in remark message inside source file pages.

# 0.1.0 (12. 8. 2023)
Initial version


================================================
FILE: Cargo.toml
================================================
[package]
name = "cargo-remark"
version = "0.1.2"
edition = "2021"
#rust-version = "1.72.0"

description = "Cargo subcommand for displaying LLVM optimization remarks from compiling Rust programs."
repository = "https://github.com/kobzol/cargo-remark"
authors = ["Jakub Beránek <berykubik@gmail.com>"]
keywords = [
    "llvm",
    "optimization",
    "remark",
    "cargo",
]
categories = ["development-tools::cargo-plugins"]

readme = "README.md"
license = "MIT"
include = [
    "src/**/*.rs",
    "templates",
    "Cargo.toml",
    "README.md"
]

[dependencies]
# Serialization
serde = { version = "1", features = ["derive", "rc"] }
serde_yaml = "0.9"
serde_json = "1"

# Data structures
hashbrown = { version = "0.16.0", features = ["rayon", "serde"] }
fxhash = "0.2"

# Error handling
anyhow = "1"

# Logging
log = "0.4"
env_logger = "0.10"

# Templates
askama = { version = "0.12", features = ["serde-json"] }
rust-embed = "6.6"
html-escape = "0.2"

# CLI
clap = { version = "4.3", features = ["derive"] }
indicatif = "0.17"
colored = "2.0.0"
opener = "0.6"

rustc-demangle = "0.1"
regex = "1.9"
rayon = "1.7"
cargo_metadata = "0.15"

mimalloc = { version = "0.1", default-features = false, optional = true }

[dev-dependencies]
insta = "1.29"
tempfile = "3.5"

[features]
default = ["mimalloc"]


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2023-present, Jakub Beránek

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: README.md
================================================
# `cargo-remark` [![Build Status]][actions] [![Latest Version]][crates.io]

[Build Status]: https://github.com/kobzol/cargo-remark/actions/workflows/check.yml/badge.svg
[actions]: https://github.com/kobzol/cargo-remark/actions?query=branch%3Amain
[Latest Version]: https://img.shields.io/crates/v/cargo-remark.svg
[crates.io]: https://crates.io/crates/cargo-remark

**Cargo subcommand that makes it possible to view LLVM [optimization remarks](https://llvm.org/docs/Remarks.html)
generated during the compilation of your crate.**

These remarks can tell you where and why has LLVM failed to apply certain optimizations. In certain cases[^1], you can use
this knowledge to change your code so that it optimizes better. In the future, I hope that `rustc` will be able to emit
its own, Rust-specific (MIR?) optimization remarks, but this is just an idea at this point.

[^1]: Currently, probably only if you are a LLVM expert.

`cargo remark` compiles your crate, generates LLVM remarks, and then parses them and visualizes them in a simple website.
It is parallelized, which is important for large programs, because there can be a lot of remarks and since they are in 
YAML, their parsing is not very fast.

**Contributions are welcome!**

# Generated output example
![Screenshot of a set of visualized remarks on top of Rust source code](docs/remarks.png)

# Installation
```bash
$ cargo install cargo-remark
```

Note that `rustc` has [gained](https://github.com/rust-lang/rust/pull/113040) the ability to output LLVM optimization
remarks in the YAML format on 2. 7. 2023, and it is currently unstable. Therefore, you will need a recent nightly
version[^2] of the compiler to generate LLVM remarks.
```bash
$ rustup update nightly
```

[^2]: At least `nightly-2023-07-03-...`.

# Usage
`rustc` can generate LLVM remarks using the (currently unstable) `-Zremark-dir` flag, which is used internally by this
crate. To generate remarks from your crate, use the following command:
```bash
$ cargo remark build
```

After the build finishes, the remarks will be located in `target/remarks/yaml`, and the rendered website will be located
in `target/remarks/web`. You can open the website by pointing your web browser to `target/remarks/web/index.html` file,
or by using the `--open` flag.

This command will automatically build your crate with optimizations, so you don't have to pass the `--release` flag.
Currently, only missed optimization remarks will be visualized. `Analysis` and `Passed` remarks are ignored.

### CLI parameters
| **Flag**     | **Default**                                     | **Description**                                                   |
|--------------|-------------------------------------------------|-------------------------------------------------------------------|
| `--open`     | (unset)                                         | Open the generated website with the default browser.              |
| `--external` | (unset)                                         | Visualize remarks from external crates (dependencies) and stdlib. |
| `--filter`   | `FastISelFailure,NeverInline,SpillReloadCopies` | Comma separated list of remark passes that should be ignored.     |

### Features
There is currently a single feature `mimalloc`, which is enabled by default, and which enables the use of the
[mimalloc](https://docs.rs/mimalloc/latest/mimalloc/) allocator. To disable the feature, compile (or install) the crate
with `--no-default-features`.

## Rendering remarks from a directory
If you have a directory with YAML remarks on disk, and you just want to visualize them without invoking Cargo, you can
use the `analyze-remarks` binary, which comes with this crate.

```bash
$ analyze-remarks <yaml-dir> --source-dir <crate root>
```

When you use this tool, you need to manually pass the root source directory from where the remarks were generated
(with `cargo remark`, it is automatically inferred).

You could even use this binary to render remarks generated from C/C++ programs. One advantage of that is that `analyze-remarks`
will probably be much faster than [existing](https://github.com/OfekShilon/optview2) C/C++ remark tools, which are written
in Python.

## Usage with PGO
If you compile your crate with [Profile-guided optimization](https://doc.rust-lang.org/rustc/profile-guided-optimization.html)
(PGO), the generated remarks will contain "hotness", a measure of how important is each missed optimization remark. This
can help with prioritizing which remarks should be resolved first.

You can combine `cargo remark` with the [`cargo-pgo`](https://github.com/Kobzol/cargo-pgo) command to generate remarks
from a PGO optimized build:
```bash
# Compile with PGO instrumentation
$ cargo pgo build

# Gather PGO profiles
$ ./target/release/<target>/<binary> <workload>

# Compile with PGO optimizations and generate remarks
$ cargo remark wrap -- pgo optimize
```

# Related work
This crate, and especially the generated website was heavily inspired by [optview2](https://github.com/OfekShilon/optview2),
a tool for visualizing LLVM optimization remarks generated from C and C++ programs.

# License
[MIT](LICENSE)


================================================
FILE: src/bin/analyze-remarks.rs
================================================
use cargo_remark::remark::{load_remarks_from_dir, RemarkLoadOptions};
use cargo_remark::render::render_remarks;
use cargo_remark::utils::callback::ProgressBarCallback;
use cargo_remark::utils::open_result;
use cargo_remark::utils::timing::time_block_print;
use cargo_remark::RustcSourceRoot;
use clap::Parser;
use env_logger::Env;
use std::path::PathBuf;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

/// Analyze a directory containing YAML files with LLVM optimization remarks
#[derive(clap::Parser, Debug)]
struct Args {
    /// Directory containing remark files in YAML format.
    /// They have to end with the `.opt.yaml` extension.
    #[arg()]
    remark_dir: PathBuf,

    /// Root directory of source (crate) from which the remarks were generated.
    #[arg(long)]
    source_dir: PathBuf,

    /// Output directory into which a HTML website with remark information will be generated.
    #[arg(long, default_value = "out")]
    output_dir: PathBuf,

    /// Load remarks from external code (i.e. crate dependencies).
    /// Note that this may produce a large amount of data!
    #[arg(long)]
    external: bool,

    /// Sysroot directory of Rust toolchain which generated the remarks.
    /// Used to resolve standard library sources.
    /// Can be found with `rustc --print=sysroot`.
    #[arg(long)]
    sysroot: Option<PathBuf>,

    /// Optimization remark kinds that should be ignored.
    #[arg(
        long = "filter",
        value_delimiter = ',',
        default_values = cargo_remark::DEFAULT_KIND_FILTER
    )]
    filter_kind: Vec<String>,

    /// Open the generated website after the build finishes.
    #[arg(long)]
    open: bool,
}

fn analyze(args: Args) -> anyhow::Result<()> {
    let Args {
        remark_dir,
        source_dir,
        output_dir,
        external,
        sysroot,
        filter_kind,
        open,
    } = args;

    let rustc_source_root = sysroot
        .map(|sysroot| RustcSourceRoot::from_sysroot(sysroot).expect("Cannot find Rust sources"));

    let remarks = time_block_print("Remark loading", || {
        load_remarks_from_dir(
            remark_dir,
            RemarkLoadOptions {
                external,
                source_dir: source_dir.clone(),
                filter_kind,
                rustc_source_root,
            },
            Some(&ProgressBarCallback::default()),
        )
    })?;
    time_block_print("Render", || {
        render_remarks(
            remarks,
            &source_dir,
            &output_dir,
            Some(&ProgressBarCallback::default()),
        )
    })?;
    open_result(&output_dir, open)?;

    Ok(())
}

fn main() -> anyhow::Result<()> {
    env_logger::Builder::from_env(Env::default().default_filter_or("cargo_remark=info")).init();

    let args = Args::parse();
    analyze(args)?;
    Ok(())
}


================================================
FILE: src/cargo/mod.rs
================================================
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

use anyhow::Context;

use cargo_remark::utils::cli::cli_format_path;
use cargo_remark::utils::io::ensure_directory;
use cargo_remark::RustcSourceRoot;

pub mod version;

pub enum CargoSubcommand {
    Build,
    Wrap,
}

pub struct BuildOutput {
    pub web_dir: PathBuf,
    pub source_dir: PathBuf,
    pub yaml_dir: PathBuf,
}

pub fn run_cargo(subcmd: CargoSubcommand, cargo_args: Vec<String>) -> anyhow::Result<BuildOutput> {
    let ctx = get_cargo_ctx()?;
    let remark_dir = ctx.get_target_directory(Path::new("remarks"))?;

    let yaml_dir = ensure_directory(&remark_dir.join("yaml"))?;

    log::info!(
        "Optimization remarks will be stored into {}.",
        cli_format_path(&yaml_dir)
    );

    let mut cmd = match subcmd {
        CargoSubcommand::Build => {
            let cargo_args = parse_cargo_args(cargo_args);
            let mut cargo = Command::new("cargo");
            cargo
                .arg("build")
                .arg("--release")
                .stdin(Stdio::null())
                .args(cargo_args.filtered);
            cargo
        }
        CargoSubcommand::Wrap => {
            if cargo_args.is_empty() {
                return Err(anyhow::anyhow!("You have to enter a command after `--` that will be executed when using `wrap`."));
            };

            let mut cmd = Command::new("cargo");
            cmd.args(&cargo_args).stdin(Stdio::null());
            cmd
        }
    };

    // Use CARGO_ENCODED_RUSTFLAGS to make sure that paths with spaces work.
    let flags = format!(
        "-Cremark=all\u{001f}-Zremark-dir={}\u{001f}-Cdebuginfo=1",
        yaml_dir.display()
    );
    set_cargo_env(&mut cmd, &flags);

    let status = cmd
        .spawn()
        .map_err(|error| anyhow::anyhow!("Cannot start cargo: {error:?}"))?
        .wait()
        .map_err(|error| anyhow::anyhow!("Cargo failed: {error:?}"))?;
    if !status.success() {
        return Err(anyhow::anyhow!(
            "Cargo build failed: exit code {}",
            status.code().unwrap_or(1)
        ));
    }

    log::info!("Optimization remarks sucessfully generated");

    let web_dir = ensure_directory(&remark_dir.join("web"))?;
    Ok(BuildOutput {
        web_dir,
        source_dir: ctx.root_directory,
        yaml_dir,
    })
}

pub fn get_rustc_source_root() -> anyhow::Result<RustcSourceRoot> {
    let output = Command::new("rustc")
        .arg("--print")
        .arg("sysroot")
        .output()
        .context("Cannot get sysroot from `rustc`")?;
    let sysroot = PathBuf::from(String::from_utf8_lossy(&output.stdout).trim());
    RustcSourceRoot::from_sysroot(sysroot)
}

fn set_cargo_env(command: &mut Command, flags: &str) {
    let mut rustflags = std::env::var("CARGO_ENCODED_RUSTFLAGS").unwrap_or_default();
    if !rustflags.is_empty() {
        rustflags.push('\u{001f}');
    }
    rustflags.push_str(flags);

    command.env("CARGO_ENCODED_RUSTFLAGS", rustflags);
}

#[derive(Debug, Default)]
struct CargoArgs {
    filtered: Vec<String>,
}

fn parse_cargo_args(cargo_args: Vec<String>) -> CargoArgs {
    let mut args = CargoArgs::default();

    for arg in cargo_args {
        match arg.as_str() {
            // Skip `--release`, we will pass it by ourselves.
            "--release" => {
                log::warn!("Do not pass `--release` manually, it will be added automatically by `cargo-remark`");
            }
            _ => args.filtered.push(arg),
        }
    }
    args
}

struct CargoContext {
    target_directory: PathBuf,
    root_directory: PathBuf,
}

impl CargoContext {
    fn get_target_directory(&self, path: &Path) -> anyhow::Result<PathBuf> {
        let directory = self.target_directory.join(path);
        ensure_directory(&directory)?;
        Ok(directory)
    }
}

/// Finds Cargo metadata from the current directory.
fn get_cargo_ctx() -> anyhow::Result<CargoContext> {
    let cmd = cargo_metadata::MetadataCommand::new();
    let metadata = cmd
        .exec()
        .map_err(|error| anyhow::anyhow!("Cannot get cargo metadata: {:?}", error))?;
    Ok(CargoContext {
        target_directory: metadata.target_directory.into_std_path_buf(),
        root_directory: metadata.workspace_root.into_std_path_buf(),
    })
}


================================================
FILE: src/cargo/version.rs
================================================
use std::process::Command;

/// Returns true if the currently used rustc supports `-Zremark-dir`.
pub fn check_remark_dir_support() -> anyhow::Result<bool> {
    let output = Command::new("rustc").arg("-Z").arg("help").output()?;
    if !output.status.success() {
        return Err(anyhow::anyhow!(
            "Failed to execute rustc -Z help. You must use a nightly compiler."
        ));
    }

    let options = String::from_utf8_lossy(&output.stdout);
    for line in options.lines() {
        let items: Vec<&str> = line.split_whitespace().take(2).map(|v| v.trim()).collect();
        if items.len() != 2 || items[0] != "-Z" {
            continue;
        }
        if items[1] == "remark-dir=val" {
            return Ok(true);
        }
    }

    Ok(false)
}


================================================
FILE: src/lib.rs
================================================
use std::path::PathBuf;

pub mod remark;
pub mod render;
pub mod utils;

pub const DEFAULT_KIND_FILTER: &[&str] = &["FastISelFailure", "NeverInline", "SpillReloadCopies"];

/// Directory containing Rust sources
pub struct RustcSourceRoot(pub PathBuf);

impl RustcSourceRoot {
    pub fn from_sysroot(path: PathBuf) -> anyhow::Result<Self> {
        let src_dir = path.join("lib").join("rustlib").join("src").join("rust");
        if src_dir.is_dir() {
            Ok(Self(src_dir))
        } else {
            Err(anyhow::anyhow!("Path {} does not exist", src_dir.display()))
        }
    }
}


================================================
FILE: src/main.rs
================================================
mod cargo;

use cargo::version::check_remark_dir_support;
use cargo::{get_rustc_source_root, run_cargo, CargoSubcommand};
use cargo_remark::remark::{load_remarks_from_dir, RemarkLoadOptions};
use cargo_remark::render::render_remarks;
use cargo_remark::utils::callback::ProgressBarCallback;
use cargo_remark::utils::cli::cli_format_path;
use cargo_remark::utils::open_result;
use cargo_remark::utils::timing::time_block_log_info;
use clap::Parser;
use env_logger::Env;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[derive(clap::Parser, Debug)]
#[clap(author, version, about)]
#[clap(bin_name("cargo"))]
#[clap(disable_help_subcommand(true))]
enum Args {
    #[clap(subcommand)]
    #[clap(author, version, about)]
    Remark(Subcommand),
}

#[derive(clap::Subcommand, Debug)]
enum Subcommand {
    /// Build a crate with optimizations, generate optimization remarks and render a website
    /// with remark summary.
    Build(SharedArgs),
    /// Wrap an arbitrary cargo command, while configuring it to generate remarks.
    Wrap(SharedArgs),
}

#[derive(clap::Parser, Debug)]
#[clap(trailing_var_arg = true)]
struct SharedArgs {
    /// Open the generated website after the build finishes.
    #[arg(long)]
    open: bool,

    /// Load remarks from external code (i.e. crate dependencies).
    /// Note that this may produce a large amount of data!
    #[arg(long)]
    external: bool,

    /// Optimization remark kinds that should be ignored.
    #[arg(
        long = "filter",
        value_delimiter = ',',
        default_values = cargo_remark::DEFAULT_KIND_FILTER
    )]
    filter_kind: Vec<String>,

    /// Additional arguments that will be passed to Cargo.
    cargo_args: Vec<String>,
}

fn generate_remarks(subcmd: CargoSubcommand, args: SharedArgs) -> anyhow::Result<()> {
    let SharedArgs {
        open,
        external,
        filter_kind,
        cargo_args,
    } = args;
    if !check_remark_dir_support()? {
        return Err(anyhow::anyhow!(
            "Your version of rustc does not support `-Zremark-dir`. Please use a nightly version newer than 4. 7. 2023."
        ));
    }
    let output = run_cargo(subcmd, cargo_args)?;

    let rustc_source_root = match get_rustc_source_root() {
        Ok(root) => Some(root),
        Err(error) => {
            log::warn!("Cannot find rustc source root: {error:?}");
            None
        }
    };

    let remarks = time_block_log_info("Remark loading", || {
        load_remarks_from_dir(
            output.yaml_dir,
            RemarkLoadOptions {
                external,
                source_dir: output.source_dir.clone(),
                filter_kind,
                rustc_source_root,
            },
            Some(&ProgressBarCallback::default()),
        )
    })?;
    time_block_log_info("Rendering", || {
        render_remarks(
            remarks,
            &output.source_dir,
            &output.web_dir,
            Some(&ProgressBarCallback::default()),
        )
    })?;

    log::info!("Website built into {}.", cli_format_path(&output.web_dir));

    open_result(&output.web_dir, open)?;
    Ok(())
}

fn main() -> anyhow::Result<()> {
    env_logger::Builder::from_env(Env::default().default_filter_or("cargo_remark=info")).init();

    let args = Args::parse();

    match args {
        Args::Remark(args) => match args {
            Subcommand::Build(args) => generate_remarks(CargoSubcommand::Build, args),
            Subcommand::Wrap(args) => generate_remarks(CargoSubcommand::Wrap, args),
        },
    }
}


================================================
FILE: src/remark/mod.rs
================================================
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::fs::File;
use std::hash::Hash;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::sync::OnceLock;

use anyhow::Context;
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use regex::Regex;
use serde::Deserialize;
use serde_yaml::Value;

use crate::remark::parse::{
    AnalysisRemark, MissedRemark, RemarkArg, RemarkArgCallee, RemarkArgCaller,
};
use crate::utils::callback::LoadCallback;
use crate::utils::timing::time_block_log_debug;
use crate::RustcSourceRoot;

mod parse;

/// We expect that the remark YAML files will have this extension.
const EXPECTED_EXTENSION: &str = ".opt.yaml";

pub type Line = u32;
pub type Column = u32;

#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Location {
    pub file: String,
    pub line: Line,
    pub column: Column,
}

#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Function {
    pub name: String,
    pub location: Option<Location>,
}

#[derive(Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum MessagePart {
    String(String),
    AnnotatedString { message: String, location: Location },
}

#[derive(Debug)]
pub struct Remark {
    pub pass: String,
    pub name: String,
    pub function: Function,
    pub message: Vec<MessagePart>,
    pub hotness: Option<i32>,
}

#[derive(Default)]
pub struct RemarkLoadOptions {
    /// Load remarks from external crates
    pub external: bool,
    /// Source directory
    pub source_dir: PathBuf,
    /// Remark kinds that should be ignored
    pub filter_kind: Vec<String>,
    /// Root path of rustc toolchain sources
    pub rustc_source_root: Option<RustcSourceRoot>,
}

pub fn load_remarks_from_file<P: AsRef<Path>>(
    path: P,
    options: &RemarkLoadOptions,
) -> anyhow::Result<Vec<Remark>> {
    let path = path.as_ref();

    let file =
        File::open(path).with_context(|| format!("Cannot open remark file {}", path.display()))?;
    log::debug!("Parsing {}", path.display());

    if file.metadata()?.len() == 0 {
        log::debug!("File is empty");
        return Ok(vec![]);
    }

    let reader = BufReader::new(file);

    let remarks = time_block_log_debug("Parsed remark file", || parse_remarks(reader, options));
    Ok(remarks)
}

fn parse_remarks<R: std::io::Read>(reader: R, options: &RemarkLoadOptions) -> Vec<Remark> {
    let mut remarks = Vec::new();
    let mut analysis_remarks = Vec::new();
    for document in serde_yaml::Deserializer::from_reader(reader) {
        match parse::Remark::deserialize(document) {
            Ok(remark) => {
                // TODO: optimize (intern)
                match remark {
                    parse::Remark::Missed(remark) => {
                        let MissedRemark {
                            pass,
                            name,
                            debug_loc,
                            function,
                            args,
                            hotness,
                        } = remark;

                        if let Some(location) = debug_loc {
                            if !options.external {
                                if location.file.starts_with('/') {
                                    continue;
                                }
                                if !options.source_dir.join(location.file.as_ref()).is_file() {
                                    continue;
                                }
                            }
                            if options
                                .filter_kind
                                .iter()
                                .any(|filter| filter == name.as_ref())
                            {
                                continue;
                            }

                            let remark = Remark {
                                pass: pass.to_string(),
                                name: name.to_string(),
                                function: Function {
                                    name: demangle(&function),
                                    location: Some(parse_debug_loc(options, location)),
                                },
                                message: construct_message(options, args),
                                hotness,
                            };
                            remarks.push(remark);
                        }
                    }
                    parse::Remark::Analysis(remark) => {
                        let AnalysisRemark {
                            pass,
                            name,
                            debug_loc,
                            function,
                            args,
                            hotness,
                        } = remark;

                        // Only look at loop vectorize analysis for now to find out possible reasons why loops didn't vectorize
                        if pass != "loop-vectorize" {
                            continue;
                        }

                        if let Some(location) = debug_loc {
                            if !options.external {
                                if location.file.starts_with('/') {
                                    continue;
                                }
                                if !options.source_dir.join(location.file.as_ref()).is_file() {
                                    continue;
                                }
                            }

                            if options
                                .filter_kind
                                .iter()
                                .any(|filter| filter == name.as_ref())
                            {
                                continue;
                            }

                            let remark = Remark {
                                pass: pass.to_string(),
                                name: name.to_string(),
                                function: Function {
                                    name: demangle(&function),
                                    location: Some(parse_debug_loc(options, location)),
                                },
                                message: construct_message(options, args),
                                hotness,
                            };
                            analysis_remarks.push(remark);
                        }
                    }

                    parse::Remark::Passed {} => {}
                }
            }
            Err(error) => {
                log::debug!("Error while deserializing remark: {error:?}");
            }
        }
    }

    remarks = append_vectorization_analysis_to_remarks(remarks, analysis_remarks);
    remarks
}

fn append_vectorization_analysis_to_remarks(
    remarks: Vec<Remark>,
    analysis: Vec<Remark>,
) -> Vec<Remark> {
    // gets the reason why loop wasn't vectorized from analysis remarks,
    // then appends the analysis remarks to the missed vectorization remark
    // this does edit the original remark
    let mut remark_vec: Vec<Remark> = remarks.into_iter().collect();

    // get missed loop vectorizations
    let missed_vectorization = remark_vec.iter_mut().filter(|remark| {
        remark.pass == "loop-vectorize"
            && remark.message.first()
                == Some(&MessagePart::String("loop not vectorized".to_string()))
    });

    for missed_remark in missed_vectorization {
        // Find analysis that points to the same function and location as the missed remark
        // then collect the analysis reasons for the vectorization failure
        let mut vectorize_miss_reasons: Vec<&str> = analysis
            .iter()
            .filter_map(|remark| {
                // todo: if-let chain if in Rust 2024
                if remark.function.location == missed_remark.function.location {
                    if let Some(MessagePart::String(str)) = &remark.message.first() {
                        // returns None if the string doesn't have the wanted prefix
                        str.strip_prefix("loop not vectorized: ")
                    } else {
                        None
                    }
                } else {
                    None
                }
            })
            .collect();

        vectorize_miss_reasons.sort(); // sort for consistency
        vectorize_miss_reasons.dedup(); // dedup just in case

        // append the analysis reasons to the original vectorization failure message
        if let Some(MessagePart::String(message)) = missed_remark.message.first_mut() {
            *message = format!(
                "{message}\n\npossible reasons:\n{}",
                vectorize_miss_reasons.join("\n")
            )
            .to_lowercase(); // remove inconsistent capitalization
        }
    }

    remark_vec.into_iter().collect()
}

fn construct_message(opts: &RemarkLoadOptions, arguments: Vec<RemarkArg>) -> Vec<MessagePart> {
    let mut parts = vec![];
    let mut buffer = String::new();

    let add_annotated = |part: MessagePart, buffer: &mut String, message: &mut Vec<MessagePart>| {
        if !buffer.is_empty() {
            message.push(MessagePart::String(std::mem::take(buffer)));
        }
        message.push(part);
    };
    let aggregate_keys = |buffer: &mut String, map: BTreeMap<Cow<'_, str>, Value>| {
        buffer.extend(map.into_values().filter_map(|v| match v {
            Value::Bool(value) => Some(value.to_string()),
            Value::Number(value) => Some(value.to_string()),
            Value::String(value) => Some(value),
            _ => None,
        }));
    };

    for arg in arguments {
        match arg {
            RemarkArg::String(inner) => buffer.push_str(&inner.string),
            RemarkArg::Callee(RemarkArgCallee {
                callee: function,
                debug_loc: Some(location),
            })
            | RemarkArg::Caller(RemarkArgCaller {
                caller: function,
                debug_loc: Some(location),
            }) => add_annotated(
                MessagePart::AnnotatedString {
                    message: demangle(&function),
                    location: parse_debug_loc(opts, location),
                },
                &mut buffer,
                &mut parts,
            ),
            RemarkArg::Callee(RemarkArgCallee {
                callee: function,
                debug_loc: None,
            })
            | RemarkArg::Caller(RemarkArgCaller {
                caller: function,
                debug_loc: None,
            }) => buffer.push_str(&demangle(&function)),
            RemarkArg::Reason(inner) => buffer.push_str(&inner.reason),
            RemarkArg::Other(mut inner) => {
                if let Some(location) = inner
                    .remove("DebugLoc")
                    .and_then(|l| parse::DebugLocation::deserialize(l).ok())
                {
                    let location = parse_debug_loc(opts, location);
                    let mut message = String::new();
                    aggregate_keys(&mut message, inner);
                    add_annotated(
                        MessagePart::AnnotatedString { message, location },
                        &mut buffer,
                        &mut parts,
                    );
                } else {
                    aggregate_keys(&mut buffer, inner);
                }
            }
        };
    }

    if !buffer.is_empty() {
        parts.push(MessagePart::String(buffer));
    }

    parts
}

pub fn load_remarks_from_dir<P: AsRef<Path>>(
    path: P,
    options: RemarkLoadOptions,
    callback: Option<&(dyn LoadCallback + Send + Sync)>,
) -> anyhow::Result<Vec<Remark>> {
    let dir = path
        .as_ref()
        .to_path_buf()
        .canonicalize()
        .with_context(|| format!("Cannot find remark directory {}", path.as_ref().display()))?;
    let files: Vec<PathBuf> = std::fs::read_dir(&dir)
        .with_context(|| format!("Cannot read remark directory {}", dir.display()))?
        .filter_map(|entry| {
            let entry = entry.ok()?;
            if !entry.file_type().ok()?.is_file() {
                return None;
            }
            if !entry
                .file_name()
                .to_str()
                .map(|extension| extension.ends_with(EXPECTED_EXTENSION))
                .unwrap_or(false)
            {
                return None;
            }
            Some(entry.path())
        })
        .collect();

    log::debug!("Parsing {} file(s) from {}", files.len(), dir.display());

    if let Some(callback) = callback {
        callback.start(files.len() as u64);
    }

    let remarks: Vec<(PathBuf, anyhow::Result<Vec<Remark>>)> = files
        .into_par_iter()
        .map(|file| {
            let remarks = load_remarks_from_file(&file, &options);
            if let Some(callback) = callback {
                callback.advance();
            }
            (file, remarks)
        })
        .collect();

    let remarks = remarks
        .into_iter()
        .filter_map(|(path, result)| match result {
            Ok(remarks) => Some(remarks),
            Err(error) => {
                log::error!("Failed to load remarks from: {}: {error:?}", path.display());
                None
            }
        })
        .flatten()
        .collect();

    if let Some(callback) = callback {
        callback.finish();
    }

    Ok(remarks)
}

fn parse_debug_loc(options: &RemarkLoadOptions, location: parse::DebugLocation) -> Location {
    let file = normalize_path(options, location.file);

    Location {
        file,
        line: location.line,
        column: location.column,
    }
}

fn normalize_path(options: &RemarkLoadOptions, path: Cow<str>) -> String {
    const RUSTC_PREFIX: &str = "/rustc/";

    if let Some(ref rustc_source_root) = options.rustc_source_root {
        if let Some(path) = path.strip_prefix(RUSTC_PREFIX) {
            if let Some(index) = path.find('/') {
                let src_path = &path[index + 1..];
                let src_path = rustc_source_root.0.join(src_path);
                return src_path.to_str().unwrap().to_string().replace('\\', "/");
            }
        }
    }
    path.into_owned()
}

static HASH_REGEX: OnceLock<Regex> = OnceLock::new();

fn demangle(function: &str) -> String {
    // Remove hash from the end of legacy dmangled named
    let regex = HASH_REGEX.get_or_init(|| {
        Regex::new(r".*::[a-z0-9]{17}$").expect("Could not create regular expression")
    });
    let mut demangled = rustc_demangle::demangle(function).to_string();
    if regex.find(&demangled).is_some() {
        demangled.drain(demangled.len() - 19..);
    }
    demangled
}

#[cfg(test)]
mod tests {
    use crate::remark::{parse_remarks, Remark, RemarkLoadOptions};
    use crate::RustcSourceRoot;
    use std::path::PathBuf;

    struct Options {
        external: bool,
        filter_kind: Vec<String>,
        source_dir: PathBuf,
        rustc_source_root: Option<PathBuf>,
    }

    impl Options {
        fn filter(mut self, kind: &str) -> Self {
            self.filter_kind.push(kind.to_string());
            self
        }

        fn rustc_source_root(mut self, path: &str) -> Self {
            self.rustc_source_root = Some(PathBuf::from(path));
            self
        }

        fn external(mut self, external: bool) -> Self {
            self.external = external;
            self
        }
    }

    impl Default for Options {
        fn default() -> Self {
            Self {
                external: true,
                filter_kind: vec![],
                source_dir: PathBuf::from("/tmp"),
                rustc_source_root: None,
            }
        }
    }

    impl From<Options> for RemarkLoadOptions {
        fn from(value: Options) -> Self {
            let Options {
                external,
                filter_kind,
                source_dir,
                rustc_source_root,
            } = value;
            Self {
                external,
                source_dir,
                filter_kind,
                rustc_source_root: rustc_source_root.map(RustcSourceRoot),
            }
        }
    }

    #[test]
    fn parse_single() {
        let input = r#"--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_alloc
DebugLoc:        { File: '/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  %3 = tail call ptr @__rdl_alloc(i64 %0, i64 %1)'
  - String:          ' (in function: __rust_alloc)'
..."#;
        insta::assert_debug_snapshot!(parse(input, Options::default()), @r###"
        [
            Remark {
                pass: "sdagisel",
                name: "FastISelFailure",
                function: Function {
                    name: "__rust_alloc",
                    location: Some(
                        Location {
                            file: "/std/src/sys_common/backtrace.rs",
                            line: 131,
                            column: 0,
                        },
                    ),
                },
                message: [
                    String(
                        "FastISel missed call:   %3 = tail call ptr @__rdl_alloc(i64 %0, i64 %1) (in function: __rust_alloc)",
                    ),
                ],
                hotness: None,
            },
        ]
        "###);
    }

    #[test]
    fn parse_multiple() {
        let input = r#"--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/foo/rust/rust/library/std/src/rt.rs', 
                   Line: 165, Column: 17 }
Function:        _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
Args:
  - Callee:          _ZN3std2rt19lang_start_internal17had90330d479f72f8E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
    DebugLoc:        { File: '/foo/rust/rust/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: 'src/main.rs', Line: 7, Column: 5 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Callee:          _ZN3std2io5stdio6_print17hdb04fec352560b87E
  - String:          ' will not be inlined into '
  - Caller:          _ZN7remarks4main17hc92ae132ef1efa8eE
    DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
  - String:          ' because its definition is unavailable'
..."#;
        insta::assert_debug_snapshot!(parse(input, Options::default()), @r###"
        [
            Remark {
                pass: "inline",
                name: "NoDefinition",
                function: Function {
                    name: "std::rt::lang_start",
                    location: Some(
                        Location {
                            file: "/foo/rust/rust/library/std/src/rt.rs",
                            line: 165,
                            column: 17,
                        },
                    ),
                },
                message: [
                    String(
                        "std::rt::lang_start_internal will not be inlined into ",
                    ),
                    AnnotatedString {
                        message: "std::rt::lang_start",
                        location: Location {
                            file: "/foo/rust/rust/library/std/src/rt.rs",
                            line: 159,
                            column: 0,
                        },
                    },
                    String(
                        " because its definition is unavailable",
                    ),
                ],
                hotness: None,
            },
            Remark {
                pass: "inline",
                name: "NoDefinition",
                function: Function {
                    name: "remarks::main",
                    location: Some(
                        Location {
                            file: "src/main.rs",
                            line: 7,
                            column: 5,
                        },
                    ),
                },
                message: [
                    String(
                        "std::io::stdio::_print will not be inlined into ",
                    ),
                    AnnotatedString {
                        message: "remarks::main",
                        location: Location {
                            file: "src/main.rs",
                            line: 6,
                            column: 0,
                        },
                    },
                    String(
                        " because its definition is unavailable",
                    ),
                ],
                hotness: None,
            },
        ]
        "###);
    }

    #[test]
    fn parse_no_location() {
        let input = r#"--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_alloc
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  %3 = tail call ptr @__rdl_alloc(i64 %0, i64 %1)'
  - String:          ' (in function: __rust_alloc)'
..."#;
        insta::assert_debug_snapshot!(parse(input, Options::default()), @"[]");
    }

    #[test]
    fn parse_ignored_type() {
        let input = r#"--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/projects/personal/rust/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 135, Column: 18 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17hde3380935eb1addfE
  - String:          ''' inlined into '''
  - Caller:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
    DebugLoc:        { File: '/projects/personal/rust/rust/library/std/src/sys_common/backtrace.rs', 
                       Line: 131, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
  - String:          ':'
  - Line:            '4'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_alloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '7'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-6'
..."#;
        assert!(parse(input, Options::default()).is_empty());
    }

    #[test]
    fn parse_gvn() {
        let input = r#"--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/projects/personal/rust/rust/library/core/src/result.rs', 
                   Line: 1948, Column: 15 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$14grow_amortized17ha53db71e3f649c60E'
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/projects/personal/rust/rust/library/alloc/src/raw_vec.rs', 
                       Line: 404, Column: 19 }
..."#;

        assert_eq!(parse(input, Options::default()).len(), 1);
    }

    #[test]
    fn parse_filter() {
        let input = r#"--- !Missed
Pass:            gvn
Name:            Foo
DebugLoc:        { File: '/projects/personal/rust/rust/library/core/src/result.rs', 
                   Line: 1948, Column: 15 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$14grow_amortized17ha53db71e3f649c60E'
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/projects/personal/rust/rust/library/alloc/src/raw_vec.rs', 
                       Line: 404, Column: 19 }
..."#;

        assert!(parse(input, Options::default().filter("Foo")).is_empty());
    }

    #[test]
    fn parse_hotness() {
        let input = r#"--- !Missed
Pass:            regalloc
Name:            LoopSpillReloadCopies
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 114, Column: 13 }
Function:        _ZN3std2io16append_to_string17hcf3f6e91099a64a2E
Hotness:         2
Args:
  - NumReloads:      '3'
  - String:          ' reloads '
  - TotalReloadsCost: '4.607052e-10'
  - String:          ' total reloads cost '
  - NumVRCopies:     '2'
  - String:          ' virtual registers copies '
  - TotalCopiesCost: '5.000000e-01'
  - String:          ' total copies cost '
  - String:          generated in loop
..."#;

        insta::assert_debug_snapshot!(parse(input, Options::default()), @r###"
        [
            Remark {
                pass: "regalloc",
                name: "LoopSpillReloadCopies",
                function: Function {
                    name: "std::io::append_to_string",
                    location: Some(
                        Location {
                            file: "/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs",
                            line: 114,
                            column: 13,
                        },
                    ),
                },
                message: [
                    String(
                        "3 reloads 4.607052e-10 total reloads cost 2 virtual registers copies 5.000000e-01 total copies cost generated in loop",
                    ),
                ],
                hotness: Some(
                    2,
                ),
            },
        ]
        "###);
    }

    #[test]
    fn parse_remap_rust_source() {
        let input = r#"--- !Missed
Pass:            regalloc
Name:            LoopSpillReloadCopies
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 114, Column: 13 }
Function:        _ZN3std2io16append_to_string17hcf3f6e91099a64a2E
Args:
..."#;

        insta::assert_debug_snapshot!(parse(input, Options::default().external(true).rustc_source_root("/foo/bar")), @r###"
        [
            Remark {
                pass: "regalloc",
                name: "LoopSpillReloadCopies",
                function: Function {
                    name: "std::io::append_to_string",
                    location: Some(
                        Location {
                            file: "/foo/bar/library/std/src/io/buffered/bufreader/buffer.rs",
                            line: 114,
                            column: 13,
                        },
                    ),
                },
                message: [],
                hotness: None,
            },
        ]
        "###);
    }

    fn parse(input: &str, opts: Options) -> Vec<Remark> {
        parse_remarks(input.as_bytes(), &opts.into())
    }
}


================================================
FILE: src/remark/parse.rs
================================================
use std::borrow::Cow;
use std::collections::BTreeMap;

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct DebugLocation<'a> {
    #[serde(borrow)]
    pub file: Cow<'a, str>,
    pub line: u32,
    pub column: u32,
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct RemarkArgString<'a> {
    #[serde(borrow)]
    pub string: Cow<'a, str>,
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct RemarkArgCallee<'a> {
    #[serde(borrow)]
    pub callee: Cow<'a, str>,
    pub debug_loc: Option<DebugLocation<'a>>,
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct RemarkArgCaller<'a> {
    #[serde(borrow)]
    pub caller: Cow<'a, str>,
    pub debug_loc: Option<DebugLocation<'a>>,
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct RemarkArgReason<'a> {
    #[serde(borrow)]
    pub reason: Cow<'a, str>,
}

#[derive(serde::Deserialize, Debug)]
#[serde(untagged)]
pub enum RemarkArg<'a> {
    String(RemarkArgString<'a>),
    Callee(RemarkArgCallee<'a>),
    Caller(RemarkArgCaller<'a>),
    Reason(RemarkArgReason<'a>),
    #[serde(borrow)]
    Other(BTreeMap<Cow<'a, str>, serde_yaml::Value>),
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct MissedRemark<'a> {
    #[serde(borrow)]
    pub pass: Cow<'a, str>,
    #[serde(borrow)]
    pub name: Cow<'a, str>,
    pub debug_loc: Option<DebugLocation<'a>>,
    #[serde(borrow)]
    pub function: Cow<'a, str>,
    pub args: Vec<RemarkArg<'a>>,
    pub hotness: Option<i32>,
}

#[derive(serde::Deserialize, Debug)]
#[serde(rename_all = "PascalCase")]
pub struct AnalysisRemark<'a> {
    #[serde(borrow)]
    pub pass: Cow<'a, str>,
    #[serde(borrow)]
    pub name: Cow<'a, str>,
    pub debug_loc: Option<DebugLocation<'a>>,
    #[serde(borrow)]
    pub function: Cow<'a, str>,
    pub args: Vec<RemarkArg<'a>>,
    pub hotness: Option<i32>,
}

#[derive(serde::Deserialize, Debug)]
pub enum Remark<'a> {
    #[serde(borrow)]
    Missed(MissedRemark<'a>),
    Analysis(AnalysisRemark<'a>),
    Passed {},
}


================================================
FILE: src/render.rs
================================================
use std::borrow::Cow;
use std::fmt::Write;
use std::fs::File;
use std::io::BufWriter;
use std::path::{Component, Path, Prefix, MAIN_SEPARATOR};

use anyhow::Context;
use askama::Template;
use html_escape::{encode_safe, encode_safe_to_string};
use rayon::iter::IntoParallelIterator;
use rayon::prelude::*;
use rust_embed::RustEmbed;

use crate::remark::{Function, Line, Location, MessagePart, Remark};
use crate::utils::callback::LoadCallback;
use crate::utils::data_structures::Map;

pub const INDEX_FILE_PATH: &str = "index.html";
const REMARK_LIST_FILE_PATH: &str = "remarks.html";

/// Directory where sources will be stored.
/// Relative to the output directory.
const SRC_DIR_NAME: &str = "src";

#[derive(RustEmbed)]
#[folder = "templates/assets"]
struct StaticAssets;

#[derive(serde::Serialize)]
struct RemarkIndexEntry<'a> {
    name: &'a str,
    location: Option<String>,
    function: Cow<'a, str>,
    message: String,
    hotness: Option<i32>,
}

#[derive(serde::Serialize, PartialEq, Eq, Hash)]
struct RemarkSourceEntry<'a> {
    name: &'a str,
    function: &'a str,
    line: Line,
    message: String,
    hotness: Option<i32>,
}

#[derive(Template)]
#[template(path = "remark-list.jinja")]
pub struct RemarkListTemplate {
    remarks_json: String,
}

#[derive(serde::Serialize)]
struct SourceFileLink<'a> {
    name: &'a str,
    file: String,
    remark_count: u64,
}

#[derive(Template)]
#[template(path = "index.jinja")]
pub struct IndexTemplate<'a> {
    source_links: Vec<SourceFileLink<'a>>,
}

#[derive(Template)]
#[template(path = "source-file.jinja")]
pub struct SourceFileTemplate<'a> {
    path: &'a str,
    remarks: Vec<RemarkSourceEntry<'a>>,
    file_content: String,
}

pub fn render_remarks(
    remarks: Vec<Remark>,
    source_dir: &Path,
    output_dir: &Path,
    callback: Option<&(dyn LoadCallback + Sync)>,
) -> anyhow::Result<()> {
    let _ = std::fs::remove_dir_all(output_dir);
    std::fs::create_dir_all(output_dir).context("Cannot create output directory")?;

    // Copy all static assets to the output directory
    for asset_path in StaticAssets::iter() {
        let data = StaticAssets::get(&asset_path).unwrap().data;
        let path = output_dir.join("assets").join(asset_path.as_ref());
        if let Some(parent) = path.parent() {
            std::fs::create_dir_all(parent).context("Cannot create output asset directory")?;
        }
        std::fs::write(path, data).context("Cannot copy asset file to output directory")?;
    }

    // Filter duplicated remarks caused by inlining
    // When the compiler performs inlining, it can attribute multiple remarks with the same contents
    // to the same *location*, which only differ by the function (name) that they refer to.
    // This is usually just noise in the UI. So before outputting the remarks, we normalize them by
    // removing such duplicates.

    // Use references to original remarks to avoid allocations
    // We sort the remarks and then dedup consecutive entries that have everything except the
    // function name the same.
    struct NormalizedRemark<'a>(&'a Remark);

    impl NormalizedRemark<'_> {
        // Used for filtering duplicated remarks caused by function.name being inconsistent from inlining
        // excludes function.name from consideration
        fn dedup_key(&self) -> (&str, &str, &[MessagePart], Option<&i32>, Option<&Location>) {
            let Remark {
                pass,
                name,
                function:
                    Function {
                        name: _,
                        location: function_location,
                    },
                message,
                hotness,
            } = self.0;

            (
                pass,
                name,
                message,
                hotness.as_ref(),
                function_location.as_ref(),
            )
        }
    }

    let mut remarks: Vec<NormalizedRemark> = remarks.par_iter().map(NormalizedRemark).collect();
    remarks.par_sort_by(|a, b| (a.dedup_key()).cmp(&(b.dedup_key())));
    remarks.dedup_by(|a, b| a.dedup_key() == b.dedup_key());

    let mut file_to_remarks: Map<&str, Vec<RemarkSourceEntry>> = Map::default();

    // Create remark list page
    let remark_entries = remarks
        .iter()
        .map(|r| {
            let NormalizedRemark(Remark {
                pass: _,
                name,
                function,
                message,
                hotness,
            }) = r;

            let entry = RemarkIndexEntry {
                name,
                location: function.location.as_ref().map(|location| {
                    let mut buffer = String::new();
                    render_remark_link(&mut buffer, location, Some(SRC_DIR_NAME), None);
                    buffer
                }),
                function: encode_safe(&function.name),
                message: format_message(message, Some(SRC_DIR_NAME)),
                hotness: *hotness,
            };
            if let Some(ref location) = function.location {
                file_to_remarks
                    .entry(&location.file)
                    .or_default()
                    .push(RemarkSourceEntry {
                        name,
                        function: &function.name,
                        line: location.line,
                        // Inside the file, the link should be relative to the src directory
                        message: format_message(message, None),
                        hotness: *hotness,
                    });
            }
            // We also need to create file mappings for all referenced files, not just for files
            // with a remark.
            for msg_part in &r.0.message {
                if let MessagePart::AnnotatedString { location, .. } = msg_part {
                    file_to_remarks.entry(&location.file).or_default();
                }
            }
            entry
        })
        .collect::<Vec<_>>();

    let serialized_remarks = serde_json::to_string(&remark_entries)?;
    let remark_list_page = RemarkListTemplate {
        remarks_json: serialized_remarks,
    };
    render_to_file(&remark_list_page, &output_dir.join(REMARK_LIST_FILE_PATH))?;

    let mut source_links: Vec<SourceFileLink> = file_to_remarks
        .iter()
        .filter(|(_, remarks)| !remarks.is_empty())
        .map(|(name, remarks)| {
            let mut file = String::new();
            path_to_relative_url(&mut file, Some(SRC_DIR_NAME), name);
            SourceFileLink {
                name,
                file,
                remark_count: remarks.len() as u64,
            }
        })
        .collect();

    // Sort by relative files first, then in descending order by remark count
    source_links.par_sort_by_key(|link| (link.name.starts_with('/'), -(link.remark_count as i64)));

    let index_page = IndexTemplate { source_links };
    render_to_file(&index_page, &output_dir.join(INDEX_FILE_PATH))?;

    if let Some(callback) = callback {
        callback.start(file_to_remarks.len() as u64);
    }

    // sort the order of remarks in each file to make them more readable
    for file in file_to_remarks.iter_mut() {
        file.1.par_sort_by_key(|f| f.message.clone());
    }

    // Render all found source files
    let results = file_to_remarks
        .into_par_iter()
        .map(|(source_file, remarks)| -> anyhow::Result<()> {
            let original_path = resolve_path(source_dir, Path::new(source_file));
            let file_content = std::fs::read_to_string(&original_path)
                .with_context(|| format!("Cannot read source file {}", original_path.display()))?;

            if let Some(callback) = callback {
                callback.advance();
            }

            // TODO: deduplicate links to "self" (the same source file)
            let mut buffer = String::new();
            path_to_relative_url(&mut buffer, Some(SRC_DIR_NAME), source_file);
            let output_path = output_dir.join(buffer);
            let source_file_page = SourceFileTemplate {
                path: source_file,
                remarks,
                file_content,
            };
            render_to_file(&source_file_page, Path::new(&output_path))
                .with_context(|| anyhow::anyhow!("Failed to render {source_file}"))?;
            Ok(())
        })
        .collect::<Vec<anyhow::Result<()>>>();

    let failed = results.into_iter().filter(|r| r.is_err()).count();
    if failed > 0 {
        log::warn!("Failed to write {failed} source file(s)");
    }

    if let Some(callback) = callback {
        callback.finish();
    }

    Ok(())
}

fn format_message(parts: &[MessagePart], prefix: Option<&str>) -> String {
    let mut buffer = String::with_capacity(64);
    for part in parts {
        match part {
            MessagePart::String(string) => {
                encode_safe_to_string(string, &mut buffer);
            }
            MessagePart::AnnotatedString { message, location } => {
                render_remark_link(&mut buffer, location, prefix, Some(message));
            }
        }
    }
    buffer = buffer.replace("\n", "<br>"); // keep new lines in the string
    buffer
}

fn render_remark_link(
    buffer: &mut String,
    location: &Location,
    prefix: Option<&str>,
    label: Option<&str>,
) {
    buffer.push_str("<a href='");
    path_to_relative_url(buffer, prefix, &location.file);
    buffer.push_str("#L");
    buffer.write_fmt(format_args!("{}", location.line)).unwrap();
    buffer.push_str("'>");

    let label = label.map(Cow::from).unwrap_or_else(|| {
        format!("{}:{}:{}", location.file, location.line, location.column).into()
    });
    encode_safe_to_string(label, buffer);

    buffer.push_str("</a>");
}

/// Transforms `path` into a (hopefully unique) relative path that is normalized.
/// Slashes and path prefixes (e.g. C:) are removed from the paths and replaced with placeholders.
fn path_to_relative_url(buffer: &mut String, prefix: Option<&str>, path: &str) {
    if let Some(prefix) = prefix {
        buffer.push_str(prefix);
        buffer.push(MAIN_SEPARATOR);
    }

    let path = Path::new(path);
    let mut first = true;
    for component in path.components() {
        if !first {
            buffer.push('_');
        }
        first = false;

        match component {
            Component::Prefix(prefix) => {
                match prefix.kind() {
                    Prefix::Disk(disk) => buffer.push(disk as char),
                    _ => buffer.push_str("_prefix_"),
                };
                first = true;
            }
            Component::CurDir | Component::ParentDir => buffer.push('_'),
            Component::Normal(component) => {
                buffer.push_str(&component.to_string_lossy());
            }
            Component::RootDir => {}
        }
    }
    buffer.push_str(".html");
}

fn resolve_path<'a>(root_dir: &Path, path: &'a Path) -> Cow<'a, Path> {
    if path.is_absolute() {
        path.into()
    } else {
        root_dir.join(path).into()
    }
}

fn render_to_file<T: askama::Template>(template: &T, path: &Path) -> anyhow::Result<()> {
    if let Some(parent) = path.parent() {
        std::fs::create_dir_all(parent)
            .context("Cannot create directory for storing rendered file")?;
    }

    let file = File::create(path)
        .with_context(|| format!("Cannot create template file {}", path.display()))?;
    let mut writer = BufWriter::new(file);
    template
        .write_into(&mut writer)
        .with_context(|| format!("Cannot render template into {}", path.display()))?;
    Ok(())
}

#[cfg(test)]
mod tests {
    use crate::render::path_to_relative_url;

    #[cfg(windows)]
    #[test]
    fn relative_path_c_prefix() {
        check_path(r#"C:\foo\bar"#, "C_foo_bar.html");
    }

    #[test]
    fn relative_path_absolute() {
        check_path("/tmp/foo/bar", "_tmp_foo_bar.html");
    }

    #[test]
    fn relative_path_relative() {
        check_path("foo/bar", "foo_bar.html");
    }

    fn check_path(path: &str, expected: &str) {
        let mut buffer = String::new();
        path_to_relative_url(&mut buffer, None, path);
        assert_eq!(buffer, expected);
    }
}


================================================
FILE: src/utils/callback.rs
================================================
use indicatif::ProgressBar;

pub trait LoadCallback {
    fn start(&self, count: u64);
    fn advance(&self);
    fn finish(&self);
}

pub struct ProgressBarCallback {
    pbar: ProgressBar,
}

impl Default for ProgressBarCallback {
    fn default() -> Self {
        Self {
            pbar: ProgressBar::new(1),
        }
    }
}

impl LoadCallback for ProgressBarCallback {
    fn start(&self, count: u64) {
        self.pbar.set_length(count);
    }

    fn advance(&self) {
        self.pbar.inc(1);
    }

    fn finish(&self) {
        self.pbar.finish_using_style();
    }
}


================================================
FILE: src/utils/cli.rs
================================================
use colored::{ColoredString, Colorize};
use std::path::Path;

/// Formats a path in a unified format to be printed in CLI.
pub fn cli_format_path<P: AsRef<Path>>(path: P) -> ColoredString {
    path.as_ref().display().to_string().yellow()
}


================================================
FILE: src/utils/data_structures.rs
================================================
use fxhash::FxBuildHasher;

pub type Map<K, V> = hashbrown::HashMap<K, V, FxBuildHasher>;
pub type Set<V> = hashbrown::HashSet<V, FxBuildHasher>;


================================================
FILE: src/utils/io.rs
================================================
use std::path::{Path, PathBuf};

/// Make sure that directory exists.
pub fn ensure_directory(path: &Path) -> std::io::Result<PathBuf> {
    std::fs::create_dir_all(path)?;
    Ok(path.to_path_buf())
}

/// Clears all files from the directory, and recreates it.
pub fn clear_directory(path: &Path) -> std::io::Result<PathBuf> {
    std::fs::remove_dir_all(path)?;
    ensure_directory(path)
}


================================================
FILE: src/utils/mod.rs
================================================
use crate::render::INDEX_FILE_PATH;
use crate::utils::cli::cli_format_path;
use std::path::Path;

pub mod callback;
pub mod cli;
pub mod data_structures;
pub mod io;
pub mod timing;

pub fn open_result(dir: &Path, open: bool) -> anyhow::Result<()> {
    let index_path = dir.join(INDEX_FILE_PATH);
    if open {
        opener::open_browser(&index_path).map_err(|error| {
            anyhow::anyhow!(
                "Could not open {} in browser: {error:?}",
                cli_format_path(index_path)
            )
        })?;
    } else {
        log::info!(
            "Open {} in a browser to see the results.",
            cli_format_path(index_path)
        );
    }
    Ok(())
}


================================================
FILE: src/utils/timing.rs
================================================
use std::time::Instant;

pub fn time_block_log_debug<F: FnOnce() -> R, R>(label: &str, f: F) -> R {
    let start = Instant::now();
    let result = f();
    log::debug!("{label} ({:.2}s)", start.elapsed().as_secs_f32());
    result
}

pub fn time_block_log_info<F: FnOnce() -> R, R>(label: &str, f: F) -> R {
    let start = Instant::now();
    let result = f();
    log::info!("{label} ({:.2}s)", start.elapsed().as_secs_f32());
    result
}

pub fn time_block_print<F: FnOnce() -> R, R>(label: &str, f: F) -> R {
    let start = Instant::now();
    let result = f();
    eprintln!("{label} finished in {:.2}s", start.elapsed().as_secs_f32());
    result
}


================================================
FILE: templates/index.jinja
================================================
{% extends "layout.html" %}

{% block title %}File list{% endblock %}

{% block content %}
{% include "menu.html" %}
<div>
    <ul>
    {% for link in source_links %}
      <li><a href="{{ link.file }}">{{ link.name }}</a> ({{ link.remark_count }} remark{% if link.remark_count != 1 %}s{% endif %})</li>
    {% endfor %}
    </ul>
</div>

{% endblock %}


================================================
FILE: templates/layout.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}{% endblock %}</title>
    {% block head %}{% endblock %}
</head>
<body>
<div>
    {% block content %}{% endblock %}
</div>
{% block script %}{% endblock %}
</body>
</html>


================================================
FILE: templates/menu.html
================================================
<nav style="margin-bottom: 10px;">
    <a href="index.html">File list</a>
    <a href="remarks.html">Remark list</a>
</nav>


================================================
FILE: templates/remark-list.jinja
================================================
{% extends "layout.html" %}

{% block title %}Remark list{% endblock %}

{% block head %}
{% call super() %}
<link rel="stylesheet" type="text/css" href="assets/css/jquery.dataTables.min.css" />
<script src="assets/js/jquery-3.5.1.min.js"></script>
<script src="assets/js/jquery.dataTables.min.js"></script>
<script src="assets/js/colResizable-1.6.min.js"></script>
{% endblock %}

{% block content %}
{% include "menu.html" %}
<div>
    <table id="remark-table" width="100%"></table>
</div>

{% endblock %}

{% block script %}
<script type="text/javascript">
    const remarks = {{ remarks_json|safe }};
    $(document).ready(function() {
        $("#remark-table").DataTable({
            data: remarks,
            lengthMenu: [[100, 500, -1], [100, 500, "All"]],
            autoWidth: false,
            columns: [
                {title: "Kind", data: "name", width: "10%"},
                {title: "Location", data: "location", width: "25%"},
                {title: "Function", data: "function", width: "20%"},
                {title: "<span title='Hotness is only available when you use PGO'>Hotness</span>", data: "hotness", width: "5%"},
                {title: "Message", data: "message", width: "35%"},
            ],
            order: [[3, "desc"], [0, "asc"]]
        });
        $("#remark-table").colResizable();
    });
</script>
{% endblock %}


================================================
FILE: templates/source-file.jinja
================================================
{% extends "layout.html" %}

{% block title %}File {{ path }}{% endblock %}

{% block head %}
{% call super() %}
<link rel="stylesheet" type="text/css" href="../assets/css/codemirror-5.65.13.min.css" />

<script src="../assets/js/jquery-3.5.1.min.js"></script>
<script src="../assets/js/codemirror-5.65.13.min.js"></script>
<script src="../assets/js/codemirror-5.65.13-simple.min.js"></script>
<script src="../assets/js/codemirror-5.65.13-rust.min.js"></script>

<style type="text/css">
.header {
    margin: 10px;
}
.source-code {
    width: 100%;
    height: 100%;
}
.CodeMirror {
    font-size: 14px;
}
.codemirror-highlighted {
    background-color: rgba(255, 0, 0, 0.3);
}
.remark {
    margin: 5px;
    padding: 10px;
    border: 2px solid black;
    border-radius: 5px;
    box-shadow: 2px 1px 0 0 black;
    background: rgba(80, 80, 80, 0.1);
}
</style>
{% endblock %}

{% block content %}
<div>
    <div style="display: flex; margin-bottom: 10px;">
        <button id="btn-back">← Back</button>
        <h3 class="header">{{ path }}</h3>
    </div>
    <textarea class="source-code" id="content" readonly>{{ file_content }}</textarea>
</div>

{% endblock %}

{% block script %}
<script type="text/javascript">
function navigateToHash() {
    if (window.location.hash && window.location.hash.startsWith("#L")) {
        const hash = window.location.hash.substring(2);
        let line = Number.parseInt(hash);
        if (!Number.isNaN(line)) {
            line = Math.max(1, Math.min(editor.lineCount(), line)) - 1;
            const from = {line, ch: 0};
            editor.setCursor(from);
            editor.scrollIntoView(from);

            const lineLength = editor.getLine(line).length;
            const to = {line, ch: lineLength};

            editor.doc.getAllMarks().forEach(marker => marker.clear());
            editor.markText(from, to, {className: "codemirror-highlighted"});
        }
    }
}

$("#btn-back").on("click", () => {
    window.history.back();
});

const remarks = {{ remarks|json|safe }};

const editor = CodeMirror.fromTextArea(document.getElementById("content"), {
    lineNumbers: true,
    mode: "rust",
    readOnly: true
});
editor.setSize("100%", "100%");
editor.focus();

// Sort by line and then in descending order by hotness
remarks.sort((a, b) => {
    if (a.line === b.line) {
        const hotness_a = a.hotness || 0;
        const hotness_b = b.hotness || 0;
        return hotness_b - hotness_a;
    } else if (a.line < b.line) {
        return -1;
    } else {
        return 1;
    }
});

for (const remark of remarks) {
    const element = document.createElement("div");
    let message = remark.message;
    if (remark.hotness !== null) {
        message += ` (hotness: ${remark.hotness})`;
    }

    element.innerHTML = message;
    editor.addLineWidget(remark.line - 1, element, {
        className: "remark"
    });
}

window.addEventListener("hashchange", () => {
    navigateToHash();
});

navigateToHash();

</script>
{% endblock %}


================================================
FILE: tests/data/remarks-1/37v4yjwjhlguzgkm.codegen.opt.yaml
================================================
--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_alloc
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  %3 = tail call ptr @__rdl_alloc(i64 %0, i64 %1)'
  - String:          ' (in function: __rust_alloc)'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        __rust_alloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '7'
  - String:          '; Delta: '
  - Delta:           '7'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_alloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '7'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-6'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        __rust_alloc
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        __rust_alloc
Args:
  - String:          "\nFunction: __rust_alloc"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        __rust_alloc
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        __rust_alloc
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...
--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_dealloc
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  tail call void @__rdl_dealloc(ptr %0, i64 %1, i64 %2)'
  - String:          ' (in function: __rust_dealloc)'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_dealloc
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        __rust_dealloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '10'
  - String:          '; Delta: '
  - Delta:           '10'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_dealloc
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_dealloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '10'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-9'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        __rust_dealloc
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        __rust_dealloc
Args:
  - String:          "\nFunction: __rust_dealloc"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        __rust_dealloc
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        __rust_dealloc
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...
--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_realloc
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  %5 = tail call ptr @__rdl_realloc(ptr %0, i64 %1, i64 %2, i64 %3)'
  - String:          ' (in function: __rust_realloc)'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_realloc
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        __rust_realloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '13'
  - String:          '; Delta: '
  - Delta:           '13'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_realloc
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_realloc
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '13'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-12'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        __rust_realloc
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        __rust_realloc
Args:
  - String:          "\nFunction: __rust_realloc"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        __rust_realloc
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        __rust_realloc
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...
--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_alloc_zeroed
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  %3 = tail call ptr @__rdl_alloc_zeroed(i64 %0, i64 %1)'
  - String:          ' (in function: __rust_alloc_zeroed)'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc_zeroed
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        __rust_alloc_zeroed
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '7'
  - String:          '; Delta: '
  - Delta:           '7'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc_zeroed
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_alloc_zeroed
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '7'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-6'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        __rust_alloc_zeroed
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        __rust_alloc_zeroed
Args:
  - String:          "\nFunction: __rust_alloc_zeroed"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        __rust_alloc_zeroed
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        __rust_alloc_zeroed
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...
--- !Missed
Pass:            sdagisel
Name:            FastISelFailure
Function:        __rust_alloc_error_handler
Args:
  - String:          FastISel missed call
  - String:          ': '
  - String:          '  tail call void @__rg_oom(i64 %0, i64 %1)'
  - String:          ' (in function: __rust_alloc_error_handler)'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc_error_handler
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        __rust_alloc_error_handler
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '7'
  - String:          '; Delta: '
  - Delta:           '7'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        __rust_alloc_error_handler
Args:
  - Pass:            Fast Register Allocator
  - String:          ': Function: '
  - Function:        __rust_alloc_error_handler
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '7'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '-6'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        __rust_alloc_error_handler
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        __rust_alloc_error_handler
Args:
  - String:          "\nFunction: __rust_alloc_error_handler"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        __rust_alloc_error_handler
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        __rust_alloc_error_handler
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...


================================================
FILE: tests/data/remarks-1/37v4yjwjhlguzgkm.opt.opt.yaml
================================================


================================================
FILE: tests/data/remarks-1/remarks.67ea4a01cbc73fb0-cgu.0.codegen.opt.yaml
================================================
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '6'
  - String:          '; Delta: '
  - Delta:           '6'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - Pass:            Virtual Register Rewriter
  - String:          ': Function: '
  - Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '6'
  - String:          ' to '
  - MIInstrsAfter:   '5'
  - String:          '; Delta: '
  - Delta:           '-1'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - NumStackBytes:   '8'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - Pass:            'Prologue/Epilogue Insertion & Frame Finalization'
  - String:          ': Function: '
  - Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '5'
  - String:          ' to '
  - MIInstrsAfter:   '7'
  - String:          '; Delta: '
  - Delta:           '2'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - String:          "\nFunction: _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '4'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 131, Column: 0 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - NumInstructions: '5'
  - String:          ' instructions in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '9'
  - String:          '; Delta: '
  - Delta:           '9'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - Pass:            Simple Register Coalescing
  - String:          ': Function: '
  - Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '9'
  - String:          ' to '
  - MIInstrsAfter:   '8'
  - String:          '; Delta: '
  - Delta:           '-1'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - Pass:            Virtual Register Rewriter
  - String:          ': Function: '
  - Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '8'
  - String:          ' to '
  - MIInstrsAfter:   '6'
  - String:          '; Delta: '
  - Delta:           '-2'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - NumStackBytes:   '8'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - Pass:            'Prologue/Epilogue Insertion & Frame Finalization'
  - String:          ': Function: '
  - Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '6'
  - String:          ' to '
  - MIInstrsAfter:   '8'
  - String:          '; Delta: '
  - Delta:           '2'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - String:          "\nFunction: _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '6'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 0 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - NumInstructions: '6'
  - String:          ' instructions in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '9'
  - String:          '; Delta: '
  - Delta:           '9'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - Pass:            Simple Register Coalescing
  - String:          ': Function: '
  - Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '9'
  - String:          ' to '
  - MIInstrsAfter:   '8'
  - String:          '; Delta: '
  - Delta:           '-1'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - Pass:            Virtual Register Rewriter
  - String:          ': Function: '
  - Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '8'
  - String:          ' to '
  - MIInstrsAfter:   '6'
  - String:          '; Delta: '
  - Delta:           '-2'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - NumStackBytes:   '8'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - Pass:            'Prologue/Epilogue Insertion & Frame Finalization'
  - String:          ': Function: '
  - Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '6'
  - String:          ' to '
  - MIInstrsAfter:   '8'
  - String:          '; Delta: '
  - Delta:           '2'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - String:          "\nFunction: _ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '6'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 0 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - NumInstructions: '6'
  - String:          ' instructions in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: '/foo/rust/library/core/src/ptr/mod.rs', 
                   Line: 497, Column: 0 }
Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '1'
  - String:          '; Delta: '
  - Delta:           '1'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: '/foo/rust/library/core/src/ptr/mod.rs', 
                   Line: 497, Column: 0 }
Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
Args:
  - NumStackBytes:   '0'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
DebugLoc:        { File: '/foo/rust/library/core/src/ptr/mod.rs', 
                   Line: 497, Column: 0 }
Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
Args:
  - String:          "\nFunction: _ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
DebugLoc:        { File: '/foo/rust/library/core/src/ptr/mod.rs', 
                   Line: 497, Column: 1 }
Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '1'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
DebugLoc:        { File: '/foo/rust/library/core/src/ptr/mod.rs', 
                   Line: 497, Column: 0 }
Function:        '_ZN4core3ptr85drop_in_place$LT$std..rt..lang_start$LT$$LP$$RP$$GT$..$u7b$$u7b$closure$u7d$$u7d$$GT$17hffcc5d4d05ada4bbE'
Args:
  - NumInstructions: '1'
  - String:          ' instructions in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '15'
  - String:          '; Delta: '
  - Delta:           '15'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Pass:            Merge disjoint stack slots
  - String:          ': Function: '
  - Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '15'
  - String:          ' to '
  - MIInstrsAfter:   '13'
  - String:          '; Delta: '
  - Delta:           '-2'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Pass:            Virtual Register Rewriter
  - String:          ': Function: '
  - Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '13'
  - String:          ' to '
  - MIInstrsAfter:   '12'
  - String:          '; Delta: '
  - Delta:           '-1'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - NumStackBytes:   '56'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Pass:            'Prologue/Epilogue Insertion & Frame Finalization'
  - String:          ': Function: '
  - Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '12'
  - String:          ' to '
  - MIInstrsAfter:   '14'
  - String:          '; Delta: '
  - Delta:           '2'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - String:          "\nFunction: _ZN7remarks4main17hc92ae132ef1efa8eE"
  - String:          "\nOffset: [SP"
  - Offset:          '-48'
  - String:          '], Type: '
  - Type:            Variable
  - String:          ', Align: '
  - Align:           '8'
  - String:          ', Size: '
  - Size:            '48'
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '12'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - NumInstructions: '12'
  - String:          ' instructions in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        main
Args:
  - Pass:            'X86 DAG->DAG Instruction Selection'
  - String:          ': Function: '
  - Function:        main
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '0'
  - String:          ' to '
  - MIInstrsAfter:   '23'
  - String:          '; Delta: '
  - Delta:           '23'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        main
Args:
  - Pass:            Merge disjoint stack slots
  - String:          ': Function: '
  - Function:        main
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '23'
  - String:          ' to '
  - MIInstrsAfter:   '21'
  - String:          '; Delta: '
  - Delta:           '-2'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        main
Args:
  - Pass:            Simple Register Coalescing
  - String:          ': Function: '
  - Function:        main
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '21'
  - String:          ' to '
  - MIInstrsAfter:   '19'
  - String:          '; Delta: '
  - Delta:           '-2'
...
--- !Missed
Pass:            regalloc
Name:            SpillReloadCopies
Function:        main
Args:
  - NumVRCopies:     '1'
  - String:          ' virtual registers copies '
  - TotalCopiesCost: '1.000000e+00'
  - String:          ' total copies cost '
  - String:          generated in function
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        main
Args:
  - Pass:            Virtual Register Rewriter
  - String:          ': Function: '
  - Function:        main
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '19'
  - String:          ' to '
  - MIInstrsAfter:   '13'
  - String:          '; Delta: '
  - Delta:           '-6'
...
--- !Analysis
Pass:            prologepilog
Name:            StackSize
Function:        main
Args:
  - NumStackBytes:   '8'
  - String:          ' stack bytes in function'
...
--- !Analysis
Pass:            size-info
Name:            FunctionMISizeChange
Function:        main
Args:
  - Pass:            'Prologue/Epilogue Insertion & Frame Finalization'
  - String:          ': Function: '
  - Function:        main
  - String:          ': '
  - String:          'MI Instruction count changed from '
  - MIInstrsBefore:  '13'
  - String:          ' to '
  - MIInstrsAfter:   '15'
  - String:          '; Delta: '
  - Delta:           '2'
...
--- !Analysis
Pass:            stack-frame-layout
Name:            StackLayout
Function:        main
Args:
  - String:          "\nFunction: main"
  - String:          "\nOffset: [SP"
  - Offset:          '-8'
  - String:          '], Type: '
  - Type:            Variable
  - String:          ', Align: '
  - Align:           '8'
  - String:          ', Size: '
  - Size:            '8'
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
Function:        main
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      ''
  - String:          "\n"
  - String:          ''
  - String:          ': '
  - INST_:           '12'
  - String:          "\n"
...
--- !Analysis
Pass:            asm-printer
Name:            InstructionCount
Function:        main
Args:
  - NumInstructions: '12'
  - String:          ' instructions in function'
...


================================================
FILE: tests/data/remarks-1/remarks.67ea4a01cbc73fb0-cgu.0.opt.opt.yaml
================================================
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                   Line: 135, Column: 18 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17hde3380935eb1addfE
  - String:          ''' inlined into '''
  - Caller:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
    DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                       Line: 131, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
  - String:          ':'
  - Line:            '4'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
    DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                       Line: 131, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
Args:
  - String:          ''''
  - Callee:          '_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17hc8ee8ce6af31c006E'
  - String:          ''' inlined into '''
  - Caller:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 5 }
Function:        _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
Args:
  - String:          ''''
  - Callee:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17h8385278cd9457b2fE'
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
    DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '0'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '5'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
    DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                       Line: 131, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
    DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                   Line: 250, Column: 5 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17h45d79837d17bfedeE
  - String:          ''' inlined into '''
  - Caller:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
    DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15000'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '5'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h7208ef7aa68440d8E
    DebugLoc:        { File: '/foo/rust/library/std/src/sys_common/backtrace.rs', 
                       Line: 131, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hd822f6cb09e595dcE'
    DebugLoc:        { File: '/foo/rust/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 165, Column: 17 }
Function:        _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
Args:
  - Callee:          _ZN3std2rt19lang_start_internal17had90330d479f72f8E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                   Line: 165, Column: 17 }
Function:        _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
Args:
  - Callee:          _ZN3std2rt19lang_start_internal17had90330d479f72f8E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: 'src/main.rs', Line: 7, Column: 5 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Callee:          _ZN3std2io5stdio6_print17hdb04fec352560b87E
  - String:          ' will not be inlined into '
  - Caller:          _ZN7remarks4main17hc92ae132ef1efa8eE
    DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: 'src/main.rs', Line: 7, Column: 5 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - Callee:          _ZN3std2io5stdio6_print17hdb04fec352560b87E
  - String:          ' will not be inlined into '
  - Caller:          _ZN7remarks4main17hc92ae132ef1efa8eE
    DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: 'src/main.rs', Line: 8, Column: 5 }
Function:        _ZN7remarks4main17hc92ae132ef1efa8eE
Args:
  - String:          ''''
  - Callee:          _ZN7remarks3foo17h78901fc1396afa9fE
    DebugLoc:        { File: 'src/main.rs', Line: 2, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          _ZN7remarks4main17hc92ae132ef1efa8eE
    DebugLoc:        { File: 'src/main.rs', Line: 6, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Passed
Pass:            inline
Name:            Inlined
Function:        main
Args:
  - String:          ''''
  - Callee:          _ZN3std2rt10lang_start17h9096f6f84fb08eb2E
    DebugLoc:        { File: '/foo/rust/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          main
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '15'
  - String:          ', threshold='
  - Threshold:       '375'
  - String:          ')'
...


================================================
FILE: tests/data/remarks-similarity-join/src/common.rs
================================================
pub type Map<K, V> = hashbrown::HashMap<K, V, fxhash::FxBuildHasher>;


================================================
FILE: tests/data/remarks-similarity-join/src/main.rs
================================================
#![feature(core_intrinsics)]

use std::io::{BufRead, BufReader, Write};
use std::str::FromStr;

use crate::record::{load_relation, Relation};
use crate::util::ForceUnwrap;

mod common;
mod record;
mod util;

#[global_allocator]
static ALLOC: mimallocator::Mimalloc = mimallocator::Mimalloc;

// TODO: use aligned memory
fn calculate_query(relation: Relation, threshold: f32) -> u64 {
    let records = &relation.records;
    let record_lengths = relation.record_lengths.as_slice();

    records
        .iter()
        // .par_iter()
        .enumerate()
        .map(|(index, record)| {
            let index_first = index + 1;
            let following_record_count = relation.records.len() - index_first;

            // Gather intersection counts
            let mut intersections: Vec<u16> = vec![0; following_record_count];
            for value in record {
                let containing_records = &relation.index[value];
                let start_index = containing_records.partition_point(|&i| i <= index as u32);

                /*for &record_index in &containing_records[start_index..] {
                    unsafe {
                        let target_index = record_index as usize - index_first;
                        *intersections.get_unchecked_mut(target_index) += 1;
                    }
                }*/

                // Unrolled version
                let count = containing_records.len() - start_index;
                let unroll_count = count - (count % 8);

                for record_index in (start_index..start_index + unroll_count).step_by(8) {
                    unsafe {
                        let index0 =
                            *containing_records.get_unchecked(record_index) as usize - index_first;
                        let index1 = *containing_records.get_unchecked(record_index + 1) as usize
                            - index_first;
                        let index2 = *containing_records.get_unchecked(record_index + 2) as usize
                            - index_first;
                        let index3 = *containing_records.get_unchecked(record_index + 3) as usize
                            - index_first;
                        let index4 = *containing_records.get_unchecked(record_index + 4) as usize
                            - index_first;
                        let index5 = *containing_records.get_unchecked(record_index + 5) as usize
                            - index_first;
                        let index6 = *containing_records.get_unchecked(record_index + 6) as usize
                            - index_first;
                        let index7 = *containing_records.get_unchecked(record_index + 7) as usize
                            - index_first;
                        *intersections.get_unchecked_mut(index0) += 1;
                        *intersections.get_unchecked_mut(index1) += 1;
                        *intersections.get_unchecked_mut(index2) += 1;
                        *intersections.get_unchecked_mut(index3) += 1;
                        *intersections.get_unchecked_mut(index4) += 1;
                        *intersections.get_unchecked_mut(index5) += 1;
                        *intersections.get_unchecked_mut(index6) += 1;
                        *intersections.get_unchecked_mut(index7) += 1;
                    }
                }

                for &record_index in &containing_records[start_index + unroll_count..] {
                    unsafe {
                        let target_index = record_index as usize - index_first;
                        *intersections.get_unchecked_mut(target_index) += 1;
                    }
                }
            }

            // Vectorized JA
            /*let simd_count = following_record_count - (following_record_count % 8);
            let mut sum_v = f32x8::splat(0.0);
            let threshold_v = f32x8::splat(threshold);
            let zero_v = f32x8::splat(0.0);

            let intersections = intersections.as_slice();
            let relation_size_v = f32x8::splat(record.len() as f32);

            for index in (0..simd_count).step_by(8) {
                let intersection_v =
                    unsafe { u16x8::from_slice_unaligned_unchecked(intersections.slice(index, 8)) };
                let length_v = unsafe {
                    u16x8::from_slice_unaligned_unchecked(
                        record_lengths.slice(index_first + index, 8),
                    )
                };

                let intersection_v: u32x8 = intersection_v.into();
                let length_v: u32x8 = length_v.into();

                let intersection_v: f32x8 = intersection_v.cast();
                let length_v: f32x8 = length_v.cast();
                let union_v = length_v + relation_size_v - intersection_v;

                let ja_v = intersection_v / union_v;
                let mask = ja_v.ge(threshold_v);

                sum_v = sum_v + mask.select(intersection_v, zero_v);
            }*/
            let simd_count = 0;

            // Scalar JA for the rest of the elements
            intersections[simd_count..]
                .into_iter()
                .zip(&record_lengths[index_first + simd_count..])
                .map(|(&intersection, &length)| {
                    let union_size = (length as u32 + record.len() as u32) - intersection as u32;
                    let ja = (intersection as f32) / (union_size as f32);
                    if ja >= threshold {
                        intersection as u64
                    } else {
                        0
                    }
                })
                .sum::<u64>()
        })
        .sum()
}

fn main() {
    // rayon::ThreadPoolBuilder::new()
    //     .num_threads(8)
    //     .build_global()
    //     .unwrap();

    // let stdin = std::fs::File::open("input").unwrap();
    // let stdin = BufReader::new(stdin);

    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let mut reader = BufReader::new(stdin);
    let mut line = String::with_capacity(64);

    let stdout = std::io::stdout();
    let mut stdout = stdout.lock();

    loop {
        // JS
        reader.read_line(&mut line).unwrap_force();
        if line.is_empty() {
            break;
        }

        line.clear();
        reader.read_line(&mut line).unwrap_force();

        let threshold = f32::from_str(&line.trim()).unwrap_force();

        line.clear();
        reader.read_line(&mut line).unwrap_force();

        let relation = crate::measure!("load", { load_relation(&line.trim()).unwrap() });
        let result = calculate_query(relation, threshold);
        writeln!(stdout, "{}", result).unwrap_force();

        line.clear();
    }
    stdout.flush().unwrap();
}


================================================
FILE: tests/data/remarks-similarity-join/src/record.rs
================================================
use crate::common::Map;
use byteorder::ReadBytesExt;
use fxhash::FxBuildHasher;
use std::io::BufReader;

use crate::util::ForceUnwrap;

pub type Element = u32;

pub type Record = Vec<Element>;

type Ordering = byteorder::LittleEndian;

#[derive(Debug)]
pub struct Relation {
    // value -> set of records that contain it
    pub index: Map<Element, Vec<u32>>,
    pub records: Vec<Record>,
    pub record_lengths: Vec<u16>,
}

pub fn load_relation(path: &str) -> anyhow::Result<Relation> {
    let file = std::fs::File::open(path)?;
    let mut reader = BufReader::with_capacity(8192, file);

    let mut index = Map::with_capacity_and_hasher(1024, FxBuildHasher::default());
    let mut records = Vec::with_capacity(1024);
    let mut record_lengths = Vec::with_capacity(1024);

    loop {
        let size = match reader.read_u32::<Ordering>() {
            Ok(size) => size,
            Err(_) => break,
        };

        let mut record = Vec::with_capacity(size as usize);
        let record_id = records.len() as u32;

        for _ in 0..size {
            let value = reader.read_u32::<Ordering>().unwrap_force();
            let record_set = index.entry(value).or_insert_with(|| Vec::with_capacity(32));
            // ignore duplicates
            if std::intrinsics::unlikely(record_set.last() == Some(&record_id)) {
                continue;
            }
            record_set.push(record_id);
            record.push(value);
        }
        record.sort_unstable();

        assert!(record.len() <= u16::MAX as usize);
        record_lengths.push(record.len() as u16);
        records.push(record);
    }

    Ok(Relation {
        index,
        records,
        record_lengths,
    })
}


================================================
FILE: tests/data/remarks-similarity-join/src/util.rs
================================================
use std::fmt::Debug;

pub trait ForceUnwrap {
    type Target;

    fn unwrap_force(self) -> Self::Target;
}

impl<T> ForceUnwrap for Option<T> {
    type Target = T;

    fn unwrap_force(self) -> Self::Target {
        #[cfg(feature = "force-unwrap")]
        match self {
            Some(x) => x,
            None => unsafe {
                std::hint::unreachable_unchecked();
            },
        }
        #[cfg(not(feature = "force-unwrap"))]
        self.unwrap()
    }
}

impl<T, E> ForceUnwrap for Result<T, E>
where
    E: Debug,
{
    type Target = T;

    fn unwrap_force(self) -> Self::Target {
        #[cfg(feature = "force-unwrap")]
        match self {
            Ok(x) => x,
            Err(_) => unsafe {
                std::hint::unreachable_unchecked();
            },
        }
        #[cfg(not(feature = "force-unwrap"))]
        self.unwrap()
    }
}

#[macro_export]
macro_rules! measure {
    ($name: expr, $block: block) => {{
        let start = std::time::SystemTime::now();
        let ret = $block;
        eprintln!("{}: {} ms", $name, start.elapsed().unwrap().as_millis());
        ret
    }};
}

pub trait Sliced<T> {
    fn slice(&self, start: usize, end: usize) -> &[T];
}

impl<'a, T> Sliced<T> for &'a [T] {
    #[inline(always)]
    fn slice(&self, start: usize, len: usize) -> &[T] {
        unsafe {
            let start = self.as_ptr().add(start);
            std::slice::from_raw_parts(start, len)
        }
    }
}


================================================
FILE: tests/data/remarks-similarity-join/yaml/similarity_join.548e4531baa98255-cgu.0.codegen.opt.yaml
================================================
[File too large to display: 11.0 MB]

================================================
FILE: tests/data/remarks-similarity-join/yaml/similarity_join.548e4531baa98255-cgu.0.opt.opt.yaml
================================================
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/sys_common/backtrace.rs', 
                   Line: 154, Column: 18 }
Function:        _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17hf71c1d535a122e0dE
  - String:          ''' inlined into '''
  - Caller:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/sys_common/backtrace.rs', 
                       Line: 150, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
  - String:          ':'
  - Line:            '4'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/sys_common/backtrace.rs', 
                       Line: 150, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
Args:
  - String:          ''''
  - Callee:          '_ZN54_$LT$$LP$$RP$$u20$as$u20$std..process..Termination$GT$6report17h505a950911c19327E'
  - String:          ''' inlined into '''
  - Caller:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                   Line: 250, Column: 5 }
Function:        _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
Args:
  - String:          ''''
  - Callee:          '_ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hc2e7d8dca3faa815E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                       Line: 166, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '0'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '5'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/sys_common/backtrace.rs', 
                       Line: 150, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                   Line: 250, Column: 5 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hf46a5604f7ecaf3eE'
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17h14cd82bc2fb965b9E
  - String:          ''' inlined into '''
  - Caller:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hf46a5604f7ecaf3eE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15000'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hf46a5604f7ecaf3eE'
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '5'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NeverInline
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 166, Column: 18 }
Function:        '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hf46a5604f7ecaf3eE'
Args:
  - String:          ''''
  - Callee:          _ZN3std10sys_common9backtrace28__rust_begin_short_backtrace17h9f959bcd098a044bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/sys_common/backtrace.rs', 
                       Line: 150, Column: 0 }
  - String:          ''' not inlined into '''
  - Caller:          '_ZN4core3ops8function6FnOnce40call_once$u7b$$u7b$vtable.shim$u7d$$u7d$17hf46a5604f7ecaf3eE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''' because it should never be inlined '
  - String:          '(cost=never)'
  - String:          ': '
  - Reason:          noinline function attribute
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 165, Column: 17 }
Function:        _ZN3std2rt10lang_start17h553b022b5decff43E
Args:
  - Callee:          _ZN3std2rt19lang_start_internal17h58e5c2b0c2169c44E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2rt10lang_start17h553b022b5decff43E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                   Line: 165, Column: 17 }
Function:        _ZN3std2rt10lang_start17h553b022b5decff43E
Args:
  - Callee:          _ZN3std2rt19lang_start_internal17h58e5c2b0c2169c44E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2rt10lang_start17h553b022b5decff43E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/rt.rs', 
                       Line: 159, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 35, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 38, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          mi_malloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 36, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          mi_malloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 35, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 38, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          mi_malloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 36, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
Args:
  - Callee:          mi_malloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 32, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 15 }
Function:        __rust_alloc
Args:
  - String:          ''''
  - Callee:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$5alloc17h5e4a0d3d412940efE'
  - String:          ''' inlined into '''
  - Caller:          __rust_alloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-14920'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          __rust_alloc
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '15'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 59, Column: 9 }
Function:        __rust_dealloc
Args:
  - Callee:          mi_free
  - String:          ' will not be inlined into '
  - Caller:          __rust_dealloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 59, Column: 9 }
Function:        __rust_dealloc
Args:
  - Callee:          mi_free
  - String:          ' will not be inlined into '
  - Caller:          __rust_dealloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 71, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 74, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          mi_realloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 72, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          mi_realloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 71, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 74, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          mi_realloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 72, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
Args:
  - Callee:          mi_realloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 63, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 15 }
Function:        __rust_realloc
Args:
  - String:          ''''
  - Callee:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$7realloc17h93b6ad563d96237dE'
  - String:          ''' inlined into '''
  - Caller:          __rust_realloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-14920'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          __rust_realloc
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '15'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 48, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 51, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          mi_zalloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 49, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          mi_zalloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 48, Column: 22 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          _ZN12mimallocator21fundamental_alignment17h7b0d901c9cf11b0cE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 51, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          mi_zalloc_aligned
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                   Line: 49, Column: 13 }
Function:        '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
Args:
  - Callee:          mi_zalloc
  - String:          ' will not be inlined into '
  - Caller:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
    DebugLoc:        { File: '/home/kobzol/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mimallocator-0.1.3/src/lib.rs', 
                       Line: 45, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 15 }
Function:        __rust_alloc_zeroed
Args:
  - String:          ''''
  - Callee:          '_ZN75_$LT$mimallocator..Mimalloc$u20$as$u20$core..alloc..global..GlobalAlloc$GT$12alloc_zeroed17h270d42760dbe8b6bE'
  - String:          ''' inlined into '''
  - Caller:          __rust_alloc_zeroed
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-14920'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          __rust_alloc_zeroed
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '15'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 98, Column: 9 }
Function:        _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
Args:
  - String:          ''''
  - Callee:          __rust_alloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 176, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '80'
  - String:          ', threshold='
  - Threshold:       '250'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc5alloc17ha8621a78912994ecE
  - String:          ':'
  - Line:            '6'
  - String:          ':'
  - Column:          '9'
  - String:          ' @ '
  - String:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
  - String:          ':'
  - Line:            '5'
  - String:          ':'
  - Column:          '73'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 170, Column: 14 }
Function:        _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
Args:
  - String:          ''''
  - Callee:          __rust_alloc_zeroed
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 176, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '80'
  - String:          ', threshold='
  - Threshold:       '250'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc12alloc_zeroed17hf3c31f129e1df0dbE
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '14'
  - String:          ' @ '
  - String:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
  - String:          ':'
  - Line:            '5'
  - String:          ':'
  - Column:          '43'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 241, Column: 9 }
Function:        '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$8allocate17h42758c183b8cfb2eE'
Args:
  - String:          ''''
  - Callee:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 176, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$8allocate17h42758c183b8cfb2eE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 240, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '100'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$8allocate17h42758c183b8cfb2eE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '9'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 177, Column: 27 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - Callee:          _ZN5alloc7raw_vec17capacity_overflow17h49caa6b09f3d437eE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 189, Column: 27 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - Callee:          _ZN5alloc5alloc18handle_alloc_error17hf8ed70d85ae20e70E
  - String:          ' will not be inlined into '
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 177, Column: 27 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - Callee:          _ZN5alloc7raw_vec17capacity_overflow17h49caa6b09f3d437eE
  - String:          ' will not be inlined into '
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 189, Column: 27 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - Callee:          _ZN5alloc5alloc18handle_alloc_error17hf8ed70d85ae20e70E
  - String:          ' will not be inlined into '
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/alloc/layout.rs', 
                   Line: 433, Column: 16 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - String:          ''''
  - Callee:          _ZN4core5alloc6layout6Layout5array5inner17h84ba885c38e7072eE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/alloc/layout.rs', 
                       Line: 436, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-25'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core5alloc6layout6Layout5array17h17e50ba23fa1c864E
  - String:          ':'
  - Line:            '2'
  - String:          ':'
  - Column:          '16'
  - String:          ' @ '
  - String:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
  - String:          ':'
  - Line:            '7'
  - String:          ':'
  - Column:          '32'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 184, Column: 45 }
Function:        '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
Args:
  - String:          ''''
  - Callee:          '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$8allocate17h42758c183b8cfb2eE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 240, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '105'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
  - String:          ':'
  - Line:            '16'
  - String:          ':'
  - Column:          '45'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                   Line: 130, Column: 9 }
Function:        '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
Args:
  - String:          ''''
  - Callee:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$11allocate_in17h72a51c630162915fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 168, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader.rs', 
                       Line: 93, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '145'
  - String:          ', threshold='
  - Threshold:       '250'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$16with_capacity_in17h3e40c755a2fa20a3E'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '9'
  - String:          ' @ '
  - String:          '_ZN5alloc7raw_vec15RawVec$LT$T$GT$13with_capacity17hbc080b502a3792beE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '9'
  - String:          ' @ '
  - String:          '_ZN5alloc5boxed22Box$LT$$u5b$T$u5d$$GT$16new_uninit_slice17hcd51cfcf2341d13bE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '18'
  - String:          ' @ '
  - String:          _ZN3std2io8buffered9bufreader6buffer6Buffer13with_capacity17he49de4165492f635E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '19'
  - String:          ' @ '
  - String:          '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '33'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/boxed.rs', 
                   Line: 635, Column: 18 }
Function:        '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
Args:
  - String:          ''''
  - Callee:          '_ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$8into_box17h2528ab0753e97cf1E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/raw_vec.rs', 
                       Line: 153, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader.rs', 
                       Line: 93, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-35'
  - String:          ', threshold='
  - Threshold:       '375'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN5alloc5boxed22Box$LT$$u5b$T$u5d$$GT$16new_uninit_slice17hcd51cfcf2341d13bE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '18'
  - String:          ' @ '
  - String:          _ZN3std2io8buffered9bufreader6buffer6Buffer13with_capacity17he49de4165492f635E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '19'
  - String:          ' @ '
  - String:          '_ZN3std2io8buffered9bufreader18BufReader$LT$R$GT$13with_capacity17h1e938839d7b1b8adE'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '33'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                   Line: 250, Column: 5 }
Function:        _ZN4core3ops8function6FnOnce9call_once17h10862aaed384a85bE
Args:
  - String:          ''''
  - Callee:          '_ZN4core3cmp5impls50_$LT$impl$u20$core..cmp..Ord$u20$for$u20$usize$GT$3cmp17h9e23d13399acf65eE'
  - String:          ''' inlined into '''
  - Caller:          _ZN4core3ops8function6FnOnce9call_once17h10862aaed384a85bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15020'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core3ops8function6FnOnce9call_once17h10862aaed384a85bE
  - String:          ':'
  - Line:            '0'
  - String:          ':'
  - Column:          '5'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/cmp.rs', 
                   Line: 1241, Column: 11 }
Function:        _ZN4core3cmp6max_by17h709db21befafa9e3E
Args:
  - String:          ''''
  - Callee:          _ZN4core3ops8function6FnOnce9call_once17h10862aaed384a85bE
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/ops/function.rs', 
                       Line: 250, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN4core3cmp6max_by17h709db21befafa9e3E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/cmp.rs', 
                       Line: 1240, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-20'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core3cmp6max_by17h709db21befafa9e3E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '11'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                   Line: 26, Column: 9 }
Function:        '_ZN3std2io5impls57_$LT$impl$u20$std..io..Read$u20$for$u20$$RF$mut$u20$R$GT$8read_buf17h8751d3cc1903aad6E'
Args:
  - Callee:          '_ZN59_$LT$std..io..stdio..StdinLock$u20$as$u20$std..io..Read$GT$8read_buf17he9d85a0edb013f2cE'
  - String:          ' will not be inlined into '
  - Caller:          '_ZN3std2io5impls57_$LT$impl$u20$std..io..Read$u20$for$u20$$RF$mut$u20$R$GT$8read_buf17h8751d3cc1903aad6E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 25, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                   Line: 26, Column: 9 }
Function:        '_ZN3std2io5impls57_$LT$impl$u20$std..io..Read$u20$for$u20$$RF$mut$u20$R$GT$8read_buf17h8751d3cc1903aad6E'
Args:
  - Callee:          '_ZN59_$LT$std..io..stdio..StdinLock$u20$as$u20$std..io..Read$GT$8read_buf17he9d85a0edb013f2cE'
  - String:          ' will not be inlined into '
  - Caller:          '_ZN3std2io5impls57_$LT$impl$u20$std..io..Read$u20$for$u20$$RF$mut$u20$R$GT$8read_buf17h8751d3cc1903aad6E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 25, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/cmp.rs', 
                   Line: 794, Column: 9 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          ''''
  - Callee:          _ZN4core3cmp6max_by17h709db21befafa9e3E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/cmp.rs', 
                       Line: 1240, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                       Line: 100, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-35'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN4core3cmp3Ord3max17h10dab41b1209b26bE
  - String:          ':'
  - Line:            '4'
  - String:          ':'
  - Column:          '9'
  - String:          ' @ '
  - String:          _ZN4core3cmp3max17hae4946db965cca35E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '8'
  - String:          ' @ '
  - String:          _ZN3std2io7readbuf11BorrowedBuf8set_init17hdd27df897cb6d85bE
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '21'
  - String:          ' @ '
  - String:          _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
  - String:          ':'
  - Line:            '11'
  - String:          ':'
  - Column:          '21'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 114, Column: 13 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          ''''
  - Callee:          '_ZN3std2io5impls57_$LT$impl$u20$std..io..Read$u20$for$u20$$RF$mut$u20$R$GT$8read_buf17h8751d3cc1903aad6E'
  - String:          ''' inlined into '''
  - Caller:          _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                       Line: 100, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15000'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
  - String:          ':'
  - Line:            '14'
  - String:          ':'
  - Column:          '13'
  - String:          ';'
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 86, Column: 9 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 72, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 92, Column: 9 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 141, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Passed
Pass:            gvn
Name:            LoadPRE
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 42, Column: 53 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          load eliminated by PRE
...
--- !Passed
Pass:            gvn
Name:            LoadElim
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 42, Column: 76 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' eliminated'
  - String:          ' in favor of '
  - InfavorOfValue:  phi
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                       Line: 42, Column: 76 }
...
--- !Passed
Pass:            gvn
Name:            LoadElim
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                   Line: 42, Column: 86 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' eliminated'
  - String:          ' in favor of '
  - InfavorOfValue:  phi
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader/buffer.rs', 
                       Line: 42, Column: 86 }
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 86, Column: 9 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 72, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 92, Column: 9 }
Function:        _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 141, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader.rs', 
                   Line: 379, Column: 9 }
Function:        '_ZN85_$LT$std..io..buffered..bufreader..BufReader$LT$R$GT$$u20$as$u20$std..io..BufRead$GT$8fill_buf17hbbd87cf198af99d3E'
Args:
  - String:          ''''
  - Callee:          _ZN3std2io8buffered9bufreader6buffer6Buffer8fill_buf17ha1cb2615d5835440E
  - String:          ''' inlined into '''
  - Caller:          '_ZN85_$LT$std..io..buffered..bufreader..BufReader$LT$R$GT$$u20$as$u20$std..io..BufRead$GT$8fill_buf17hbbd87cf198af99d3E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/buffered/bufreader.rs', 
                       Line: 378, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-14880'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN85_$LT$std..io..buffered..bufreader..BufReader$LT$R$GT$$u20$as$u20$std..io..BufRead$GT$8fill_buf17hbbd87cf198af99d3E'
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '9'
  - String:          ';'
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 86, Column: 9 }
Function:        '_ZN85_$LT$std..io..buffered..bufreader..BufReader$LT$R$GT$$u20$as$u20$std..io..BufRead$GT$8fill_buf17hbbd87cf198af99d3E'
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 72, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Missed
Pass:            gvn
Name:            LoadClobbered
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                   Line: 92, Column: 9 }
Function:        '_ZN85_$LT$std..io..buffered..bufreader..BufReader$LT$R$GT$$u20$as$u20$std..io..BufRead$GT$8fill_buf17hbbd87cf198af99d3E'
Args:
  - String:          'load of type '
  - Type:            i64
  - String:          ' not eliminated'
  - String:          ' in favor of '
  - OtherAccess:     store
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/readbuf.rs', 
                       Line: 141, Column: 9 }
  - String:          ' because it is clobbered by '
  - ClobberedBy:     call
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/impls.rs', 
                       Line: 26, Column: 9 }
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                   Line: 258, Column: 24 }
Function:        _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
Args:
  - String:          ''''
  - Callee:          _ZN3std2io5error14repr_bitpacked14kind_from_prim17hd565108c6a94f335E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                       Line: 289, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                       Line: 246, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '195'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
  - String:          ':'
  - Line:            '12'
  - String:          ':'
  - Column:          '24'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                   Line: 276, Column: 31 }
Function:        _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
Args:
  - String:          ''''
  - Callee:          '_ZN3std2io5error14repr_bitpacked4Repr4data28_$u7b$$u7b$closure$u7d$$u7d$17h74c31adbfe65ddcfE'
  - String:          ''' inlined into '''
  - Caller:          _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                       Line: 246, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15035'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
  - String:          ':'
  - Line:            '30'
  - String:          ':'
  - Column:          '31'
  - String:          ';'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error.rs', 
                   Line: 913, Column: 36 }
Function:        _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
Args:
  - Callee:          _ZN3std3sys4unix17decode_error_kind17h91e167953d5bee68E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error.rs', 
                       Line: 911, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Missed
Pass:            inline
Name:            NoDefinition
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error.rs', 
                   Line: 913, Column: 36 }
Function:        _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
Args:
  - Callee:          _ZN3std3sys4unix17decode_error_kind17h91e167953d5bee68E
  - String:          ' will not be inlined into '
  - Caller:          _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error.rs', 
                       Line: 911, Column: 0 }
  - String:          ' because its definition is unavailable'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error/repr_bitpacked.rs', 
                   Line: 212, Column: 18 }
Function:        _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
Args:
  - String:          ''''
  - Callee:          _ZN3std2io5error14repr_bitpacked11decode_repr17h99007df23d113881E
  - String:          ''' inlined into '''
  - Caller:          _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/std/src/io/error.rs', 
                       Line: 911, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-14750'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN3std2io5error14repr_bitpacked4Repr4data17hd6ba9b9f486c8881E
  - String:          ':'
  - Line:            '2'
  - String:          ':'
  - Column:          '18'
  - String:          ' @ '
  - String:          _ZN3std2io5error5Error4kind17hbd063f975c9a6bc2E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '25'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/result.rs', 
                   Line: 829, Column: 27 }
Function:        '_ZN4core6result19Result$LT$T$C$E$GT$7map_err17h4d23d63bf95dec92E'
Args:
  - String:          ''''
  - Callee:          '_ZN5alloc7raw_vec11finish_grow28_$u7b$$u7b$closure$u7d$$u7d$17h3a68ffc23693f631E'
  - String:          ''' inlined into '''
  - Caller:          '_ZN4core6result19Result$LT$T$C$E$GT$7map_err17h4d23d63bf95dec92E'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/core/src/result.rs', 
                       Line: 826, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-15030'
  - String:          ', threshold='
  - Threshold:       '487'
  - String:          ')'
  - String:          ' at callsite '
  - String:          '_ZN4core6result19Result$LT$T$C$E$GT$7map_err17h4d23d63bf95dec92E'
  - String:          ':'
  - Line:            '3'
  - String:          ':'
  - Column:          '27'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 117, Column: 14 }
Function:        '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hee84bdc60637090fE'
Args:
  - String:          ''''
  - Callee:          __rust_dealloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hee84bdc60637090fE'
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 250, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '-10'
  - String:          ', threshold='
  - Threshold:       '375'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc7dealloc17hd511352e90405d82E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '14'
  - String:          ' @ '
  - String:          '_ZN63_$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Allocator$GT$10deallocate17hee84bdc60637090fE'
  - String:          ':'
  - Line:            '4'
  - String:          ':'
  - Column:          '22'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 203, Column: 18 }
Function:        _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
Args:
  - String:          ''''
  - Callee:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 176, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 190, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '100'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
  - String:          ':'
  - Line:            '13'
  - String:          ':'
  - Column:          '18'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 227, Column: 31 }
Function:        _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
Args:
  - String:          ''''
  - Callee:          _ZN5alloc5alloc6Global10alloc_impl17hae3197e0a1e7c5d9E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 176, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 190, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '100'
  - String:          ', threshold='
  - Threshold:       '325'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
  - String:          ':'
  - Line:            '37'
  - String:          ':'
  - Column:          '31'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                   Line: 136, Column: 14 }
Function:        _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
Args:
  - String:          ''''
  - Callee:          __rust_realloc
    DebugLoc:        { File: 'src/main.rs', Line: 14, Column: 0 }
  - String:          ''' inlined into '''
  - Caller:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
    DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/alloc/src/alloc.rs', 
                       Line: 190, Column: 0 }
  - String:          ''''
  - String:          ' with '
  - String:          '(cost='
  - Cost:            '80'
  - String:          ', threshold='
  - Threshold:       '250'
  - String:          ')'
  - String:          ' at callsite '
  - String:          _ZN5alloc5alloc7realloc17h1b9d254a7d2faa46E
  - String:          ':'
  - Line:            '1'
  - String:          ':'
  - Column:          '14'
  - String:          ' @ '
  - String:          _ZN5alloc5alloc6Global9grow_impl17h543cc8625ad02321E
  - String:          ':'
  - Line:            '23'
  - String:          ':'
  - Column:          '31'
  - String:          ';'
...
--- !Passed
Pass:            inline
Name:            Inlined
DebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d6476efa0c10888/library/all
Download .txt
gitextract_4uul3359/

├── .github/
│   └── workflows/
│       └── check.yml
├── .gitignore
├── CHANGELOG.md
├── Cargo.toml
├── LICENSE
├── README.md
├── src/
│   ├── bin/
│   │   └── analyze-remarks.rs
│   ├── cargo/
│   │   ├── mod.rs
│   │   └── version.rs
│   ├── lib.rs
│   ├── main.rs
│   ├── remark/
│   │   ├── mod.rs
│   │   └── parse.rs
│   ├── render.rs
│   └── utils/
│       ├── callback.rs
│       ├── cli.rs
│       ├── data_structures.rs
│       ├── io.rs
│       ├── mod.rs
│       └── timing.rs
├── templates/
│   ├── index.jinja
│   ├── layout.html
│   ├── menu.html
│   ├── remark-list.jinja
│   └── source-file.jinja
└── tests/
    ├── data/
    │   ├── remarks-1/
    │   │   ├── 37v4yjwjhlguzgkm.codegen.opt.yaml
    │   │   ├── 37v4yjwjhlguzgkm.opt.opt.yaml
    │   │   ├── remarks.67ea4a01cbc73fb0-cgu.0.codegen.opt.yaml
    │   │   └── remarks.67ea4a01cbc73fb0-cgu.0.opt.opt.yaml
    │   └── remarks-similarity-join/
    │       ├── src/
    │       │   ├── common.rs
    │       │   ├── main.rs
    │       │   ├── record.rs
    │       │   └── util.rs
    │       └── yaml/
    │           ├── similarity_join.548e4531baa98255-cgu.0.codegen.opt.yaml
    │           └── similarity_join.548e4531baa98255-cgu.0.opt.opt.yaml
    └── integration/
        ├── analyze.rs
        ├── build.rs
        ├── main.rs
        └── utils/
            └── mod.rs
Download .txt
SYMBOL INDEX (150 symbols across 21 files)

FILE: src/bin/analyze-remarks.rs
  type Args (line 17) | struct Args {
  function analyze (line 55) | fn analyze(args: Args) -> anyhow::Result<()> {
  function main (line 94) | fn main() -> anyhow::Result<()> {

FILE: src/cargo/mod.rs
  type CargoSubcommand (line 12) | pub enum CargoSubcommand {
  type BuildOutput (line 17) | pub struct BuildOutput {
  function run_cargo (line 23) | pub fn run_cargo(subcmd: CargoSubcommand, cargo_args: Vec<String>) -> an...
  function get_rustc_source_root (line 85) | pub fn get_rustc_source_root() -> anyhow::Result<RustcSourceRoot> {
  function set_cargo_env (line 95) | fn set_cargo_env(command: &mut Command, flags: &str) {
  type CargoArgs (line 106) | struct CargoArgs {
  function parse_cargo_args (line 110) | fn parse_cargo_args(cargo_args: Vec<String>) -> CargoArgs {
  type CargoContext (line 125) | struct CargoContext {
    method get_target_directory (line 131) | fn get_target_directory(&self, path: &Path) -> anyhow::Result<PathBuf> {
  function get_cargo_ctx (line 139) | fn get_cargo_ctx() -> anyhow::Result<CargoContext> {

FILE: src/cargo/version.rs
  function check_remark_dir_support (line 4) | pub fn check_remark_dir_support() -> anyhow::Result<bool> {

FILE: src/lib.rs
  constant DEFAULT_KIND_FILTER (line 7) | pub const DEFAULT_KIND_FILTER: &[&str] = &["FastISelFailure", "NeverInli...
  type RustcSourceRoot (line 10) | pub struct RustcSourceRoot(pub PathBuf);
    method from_sysroot (line 13) | pub fn from_sysroot(path: PathBuf) -> anyhow::Result<Self> {

FILE: src/main.rs
  type Args (line 22) | enum Args {
  type Subcommand (line 29) | enum Subcommand {
  type SharedArgs (line 39) | struct SharedArgs {
  function generate_remarks (line 61) | fn generate_remarks(subcmd: CargoSubcommand, args: SharedArgs) -> anyhow...
  function main (line 110) | fn main() -> anyhow::Result<()> {

FILE: src/remark/mod.rs
  constant EXPECTED_EXTENSION (line 25) | const EXPECTED_EXTENSION: &str = ".opt.yaml";
  type Line (line 27) | pub type Line = u32;
  type Column (line 28) | pub type Column = u32;
  type Location (line 31) | pub struct Location {
  type Function (line 38) | pub struct Function {
  type MessagePart (line 44) | pub enum MessagePart {
  type Remark (line 50) | pub struct Remark {
  type RemarkLoadOptions (line 59) | pub struct RemarkLoadOptions {
    method from (line 470) | fn from(value: Options) -> Self {
  function load_remarks_from_file (line 70) | pub fn load_remarks_from_file<P: AsRef<Path>>(
  function parse_remarks (line 91) | fn parse_remarks<R: std::io::Read>(reader: R, options: &RemarkLoadOption...
  function append_vectorization_analysis_to_remarks (line 199) | fn append_vectorization_analysis_to_remarks(
  function construct_message (line 251) | fn construct_message(opts: &RemarkLoadOptions, arguments: Vec<RemarkArg>...
  function load_remarks_from_dir (line 324) | pub fn load_remarks_from_dir<P: AsRef<Path>>(
  function parse_debug_loc (line 389) | fn parse_debug_loc(options: &RemarkLoadOptions, location: parse::DebugLo...
  function normalize_path (line 399) | fn normalize_path(options: &RemarkLoadOptions, path: Cow<str>) -> String {
  function demangle (line 416) | fn demangle(function: &str) -> String {
  type Options (line 434) | struct Options {
    method filter (line 442) | fn filter(mut self, kind: &str) -> Self {
    method rustc_source_root (line 447) | fn rustc_source_root(mut self, path: &str) -> Self {
    method external (line 452) | fn external(mut self, external: bool) -> Self {
  method default (line 459) | fn default() -> Self {
  function parse_single (line 487) | fn parse_single() {
  function parse_multiple (line 527) | fn parse_multiple() {
  function parse_no_location (line 623) | fn parse_no_location() {
  function parse_ignored_type (line 638) | fn parse_ignored_type() {
  function parse_gvn (line 687) | fn parse_gvn() {
  function parse_filter (line 708) | fn parse_filter() {
  function parse_hotness (line 729) | fn parse_hotness() {
  function parse_remap_rust_source (line 778) | fn parse_remap_rust_source() {
  function parse (line 810) | fn parse(input: &str, opts: Options) -> Vec<Remark> {

FILE: src/remark/parse.rs
  type DebugLocation (line 6) | pub struct DebugLocation<'a> {
  type RemarkArgString (line 15) | pub struct RemarkArgString<'a> {
  type RemarkArgCallee (line 22) | pub struct RemarkArgCallee<'a> {
  type RemarkArgCaller (line 30) | pub struct RemarkArgCaller<'a> {
  type RemarkArgReason (line 38) | pub struct RemarkArgReason<'a> {
  type RemarkArg (line 45) | pub enum RemarkArg<'a> {
  type MissedRemark (line 56) | pub struct MissedRemark<'a> {
  type AnalysisRemark (line 70) | pub struct AnalysisRemark<'a> {
  type Remark (line 83) | pub enum Remark<'a> {

FILE: src/render.rs
  constant INDEX_FILE_PATH (line 18) | pub const INDEX_FILE_PATH: &str = "index.html";
  constant REMARK_LIST_FILE_PATH (line 19) | const REMARK_LIST_FILE_PATH: &str = "remarks.html";
  constant SRC_DIR_NAME (line 23) | const SRC_DIR_NAME: &str = "src";
  type StaticAssets (line 27) | struct StaticAssets;
  type RemarkIndexEntry (line 30) | struct RemarkIndexEntry<'a> {
  type RemarkSourceEntry (line 39) | struct RemarkSourceEntry<'a> {
  type RemarkListTemplate (line 49) | pub struct RemarkListTemplate {
  type SourceFileLink (line 54) | struct SourceFileLink<'a> {
  type IndexTemplate (line 62) | pub struct IndexTemplate<'a> {
  type SourceFileTemplate (line 68) | pub struct SourceFileTemplate<'a> {
  function render_remarks (line 74) | pub fn render_remarks(
  function format_message (line 257) | fn format_message(parts: &[MessagePart], prefix: Option<&str>) -> String {
  function render_remark_link (line 273) | fn render_remark_link(
  function path_to_relative_url (line 295) | fn path_to_relative_url(buffer: &mut String, prefix: Option<&str>, path:...
  function resolve_path (line 327) | fn resolve_path<'a>(root_dir: &Path, path: &'a Path) -> Cow<'a, Path> {
  function render_to_file (line 335) | fn render_to_file<T: askama::Template>(template: &T, path: &Path) -> any...
  function relative_path_c_prefix (line 356) | fn relative_path_c_prefix() {
  function relative_path_absolute (line 361) | fn relative_path_absolute() {
  function relative_path_relative (line 366) | fn relative_path_relative() {
  function check_path (line 370) | fn check_path(path: &str, expected: &str) {

FILE: src/utils/callback.rs
  type LoadCallback (line 3) | pub trait LoadCallback {
    method start (line 4) | fn start(&self, count: u64);
    method advance (line 5) | fn advance(&self);
    method finish (line 6) | fn finish(&self);
    method start (line 22) | fn start(&self, count: u64) {
    method advance (line 26) | fn advance(&self) {
    method finish (line 30) | fn finish(&self) {
  type ProgressBarCallback (line 9) | pub struct ProgressBarCallback {
  method default (line 14) | fn default() -> Self {

FILE: src/utils/cli.rs
  function cli_format_path (line 5) | pub fn cli_format_path<P: AsRef<Path>>(path: P) -> ColoredString {

FILE: src/utils/data_structures.rs
  type Map (line 3) | pub type Map<K, V> = hashbrown::HashMap<K, V, FxBuildHasher>;
  type Set (line 4) | pub type Set<V> = hashbrown::HashSet<V, FxBuildHasher>;

FILE: src/utils/io.rs
  function ensure_directory (line 4) | pub fn ensure_directory(path: &Path) -> std::io::Result<PathBuf> {
  function clear_directory (line 10) | pub fn clear_directory(path: &Path) -> std::io::Result<PathBuf> {

FILE: src/utils/mod.rs
  function open_result (line 11) | pub fn open_result(dir: &Path, open: bool) -> anyhow::Result<()> {

FILE: src/utils/timing.rs
  function time_block_log_debug (line 3) | pub fn time_block_log_debug<F: FnOnce() -> R, R>(label: &str, f: F) -> R {
  function time_block_log_info (line 10) | pub fn time_block_log_info<F: FnOnce() -> R, R>(label: &str, f: F) -> R {
  function time_block_print (line 17) | pub fn time_block_print<F: FnOnce() -> R, R>(label: &str, f: F) -> R {

FILE: tests/data/remarks-similarity-join/src/common.rs
  type Map (line 1) | pub type Map<K, V> = hashbrown::HashMap<K, V, fxhash::FxBuildHasher>;

FILE: tests/data/remarks-similarity-join/src/main.rs
  function calculate_query (line 17) | fn calculate_query(relation: Relation, threshold: f32) -> u64 {
  function main (line 133) | fn main() {

FILE: tests/data/remarks-similarity-join/src/record.rs
  type Element (line 8) | pub type Element = u32;
  type Record (line 10) | pub type Record = Vec<Element>;
  type Ordering (line 12) | type Ordering = byteorder::LittleEndian;
  type Relation (line 15) | pub struct Relation {
  function load_relation (line 22) | pub fn load_relation(path: &str) -> anyhow::Result<Relation> {

FILE: tests/data/remarks-similarity-join/src/util.rs
  type ForceUnwrap (line 3) | pub trait ForceUnwrap {
    method unwrap_force (line 6) | fn unwrap_force(self) -> Self::Target;
    type Target (line 10) | type Target = T;
    method unwrap_force (line 12) | fn unwrap_force(self) -> Self::Target {
    type Target (line 29) | type Target = T;
    method unwrap_force (line 31) | fn unwrap_force(self) -> Self::Target {
  type Sliced (line 54) | pub trait Sliced<T> {
    method slice (line 55) | fn slice(&self, start: usize, end: usize) -> &[T];
  function slice (line 60) | fn slice(&self, start: usize, len: usize) -> &[T] {

FILE: tests/integration/analyze.rs
  function analyze_directory (line 4) | fn analyze_directory() -> anyhow::Result<()> {
  function create_source_file (line 24) | fn create_source_file() -> anyhow::Result<()> {

FILE: tests/integration/build.rs
  constant INLINE_NEVER_SOURCE (line 5) | const INLINE_NEVER_SOURCE: &str = r#"
  function test_build_filter (line 15) | fn test_build_filter() -> anyhow::Result<()> {
  function test_generate_remarks (line 24) | fn test_generate_remarks() -> anyhow::Result<()> {
  function normalize_location (line 67) | fn normalize_location(location: Option<&Location>) -> Option<Location> {
  function load_remarks (line 75) | fn load_remarks(path: &Path, filter: Vec<String>) -> Vec<Remark> {

FILE: tests/integration/utils/mod.rs
  function cargo_remark (line 5) | pub fn cargo_remark(dir: &Path, args: &[&str]) -> anyhow::Result<Output> {
  function analyze_remarks (line 24) | pub fn analyze_remarks(dir: &Path, args: &[&str]) -> anyhow::Result<Outp...
  type OutputExt (line 42) | pub trait OutputExt {
    method assert_ok (line 43) | fn assert_ok(self) -> Self;
    method assert_error (line 44) | fn assert_error(self) -> Self;
    method stdout (line 46) | fn stdout(&self) -> String;
    method stderr (line 47) | fn stderr(&self) -> String;
    method assert_ok (line 51) | fn assert_ok(self) -> Self {
    method assert_error (line 60) | fn assert_error(self) -> Self {
    method stdout (line 69) | fn stdout(&self) -> String {
    method stderr (line 73) | fn stderr(&self) -> String {
  function get_target_dir (line 78) | fn get_target_dir() -> PathBuf {
  function get_test_data_path (line 85) | pub fn get_test_data_path<P: AsRef<Path>>(path: P) -> PathBuf {
  type HTMLDir (line 92) | pub struct HTMLDir {
    method new (line 97) | pub fn new(dir: &Path) -> Self {
    method check_index (line 103) | pub fn check_index(&self) {
    method check_source (line 107) | pub fn check_source(&self, file: &str) {
    method check_exists (line 111) | fn check_exists<P: AsRef<Path>>(&self, path: P) {
  type CargoProject (line 118) | pub struct CargoProject {
    method path (line 124) | pub fn path<P: Into<PathBuf>>(&self, path: P) -> PathBuf {
    method file (line 129) | pub fn file<P: AsRef<Path>>(&mut self, path: P, code: &str) -> &mut Se...
    method remark_dir (line 135) | pub fn remark_dir(&self) -> PathBuf {
    method default_out_dir (line 139) | pub fn default_out_dir(&self) -> HTMLDir {
    method out_dir (line 143) | fn out_dir(&self, path: &Path) -> HTMLDir {
  method drop (line 149) | fn drop(&mut self) {
  function init_cargo_project (line 158) | pub fn init_cargo_project() -> anyhow::Result<CargoProject> {
Condensed preview — 39 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,056K chars).
[
  {
    "path": ".github/workflows/check.yml",
    "chars": 1108,
    "preview": "## Based on https://github.com/actions-rs/meta/blob/master/recipes/quickstart.md\nname: Check\n\non:\n  push:\n    branches:\n"
  },
  {
    "path": ".gitignore",
    "chars": 8,
    "preview": "/target\n"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 503,
    "preview": "# 0.1.2 (28. 9. 2023)\n## Fixes:\n- Fix parsing of the `--filter` CLI parameter (https://github.com/Kobzol/cargo-remark/is"
  },
  {
    "path": "Cargo.toml",
    "chars": 1300,
    "preview": "[package]\nname = \"cargo-remark\"\nversion = \"0.1.2\"\nedition = \"2021\"\n#rust-version = \"1.72.0\"\n\ndescription = \"Cargo subcom"
  },
  {
    "path": "LICENSE",
    "chars": 1079,
    "preview": "MIT License\n\nCopyright (c) 2023-present, Jakub Beránek\n\nPermission is hereby granted, free of charge, to any person\nobta"
  },
  {
    "path": "README.md",
    "chars": 5158,
    "preview": "# `cargo-remark` [![Build Status]][actions] [![Latest Version]][crates.io]\n\n[Build Status]: https://github.com/kobzol/ca"
  },
  {
    "path": "src/bin/analyze-remarks.rs",
    "chars": 2885,
    "preview": "use cargo_remark::remark::{load_remarks_from_dir, RemarkLoadOptions};\nuse cargo_remark::render::render_remarks;\nuse carg"
  },
  {
    "path": "src/cargo/mod.rs",
    "chars": 4304,
    "preview": "use std::path::{Path, PathBuf};\nuse std::process::{Command, Stdio};\n\nuse anyhow::Context;\n\nuse cargo_remark::utils::cli:"
  },
  {
    "path": "src/cargo/version.rs",
    "chars": 770,
    "preview": "use std::process::Command;\n\n/// Returns true if the currently used rustc supports `-Zremark-dir`.\npub fn check_remark_di"
  },
  {
    "path": "src/lib.rs",
    "chars": 595,
    "preview": "use std::path::PathBuf;\n\npub mod remark;\npub mod render;\npub mod utils;\n\npub const DEFAULT_KIND_FILTER: &[&str] = &[\"Fas"
  },
  {
    "path": "src/main.rs",
    "chars": 3590,
    "preview": "mod cargo;\n\nuse cargo::version::check_remark_dir_support;\nuse cargo::{get_rustc_source_root, run_cargo, CargoSubcommand}"
  },
  {
    "path": "src/remark/mod.rs",
    "chars": 27757,
    "preview": "use std::borrow::Cow;\nuse std::collections::BTreeMap;\nuse std::fs::File;\nuse std::hash::Hash;\nuse std::io::BufReader;\nus"
  },
  {
    "path": "src/remark/parse.rs",
    "chars": 2171,
    "preview": "use std::borrow::Cow;\nuse std::collections::BTreeMap;\n\n#[derive(serde::Deserialize, Debug)]\n#[serde(rename_all = \"Pascal"
  },
  {
    "path": "src/render.rs",
    "chars": 12257,
    "preview": "use std::borrow::Cow;\nuse std::fmt::Write;\nuse std::fs::File;\nuse std::io::BufWriter;\nuse std::path::{Component, Path, P"
  },
  {
    "path": "src/utils/callback.rs",
    "chars": 583,
    "preview": "use indicatif::ProgressBar;\n\npub trait LoadCallback {\n    fn start(&self, count: u64);\n    fn advance(&self);\n    fn fin"
  },
  {
    "path": "src/utils/cli.rs",
    "chars": 241,
    "preview": "use colored::{ColoredString, Colorize};\nuse std::path::Path;\n\n/// Formats a path in a unified format to be printed in CL"
  },
  {
    "path": "src/utils/data_structures.rs",
    "chars": 146,
    "preview": "use fxhash::FxBuildHasher;\n\npub type Map<K, V> = hashbrown::HashMap<K, V, FxBuildHasher>;\npub type Set<V> = hashbrown::H"
  },
  {
    "path": "src/utils/io.rs",
    "chars": 393,
    "preview": "use std::path::{Path, PathBuf};\n\n/// Make sure that directory exists.\npub fn ensure_directory(path: &Path) -> std::io::R"
  },
  {
    "path": "src/utils/mod.rs",
    "chars": 690,
    "preview": "use crate::render::INDEX_FILE_PATH;\nuse crate::utils::cli::cli_format_path;\nuse std::path::Path;\n\npub mod callback;\npub "
  },
  {
    "path": "src/utils/timing.rs",
    "chars": 659,
    "preview": "use std::time::Instant;\n\npub fn time_block_log_debug<F: FnOnce() -> R, R>(label: &str, f: F) -> R {\n    let start = Inst"
  },
  {
    "path": "templates/index.jinja",
    "chars": 354,
    "preview": "{% extends \"layout.html\" %}\n\n{% block title %}File list{% endblock %}\n\n{% block content %}\n{% include \"menu.html\" %}\n<di"
  },
  {
    "path": "templates/layout.html",
    "chars": 268,
    "preview": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>{% block title %}{% endblock %}</title>\n  "
  },
  {
    "path": "templates/menu.html",
    "chars": 124,
    "preview": "<nav style=\"margin-bottom: 10px;\">\n    <a href=\"index.html\">File list</a>\n    <a href=\"remarks.html\">Remark list</a>\n</n"
  },
  {
    "path": "templates/remark-list.jinja",
    "chars": 1364,
    "preview": "{% extends \"layout.html\" %}\n\n{% block title %}Remark list{% endblock %}\n\n{% block head %}\n{% call super() %}\n<link rel=\""
  },
  {
    "path": "templates/source-file.jinja",
    "chars": 2999,
    "preview": "{% extends \"layout.html\" %}\n\n{% block title %}File {{ path }}{% endblock %}\n\n{% block head %}\n{% call super() %}\n<link r"
  },
  {
    "path": "tests/data/remarks-1/37v4yjwjhlguzgkm.codegen.opt.yaml",
    "chars": 10656,
    "preview": "--- !Missed\nPass:            sdagisel\nName:            FastISelFailure\nFunction:        __rust_alloc\nArgs:\n  - String:  "
  },
  {
    "path": "tests/data/remarks-1/37v4yjwjhlguzgkm.opt.opt.yaml",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/data/remarks-1/remarks.67ea4a01cbc73fb0-cgu.0.codegen.opt.yaml",
    "chars": 22404,
    "preview": "--- !Analysis\nPass:            size-info\nName:            FunctionMISizeChange\nDebugLoc:        { File: '/foo/rust/libra"
  },
  {
    "path": "tests/data/remarks-1/remarks.67ea4a01cbc73fb0-cgu.0.opt.opt.yaml",
    "chars": 10898,
    "preview": "--- !Passed\nPass:            inline\nName:            Inlined\nDebugLoc:        { File: '/foo/rust/library/std/src/sys_com"
  },
  {
    "path": "tests/data/remarks-similarity-join/src/common.rs",
    "chars": 70,
    "preview": "pub type Map<K, V> = hashbrown::HashMap<K, V, fxhash::FxBuildHasher>;\n"
  },
  {
    "path": "tests/data/remarks-similarity-join/src/main.rs",
    "chars": 6735,
    "preview": "#![feature(core_intrinsics)]\n\nuse std::io::{BufRead, BufReader, Write};\nuse std::str::FromStr;\n\nuse crate::record::{load"
  },
  {
    "path": "tests/data/remarks-similarity-join/src/record.rs",
    "chars": 1707,
    "preview": "use crate::common::Map;\nuse byteorder::ReadBytesExt;\nuse fxhash::FxBuildHasher;\nuse std::io::BufReader;\n\nuse crate::util"
  },
  {
    "path": "tests/data/remarks-similarity-join/src/util.rs",
    "chars": 1466,
    "preview": "use std::fmt::Debug;\n\npub trait ForceUnwrap {\n    type Target;\n\n    fn unwrap_force(self) -> Self::Target;\n}\n\nimpl<T> Fo"
  },
  {
    "path": "tests/data/remarks-similarity-join/yaml/similarity_join.548e4531baa98255-cgu.0.opt.opt.yaml",
    "chars": 2852499,
    "preview": "--- !Passed\nPass:            inline\nName:            Inlined\nDebugLoc:        { File: '/rustc/08d00b40aef2017fe6dba3ff7d"
  },
  {
    "path": "tests/integration/analyze.rs",
    "chars": 1147,
    "preview": "use crate::utils::{analyze_remarks, get_test_data_path, HTMLDir, OutputExt};\n\n#[test]\nfn analyze_directory() -> anyhow::"
  },
  {
    "path": "tests/integration/build.rs",
    "chars": 2322,
    "preview": "use crate::utils::{cargo_remark, init_cargo_project, OutputExt};\nuse cargo_remark::remark::{load_remarks_from_dir, Locat"
  },
  {
    "path": "tests/integration/main.rs",
    "chars": 35,
    "preview": "mod analyze;\nmod build;\nmod utils;\n"
  },
  {
    "path": "tests/integration/utils/mod.rs",
    "chars": 4500,
    "preview": "use std::path::{Path, PathBuf};\nuse std::process::{Command, Output, Stdio};\nuse tempfile::TempDir;\n\npub fn cargo_remark("
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the Kobzol/cargo-remark GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 39 files (13.9 MB), approximately 748.4k tokens, and a symbol index with 150 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!