commit | 12358a73638947df6e199895dd3626227aee0a12 | [log] [tgz] |
---|---|---|
author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | Tue Jun 11 21:27:47 2024 +0100 |
committer | GitHub <noreply@github.com> | Tue Jun 11 21:27:47 2024 +0100 |
tree | 2a84292d11240deafe497b8b4d9aec5cb27ff2f3 | |
parent | 260f789ae19c10a57d86437fda00989e9dbfecd9 [diff] | |
parent | 69769fc79776a284fed2e5d9ea9605b36f50f83a [diff] |
Rollup merge of #126055 - lengrongfu:master, r=pnkfelix Expand list of trait implementers in E0277 when calling rustc with --verbose Fixes: https://github.com/rust-lang/rust/issues/125984 - Build `rustc` use `./x build`. - Test result <img width="634" alt="image" src="https://github.com/rust-lang/rust/assets/15009201/89377059-2316-492b-a38a-fa33adfc9793"> - vim test.rs ```rust trait Reconcile { fn reconcile(&self); } // Implementing the trait for some types impl Reconcile for bool { fn reconcile(&self) { println!("Reconciling bool"); } } impl Reconcile for i8 { fn reconcile(&self) { println!("Reconciling i8"); } } impl Reconcile for i16 { fn reconcile(&self) { println!("Reconciling i16"); } } impl Reconcile for i32 { fn reconcile(&self) { println!("Reconciling i32"); } } impl Reconcile for i64 { fn reconcile(&self) { println!("Reconciling i64"); } } impl Reconcile for u8 { fn reconcile(&self) { println!("Reconciling u8"); } } impl Reconcile for u16 { fn reconcile(&self) { println!("Reconciling u16"); } } impl Reconcile for u32 { fn reconcile(&self) { println!("Reconciling u32"); } } impl Reconcile for i128 { fn reconcile(&self) { println!("Reconciling u32"); } } impl Reconcile for u128 { fn reconcile(&self) { println!("Reconciling u32"); } } fn process<T: Reconcile>(item: T) { item.reconcile(); } fn main() { let value = String::from("This will cause an error"); process(value); // This line will cause a compilation error } ```
Website | Getting started | Learn | Documentation | Contributing
This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.
Performance: Fast and memory-efficient, suitable for critical services, embedded devices, and easily integrate with other languages.
Reliability: Our rich type system and ownership model ensure memory and thread safety, reducing bugs at compile-time.
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).
Read “Installation” from The Book.
If you really want to install from source (though this is not recommended), see INSTALL.md.
See https://www.rust-lang.org/community for a list of chat platforms and forums.
See CONTRIBUTING.md.
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the “Rust Trademarks”).
If you want to use these names or brands, please read the media guide.
Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.