rustc-basics

Configure Rust compiler invocation settings and inspect MIR or assembly outputs.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill rustc-basics-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rustc-basics
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/rustc-basics
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill rustc-basics-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Configure and optimize Rust compiler invocations to improve build performance, binary size, and diagnostics when debugging or profiling Rust code.

Core Features & Use Cases

  • Configure RUSTFLAGS for target CPU, optimization, and codegen settings
  • Inspect MIR and assembly outputs to diagnose performance or size issues
  • Tune Cargo profiles (release/debug) to balance speed and debugging information
  • Understand monomorphization and codegen units impacts on binary size and compile time

Quick Start

Explain how to configure Rust build profiles and RUSTFLAGS for a release-optimized binary and how to inspect MIR and assembly output.

Frequently Asked Questions about rustc-basics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure RUSTFLAGS for a Rust release-optimized binary?

Tune Rust compiler flags for a release-optimized binary by configuring Cargo profiles and RUSTFLAGS with opt-level, LTO, and codegen-units settings. This balances compile time, binary size, and runtime performance across debug and release modes.

How do I inspect MIR and assembly output in Rust to diagnose performance issues?

Inspect MIR and assembly output in Rust by invoking rustc with specific flags to emit intermediate representations. This workflow exposes monomorphization outcomes and codegen details to diagnose performance or binary size issues.

What is the best way to tune Cargo profiles for Rust build optimization?

The best way to tune Cargo profiles for Rust build optimization is adjusting opt-level, panic settings, and codegen-units. This customizes debug information and codegen behavior to balance compilation speed and runtime performance.

How do codegen-units and monomorphization impact Rust binary size and compile time?

Codegen-units and monomorphization impact Rust binary size and compile time by controlling parallel compilation granularity and generic instantiation. Tuning these rustc settings helps manage the tradeoff between build performance and final executable footprint.

Why does adjusting panic settings in Cargo profiles matter for Rust compilation?

Adjusting panic settings in Cargo profiles matters for Rust compilation because it alters unwinding behavior and codegen paths. Configuring panic options within RUSTFLAGS or profiles directly impacts binary size and runtime performance.