Skip to content

Commit 2d44712

Browse files
committed
Issue 22450: Address desugaring-box problems in [pretty] run-pass test suite.
Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
1 parent 056e581 commit 2d44712

8 files changed

+18
-10
lines changed

src/test/run-pass/alignment-gep-tup-like-1.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ impl<A:Clone> Invokable<A> for Invoker<A> {
3131
}
3232

3333
fn f<A:Clone + 'static>(a: A, b: u16) -> Box<Invokable<A>+'static> {
34-
box Invoker {
34+
// FIXME(22450): workaround pretty-printer deficiency via parens.
35+
(box Invoker {
3536
a: a,
3637
b: b,
37-
} as (Box<Invokable<A>+'static>)
38+
}) as (Box<Invokable<A>+'static>)
3839
}
3940

4041
pub fn main() {

src/test/run-pass/close-over-big-then-small-data.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ impl<A:Clone> Invokable<A> for Invoker<A> {
3535
}
3636

3737
fn f<A:Clone + 'static>(a: A, b: u16) -> Box<Invokable<A>+'static> {
38-
box Invoker {
38+
// FIXME(22450): workaround pretty-printer deficiency via parens.
39+
(box Invoker {
3940
a: a,
4041
b: b,
41-
} as (Box<Invokable<A>+'static>)
42+
}) as (Box<Invokable<A>+'static>)
4243
}
4344

4445
pub fn main() {

src/test/run-pass/issue-2734.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ trait hax {
1717
impl<A> hax for A { }
1818

1919
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax+'static> {
20-
box x as Box<hax+'static>
20+
// FIXME(22450): workaround pretty-printer deficiency via parens.
21+
(box x) as Box<hax+'static>
2122
}
2223

2324
fn deadcode() {

src/test/run-pass/issue-2735.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ trait hax {
1717
impl<A> hax for A { }
1818

1919
fn perform_hax<T: 'static>(x: Box<T>) -> Box<hax+'static> {
20-
box x as Box<hax+'static>
20+
// FIXME(22450): workaround pretty-printer deficiency via parens.
21+
(box x) as Box<hax+'static>
2122
}
2223

2324
fn deadcode() {

src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ trait A {
2626
impl<T: 'static> A for T {}
2727

2828
fn owned2<T: 'static>(a: Box<T>) { a as Box<A>; }
29-
fn owned3<T: 'static>(a: Box<T>) { box a as Box<A>; }
29+
// FIXME(22450): workaround pretty-printer deficiency via parens.
30+
fn owned3<T: 'static>(a: Box<T>) { (box a) as Box<A>; }

src/test/run-pass/kindck-owned-trait-contains-1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ impl<A:Clone + 'static> repeat<A> for Box<A> {
2020
}
2121

2222
fn repeater<A:Clone + 'static>(v: Box<A>) -> Box<repeat<A>+'static> {
23-
box v as Box<repeat<A>+'static> // No
23+
// FIXME(22450): workaround pretty-printer deficiency via parens.
24+
(box v) as Box<repeat<A>+'static> // No
2425
}
2526

2627
pub fn main() {

src/test/run-pass/regions-close-over-type-parameter-successfully.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ impl<'a> SomeTrait for &'a int {
2323
}
2424

2525
fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'a> {
26-
box v as Box<SomeTrait+'a>
26+
// FIXME(22450): workaround pretty-printer deficiency via parens.
27+
(box v) as Box<SomeTrait+'a>
2728
}
2829

2930
fn main() {

src/test/run-pass/regions-early-bound-trait-param.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ impl<'s> Trait<'s> for (int,int) {
8181
}
8282

8383
impl<'t> MakerTrait for Box<Trait<'t>+'static> {
84-
fn mk() -> Box<Trait<'t>+'static> { box() (4,5) as Box<Trait> }
84+
// FIXME(22450): workaround pretty-printer deficiency via parens.
85+
fn mk() -> Box<Trait<'t>+'static> { (box() (4,5)) as Box<Trait> }
8586
}
8687

8788
enum List<'l> {

0 commit comments

Comments
 (0)