diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2022-03-27 02:14:54 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-04-04 21:14:08 +0000 |
| commit | e1ef833bca8fe21cb2cbc42795cda4b589ec6f25 (patch) | |
| tree | 4c60eec8a68ed7ddac4a40710766bcdb5d89df7e /compiler/rustc_trait_selection/src | |
| parent | a6301cab5e3512bf28c69e60e28e8253911702c9 (diff) | |
| download | rust-e1ef833bca8fe21cb2cbc42795cda4b589ec6f25.tar.gz rust-e1ef833bca8fe21cb2cbc42795cda4b589ec6f25.zip | |
Remove hack, fix fmt and tests
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index de35f545f06..408c2ab9675 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1756,7 +1756,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { trait_ref: ty::PolyTraitRef<'tcx>, err: &mut Diagnostic, ) -> bool { - let report = |mut candidates: Vec<TraitRef<'_>>, err: &mut Diagnostic| { + let report = |mut candidates: Vec<TraitRef<'tcx>>, err: &mut Diagnostic| { candidates.sort(); candidates.dedup(); let len = candidates.len(); @@ -1778,11 +1778,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } let trait_ref = TraitRef::identity(self.tcx, candidates[0].def_id); // Check if the trait is the same in all cases. If so, we'll only show the type. - // FIXME: there *has* to be a better way! - let mut traits: Vec<_> = candidates - .iter() - .map(|c| format!("{}", c).split(" as ").last().unwrap().to_string()) - .collect(); + let mut traits: Vec<_> = + candidates.iter().map(|c| c.print_only_trait_path().to_string()).collect(); traits.sort(); traits.dedup(); |
