-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand list of trait implementers in E0277 when calling rustc
with --verbose
#125984
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
estebank
added
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
A-diagnostics
Area: Messages for errors, warnings, and lints
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
labels
Jun 4, 2024
@estebank Hi, I am interested in this easy issue. Can I submit a PR to fix it? |
@lengrongfu of course! |
@estebank Can you help me review this PR? |
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Jun 11, 2024
Expand list of trait implementers in E0277 when calling rustc with --verbose Fixes: rust-lang#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 } ```
jieyouxu
added a commit
to jieyouxu/rust
that referenced
this issue
Jun 11, 2024
Expand list of trait implementers in E0277 when calling rustc with --verbose Fixes: rust-lang#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 } ```
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 12, 2024
Rollup merge of rust-lang#126055 - lengrongfu:master, r=pnkfelix Expand list of trait implementers in E0277 when calling rustc with --verbose Fixes: rust-lang#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 } ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When emitting an error like the following
Allow the
--verbose
flag (self.tcx.sess.opts.verbose
) to print the whole list by modifyingrust/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
Lines 2075 to 2085 in bc33782
There are other places where we limit output where we don't currently listen to this flag to expand the output. For type name shortening I believe we already do, but we should look for all of them and make the appropriate change for them too.
Originally reported at https://users.rust-lang.org/t/how-can-i-get-a-list-of-the-and-17-others-types-in-this-compilation-error/112458
The text was updated successfully, but these errors were encountered: