about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-05-27 15:44:42 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-05-30 10:22:27 -0700
commit6dcd744df0ed404b58767e17f55e1b4f1351daa5 (patch)
tree4d740caf6a54891902795b3d0a8c0737e61e029e
parent224ad326ea4c9d32309fbd46592661a464360b8d (diff)
downloadrust-6dcd744df0ed404b58767e17f55e1b4f1351daa5.tar.gz
rust-6dcd744df0ed404b58767e17f55e1b4f1351daa5.zip
Consider all possible one letter lifetimes in suggestion
-rw-r--r--src/librustc_infer/infer/error_reporting/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_infer/infer/error_reporting/mod.rs b/src/librustc_infer/infer/error_reporting/mod.rs
index c2dd3812fcc..a59a91e3005 100644
--- a/src/librustc_infer/infer/error_reporting/mod.rs
+++ b/src/librustc_infer/infer/error_reporting/mod.rs
@@ -1742,7 +1742,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
         let new_lt = generics
             .as_ref()
             .and_then(|(parent_g, g)| {
-                let possible = ["'a", "'b", "'c", "'d", "'e", "'f", "'g", "'h", "'i", "'j", "'k"];
+                let possible: Vec<_> = (b'a'..=b'z').map(|c| format!("'{}", c as char)).collect();
                 let mut lts_names = g
                     .params
                     .iter()
@@ -1758,9 +1758,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                     );
                 }
                 let lts = lts_names.iter().map(|s| -> &str { &*s }).collect::<Vec<_>>();
-                possible.iter().filter(|&candidate| !lts.contains(&*candidate)).next().map(|s| *s)
+                possible.into_iter().find(|candidate| !lts.contains(&candidate.as_str()))
             })
-            .unwrap_or("'lt");
+            .unwrap_or("'lt".to_string());
         let add_lt_sugg = generics
             .as_ref()
             .and_then(|(_, g)| g.params.first())