Skip to content

Commit ff8cd2e

Browse files
committedNov 17, 2017
strip old lub-glb tests from librustc_driver
Good riddance.
1 parent b224397 commit ff8cd2e

File tree

1 file changed

+0
-212
lines changed

1 file changed

+0
-212
lines changed
 

‎src/librustc_driver/test.rs

Lines changed: 0 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -353,28 +353,10 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
353353
self.infcx.tcx.mk_imm_ref(r, self.tcx().types.isize)
354354
}
355355

356-
pub fn t_rptr_static(&self) -> Ty<'tcx> {
357-
self.infcx.tcx.mk_imm_ref(self.infcx.tcx.types.re_static,
358-
self.tcx().types.isize)
359-
}
360-
361-
pub fn t_rptr_empty(&self) -> Ty<'tcx> {
362-
self.infcx.tcx.mk_imm_ref(self.infcx.tcx.types.re_empty,
363-
self.tcx().types.isize)
364-
}
365-
366356
pub fn sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, ()> {
367357
self.infcx.at(&ObligationCause::dummy(), self.param_env).sub(t1, t2)
368358
}
369359

370-
pub fn lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
371-
self.infcx.at(&ObligationCause::dummy(), self.param_env).lub(t1, t2)
372-
}
373-
374-
pub fn glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
375-
self.infcx.at(&ObligationCause::dummy(), self.param_env).glb(t1, t2)
376-
}
377-
378360
/// Checks that `t1 <: t2` is true (this may register additional
379361
/// region checks).
380362
pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
@@ -399,37 +381,6 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
399381
}
400382
}
401383
}
402-
403-
/// Checks that `LUB(t1,t2) == t_lub`
404-
pub fn check_lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_lub: Ty<'tcx>) {
405-
match self.lub(t1, t2) {
406-
Ok(InferOk { obligations, value: t }) => {
407-
// None of these tests should require nested obligations:
408-
assert!(obligations.is_empty());
409-
410-
self.assert_eq(t, t_lub);
411-
}
412-
Err(ref e) => panic!("unexpected error in LUB: {}", e),
413-
}
414-
}
415-
416-
/// Checks that `GLB(t1,t2) == t_glb`
417-
pub fn check_glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_glb: Ty<'tcx>) {
418-
debug!("check_glb(t1={}, t2={}, t_glb={})", t1, t2, t_glb);
419-
match self.glb(t1, t2) {
420-
Err(e) => panic!("unexpected error computing LUB: {:?}", e),
421-
Ok(InferOk { obligations, value: t }) => {
422-
// None of these tests should require nested obligations:
423-
assert!(obligations.is_empty());
424-
425-
self.assert_eq(t, t_glb);
426-
427-
// sanity check for good measure:
428-
self.assert_subtype(t, t1);
429-
self.assert_subtype(t, t2);
430-
}
431-
}
432-
}
433384
}
434385

435386
#[test]
@@ -508,169 +459,6 @@ fn sub_free_bound_false_infer() {
508459
})
509460
}
510461

