pretty: fix to print some lifetimes on HIR pretty-print
This commit is contained in:
parent
46244f335b
commit
7334526c38
@ -1687,7 +1687,11 @@ fn print_generic_args(
|
|||||||
|
|
||||||
let mut nonelided_generic_args: bool = false;
|
let mut nonelided_generic_args: bool = false;
|
||||||
let elide_lifetimes = generic_args.args.iter().all(|arg| match arg {
|
let elide_lifetimes = generic_args.args.iter().all(|arg| match arg {
|
||||||
GenericArg::Lifetime(lt) => lt.is_elided(),
|
GenericArg::Lifetime(lt) if lt.is_elided() => true,
|
||||||
|
GenericArg::Lifetime(_) => {
|
||||||
|
nonelided_generic_args = true;
|
||||||
|
false
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
nonelided_generic_args = true;
|
nonelided_generic_args = true;
|
||||||
true
|
true
|
||||||
|
20
src/test/pretty/issue-85089.pp
Normal file
20
src/test/pretty/issue-85089.pp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#[prelude_import]
|
||||||
|
use ::std::prelude::rust_2015::*;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate std;
|
||||||
|
// Test to print lifetimes on HIR pretty-printing.
|
||||||
|
|
||||||
|
// pretty-compare-only
|
||||||
|
// pretty-mode:hir
|
||||||
|
// pp-exact:issue-85089.pp
|
||||||
|
|
||||||
|
trait A<'x> { }
|
||||||
|
trait B<'x> { }
|
||||||
|
|
||||||
|
struct Foo<'b> {
|
||||||
|
bar: &'b dyn for<'a> A<'a>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl <'a> B<'a> for dyn for<'b> A<'b> { }
|
||||||
|
|
||||||
|
impl <'a> A<'a> for Foo<'a> { }
|
16
src/test/pretty/issue-85089.rs
Normal file
16
src/test/pretty/issue-85089.rs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// Test to print lifetimes on HIR pretty-printing.
|
||||||
|
|
||||||
|
// pretty-compare-only
|
||||||
|
// pretty-mode:hir
|
||||||
|
// pp-exact:issue-85089.pp
|
||||||
|
|
||||||
|
trait A<'x> {}
|
||||||
|
trait B<'x> {}
|
||||||
|
|
||||||
|
struct Foo<'b> {
|
||||||
|
pub bar: &'b dyn for<'a> A<'a>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> B<'a> for dyn for<'b> A<'b> {}
|
||||||
|
|
||||||
|
impl<'a> A<'a> for Foo<'a> {}
|
Loading…
Reference in New Issue
Block a user