Nit: improve comment in hr-fn-aau-eq-abu.rs

This commit is contained in:
Niko Matsakis 2018-07-25 16:40:43 +03:00
parent 3171cbe986
commit 21e4a0834e
1 changed files with 10 additions and 10 deletions

View File

@ -8,12 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Test an interesting corner case: a fn that takes two arguments that
// are references with the same lifetime is in fact equivalent to a fn
// that takes two references with distinct lifetimes. This is true
// because the two functions can call one another -- effectively, the
// single lifetime `'a` is just inferred to be the intersection of the
// two distinct lifetimes.
// Test an interesting corner case that ought to be legal (though the
// current code actually gets it wrong, see below): a fn that takes
// two arguments that are references with the same lifetime is in fact
// equivalent to a fn that takes two references with distinct
// lifetimes. This is true because the two functions can call one
// another -- effectively, the single lifetime `'a` is just inferred
// to be the intersection of the two distinct lifetimes.
//
// FIXME: However, we currently reject this example with an error,
// because of how we handle binders and equality in `relate_tys`.
//
// compile-flags:-Zno-leak-check
@ -28,10 +32,6 @@ fn make_cell_aa() -> Cell<for<'a> fn(&'a u32, &'a u32)> {
fn aa_eq_ab() {
let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa();
//~^ ERROR higher-ranked subtype error
//
// FIXME -- this .. arguably ought to be accepted. However, the
// current leak check also rejects this example, and it's kind of
// a pain to support it. There are some comments in `relate_tys`
drop(a);
}