511-
#[test]
512-
fn lub_free_bound_infer() {
513-
//! Test result of:
514-
//!
515-
//! LUB(fn(_#1), for<'b> fn(&'b isize))
516-
//!
517-
//! This should yield `fn(&'_ isize)`. We check
518-
//! that it yields `fn(&'x isize)` for some free `'x`,
519-
//! anyhow.
520-
521-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
522-
env.create_simple_region_hierarchy();
523-
let t_infer1 = env.infcx.next_ty_var(TypeVariableOrigin::MiscVariable(DUMMY_SP));
524-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
525-
let t_rptr_free1 = env.t_rptr_free(1);
526-
env.check_lub(env.t_fn(&[t_infer1], env.tcx().types.isize),
527-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
528-
env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
529-
});
530-
}
531-
532-
#[test]
533-
fn lub_bound_bound() {
534-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
535-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
536-
let t_rptr_bound2 = env.t_rptr_late_bound(2);
537-
env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
538-
env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
539-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
540-
})
541-
}
542-
543-
#[test]
544-
fn lub_bound_free() {
545-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
546-
env.create_simple_region_hierarchy();
547-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
548-
let t_rptr_free1 = env.t_rptr_free(1);
549-
env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
550-
env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
551-
env.t_fn(&[t_rptr_free1], env.tcx().types.isize));
552-
})
553-
}
554-
555-
#[test]
556-
fn lub_bound_static() {
557-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
558-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
559-
let t_rptr_static = env.t_rptr_static();
560-
env.check_lub(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
561-
env.t_fn(&[t_rptr_static], env.tcx().types.isize),
562-
env.t_fn(&[t_rptr_static], env.tcx().types.isize));
563-
})
564-
}
565-
566-
#[test]
567-
fn lub_bound_bound_inverse_order() {
568-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
569-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
570-
let t_rptr_bound2 = env.t_rptr_late_bound(2);
571-
env.check_lub(env.t_fn(&[t_rptr_bound1, t_rptr_bound2], t_rptr_bound1),
572-
env.t_fn(&[t_rptr_bound2, t_rptr_bound1], t_rptr_bound1),
573-
env.t_fn(&[t_rptr_bound1, t_rptr_bound1], t_rptr_bound1));
574-
})
575-
}
576-
577-
#[test]
578-
fn lub_free_free() {
579-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
580-
env.create_simple_region_hierarchy();
581-
let t_rptr_free1 = env.t_rptr_free(1);
582-
let t_rptr_free2 = env.t_rptr_free(2);
583-
let t_rptr_static = env.t_rptr_static();
584-
env.check_lub(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
585-
env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
586-
env.t_fn(&[t_rptr_static], env.tcx().types.isize));
587-
})
588-
}
589-
590-
#[test]
591-
fn lub_returning_scope() {
592-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
593-
env.create_simple_region_hierarchy();
594-
let t_rptr_scope10 = env.t_rptr_scope(10);
595-
let t_rptr_scope11 = env.t_rptr_scope(11);
596-
let t_rptr_empty = env.t_rptr_empty();
597-
env.check_lub(env.t_fn(&[t_rptr_scope10], env.tcx().types.isize),
598-
env.t_fn(&[t_rptr_scope11], env.tcx().types.isize),
599-
env.t_fn(&[t_rptr_empty], env.tcx().types.isize));
600-
});
601-
}
602-
603-
#[test]
604-
fn glb_free_free_with_common_scope() {
605-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
606-
env.create_simple_region_hierarchy();
607-
let t_rptr_free1 = env.t_rptr_free(1);
608-
let t_rptr_free2 = env.t_rptr_free(2);
609-
let t_rptr_scope = env.t_rptr_scope(1);
610-
env.check_glb(env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
611-
env.t_fn(&[t_rptr_free2], env.tcx().types.isize),
612-
env.t_fn(&[t_rptr_scope], env.tcx().types.isize));
613-
})
614-
}
615-
616-
#[test]
617-
fn glb_bound_bound() {
618-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
619-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
620-
let t_rptr_bound2 = env.t_rptr_late_bound(2);
621-
env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
622-
env.t_fn(&[t_rptr_bound2], env.tcx().types.isize),
623-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
624-
})
625-
}
626-
627-
#[test]
628-
fn glb_bound_free() {
629-
test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
630-
env.create_simple_region_hierarchy();
631-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
632-
let t_rptr_free1 = env.t_rptr_free(1);
633-
env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
634-
env.t_fn(&[t_rptr_free1], env.tcx().types.isize),
635-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
636-
})
637-
}
638-
639-
#[test]
640-
fn glb_bound_free_infer() {
641-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
642-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
643-
let t_infer1 = env.infcx.next_ty_var(TypeVariableOrigin::MiscVariable(DUMMY_SP));
644-
645-
// compute GLB(fn(_) -> isize, for<'b> fn(&'b isize) -> isize),
646-
// which should yield for<'b> fn(&'b isize) -> isize
647-
env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
648-
env.t_fn(&[t_infer1], env.tcx().types.isize),
649-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
650-
651-
// as a side-effect, computing GLB should unify `_` with
652-
// `&'_ isize`
653-
let t_resolve1 = env.infcx.shallow_resolve(t_infer1);
654-
match t_resolve1.sty {
655-
ty::TyRef(..) => {}
656-
_ => {
657-
panic!("t_resolve1={:?}", t_resolve1);
658-
}
659-
}
660-
})
661-
}
662-
663-
#[test]
664-
fn glb_bound_static() {
665-
test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
666-
let t_rptr_bound1 = env.t_rptr_late_bound(1);
667-
let t_rptr_static = env.t_rptr_static();
668-
env.check_glb(env.t_fn(&[t_rptr_bound1], env.tcx().types.isize),
669-
env.t_fn(&[t_rptr_static], env.tcx().types.isize),
670-
env.t_fn(&[t_rptr_bound1], env.tcx().types.isize));
671-
})
672-
}
673-
674462
/// Test substituting a bound region into a function, which introduces another level of binding.
675463
/// This requires adjusting the Debruijn index.
676464
#[test]

0 commit comments

Comments
 (0)
Please sign in to comment.