OpenSource-Hub

rust

기타

rust-lang/rust

Rust 언어의 메인 저장소로, 컴파일러, 표준 라이브러리 및 문서를 포함합니다.

개요

Rust 프로그래밍 언어의 공식 소스 코드 저장소로, rustc 컴파일러, 표준 라이브러리 및 문서를 포함합니다. Rust는 성능과 메모리 안전성을 중시하며, 가비지 컬렉션 없이도 스레드 안전성을 보장하고, Cargo 패키지 관리자, rustfmt 포맷팅 도구, Clippy 정적 검사 등 완전한 툴체인을 제공합니다.

README 미리보기

\n  \n    \n    \n    \n  \n\n[Website][Rust] | [Getting started] | [Learn] | [Documentation] | [Contributing]\n\n\nThis is the main source code repository for [Rust]. It contains the compiler,\nstandard library, and documentation.\n\n[Rust]: https://www.rust-lang.org/\n[Getting Started]: https://www.rust-lang.org/learn/get-started\n[Learn]: https://www.rust-lang.org/learn\n[Documentation]: https://www.rust-lang.org/learn#learn-use\n[Contributing]: CONTRIBUTING.md\n\n## Why Rust?\n\n- **Performance:** Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrated with other languages.\n\n- **Reliability:** Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.\n\n- **Productivity:** Comprehensive documentation, a compiler committed to providing great diagnostics, and advanced tooling including package manager and build tool ([Cargo]), auto-formatter ([rustfmt]), linter ([Clippy]) and editor support ([rust-analyzer]).\n\n[Cargo]: https://github.com/rust-lang/cargo\n[rustfmt]: https://github.com/rust-lang/rustfmt\n[Clippy]: https://github.com/rust-lang/rust-clippy\n[rust-analyzer]: https://github.com/rust-lang/rust-analyzer\n\n## Quick Start\n\nRead ["Installation"] from [The Book].\n\n["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html\n[The Book]: https://doc.rust-lang.org/book/index.html\n\n## Installing from Source\n\nIf you really want to install from source (though this is not recommended), see\n[INSTALL.md](INSTALL.md).\n\n## Getting Help\n\nSee https://www.rust-lang.org/community for a list of chat platforms and forums.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\nFor a detailed explanation of the compiler's architecture and how to begin contributing, see the [rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/).\n\n## License\n\nRust is primarily distributed under the terms of both the MIT license and the\nApache License (Versio

FAQ (5)

문제 해결
Rust 오류 'internal compiler error: encountered incremental compilation error with evaluate_obligation'를 수정하는 방법

이것은 코드의 버그가 아니라 증분 컴파일 캐시 손상으로 인한 ICE입니다. 증분 캐시를 지워서 해결하세요:

1. cargo clean -p <crate_name>(예: cargo clean -p jmap)을 실행하여 영향을 받는 크레이트만 지우거나, 전체 cargo clean을 실행하여 모든 빌드 아티팩트를 삭제하세요.
2. cargo build로 다시 컴파일하세요.

오류가 계속 반복되면 환경 변수 CARGO_INCREMENTAL=0을 설정하거나 .cargo/config.toml에 [build] incremental = false를 추가하여 증분 컴파일을 완전히 비활성화하세요.

이것은 컴파일러 버그이므로, 최소 재현(가능하다면 이전 코드와 리빌드 시 ICE를 유발하는 패치)과 함께 rustc --version 출력 및 오류의 fingerprint 해시를 포함하여 https://github.com/rust-lang/rust/issues 에 보고해야 합니다.

원본 Issue #164475
문제 해결
checked_div().unwrap_unchecked()를 사용할 때 내 Rust 프로그램이 opt-level 1+에서 SIGFPE(0으로 나누기)로 크래시하는 이유는 무엇이며, 이를 어떻게 우회할 수 있나요?

