Skip to content

Commit f45f525

Browse files
committedAug 14, 2018
Auto merge of #53196 - davidtwco:compile-fail-to-ui, r=nikomatsakis
Move `compile-fail` tests to `ui` Fixes #46841, #52531, #44844. r? @nikomatsakis
2 parents d67ba90 + 7b02656 commit f45f525

File tree

6,539 files changed

+59549
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,539 files changed

+59549
-77
lines changed
 

‎src/librustc/traits/error_reporting.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,13 +435,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
435435
}
436436

437437
fn report_similar_impl_candidates(&self,
438-
impl_candidates: Vec<ty::TraitRef<'tcx>>,
438+
mut impl_candidates: Vec<ty::TraitRef<'tcx>>,
439439
err: &mut DiagnosticBuilder)
440440
{
441441
if impl_candidates.is_empty() {
442442
return;
443443
}
444444

445+
let len = impl_candidates.len();
445446
let end = if impl_candidates.len() <= 5 {
446447
impl_candidates.len()
447448
} else {
@@ -459,10 +460,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
459460
}
460461
});
461462

463+
// Sort impl candidates so that ordering is consistent for UI tests.
464+
let normalized_impl_candidates = &mut impl_candidates[0..end]
465+
.iter()
466+
.map(normalize)
467+
.collect::<Vec<String>>();
468+
normalized_impl_candidates.sort();
469+
462470
err.help(&format!("the following implementations were found:{}{}",
463-
&impl_candidates[0..end].iter().map(normalize).collect::<String>(),
464-
if impl_candidates.len() > 5 {
465-
format!("\nand {} others", impl_candidates.len() - 4)
471+
normalized_impl_candidates.join(""),
472+
if len > 5 {
473+
format!("\nand {} others", len - 4)
466474
} else {
467475
"".to_owned()
468476
}

0 commit comments

Comments
 (0)