이것은 알려진 rustc/LLVM miscompilation 버그입니다 (rust-lang/rust #164431, ~1.87부터 최소한 nightly 1.101까지의 버전에 영향을 미침). 옵티마이저가 checked_div(...).unwrap_unchecked()를 단순한 div 명령어로 lowering하면서, 함수 간 인라이닝 이후 0인 제수를 받을 수 있게 되어 -C opt-level=1 이상에서 SIGFPE (종료 코드 136)를 발생시키는 반면, -C opt-level=0와 Miri에서는 아무 문제 없이 실행됩니다. 버그가 수정될 때까지의 우회 방법: 1) checked_div(...).unwrap_unchecked()를 wrapping_div(...)로 교체 — 크래시가 사라집니다. 2) 호출자로 인라인되는 함수에 #[inline(never)]를 추가 — 버그를 유발하는 함수 간 인라이닝을 차단합니다. 3) 최후의 수단으로 -C opt-level=0로 컴파일. 이 버그는 주소 레이아웃에도 민감하다는 점에 유의하세요: 기본 PIE 빌드에서는 재현되지만 non-PIE 빌드에서는 안정적으로 재현되지 않습니다.

원본 Issue #164431
문제 해결
riscv64에서 libc 크레이트를 컴파일할 때 발생하는 'cannot find type c_char in this scope' 오류를 해결하는 방법

이 E0425 오류는 오래된 libc 버전(예: 0.2.43)에 c_char와 같은 핵심 C 타입에 대한 riscv64 타겟 정의가 없기 때문에 발생합니다. libc를 0.2.190 이상으로 업그레이드하여 해결하세요. libc가 의존성의 Cargo.lock에 고정되어 있는 경우(예: cargotest에서 사용하는 xsv 크레이트), 해당 크레이트의 디렉터리에서 cargo update -p libc를 실행하거나 Cargo.lock/Cargo.toml에서 libc 버전을 수동으로 올린 후 다시 빌드하세요. 컴파일러가 제안하는 std::ffi::c_char 임포트를 따르지 마세요. 누락된 정의는 임포트 문제가 아닌 버전 문제입니다.

원본 Issue #164339
문제 해결
inherent_associated_types 사용 시 Rust ICE "item_bounds called on DefId" 오류 해결 방법

이 내부 컴파일러 오류는 -Znext-solver=globally -Zassumptions-on-binders 플래그를 사용하여 재귀적 고유 연관 타입(예: type Assoc = &'a Foo<'a>::Assoc;)을 컴파일할 때 rustc 1.98.0-nightly (485ec3fbc 2026-06-10)에 영향을 미칩니다. 해결 방법: rustup update nightly를 통해 nightly 1.99.0 (ba28ff76f 2026-08-13) 이상으로 업데이트하면 해당 문제가 더 이상 재현되지 않습니다. inherent_associated_types는 컴파일러 크래시를 일으키는 것으로 알려진 불완전하고 불안정한 기능이므로 stable/beta에서는 사용을 피하세요. 또한, 문제를 유발하는 코드 자체가 유효하지 않습니다(자기 참조 연관 타입은 E0271 타입 불일치를 발생시킵니다). 따라서 연관 타입이 자기 자신을 참조하지 않도록 재작성하면 영향받는 버전에서 문제가 해결됩니다.

원본 Issue #157774
문제 해결
Rust 1.99 베타로 업그레이드한 후 'type annotations needed' 오류를 수정하는 방법

이는 Rust 1.99 beta의 알려진 타입 추론 회귀입니다(PR #158447로 바이섹트되었으며, issue #161913의 중복). 이전에는 제네릭 생성자에 전달된 클로저(예: Foo::new(&1u8, |input| *input))에서 타입이 추론되던 코드에 영향을 미칩니다. 해결 방법: 해당 회귀가 더 이상 재현되지 않는 Rust 1.100.0-beta.7 이상으로 업그레이드하세요. rustup update를 실행하거나 rustup default stable로 채널을 전환하면 됩니다. 1.99 beta를 계속 사용해야 하는 경우의 우회 방법: |input: &u8| *input처럼 클로저 매개변수나 제네릭 인자에 명시적 타입 어노테이션을 추가하거나, let x: Foo<&u8, u8> = ...와 같이 바인딩에 전체 타입을 지정하세요.

원본 Issue #162109