Skip to content

Commit 63287ee

Browse files
committed
auto merge of #14274 : youknowone/rust/advice-tilt-to-box, r=thestinger
2 parents 2b4cdea + 2ee0ca5 commit 63287ee

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/librustc/middle/typeck/astconv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ pub fn ast_ty_to_ty<AC:AstConv, RS:RegionScope>(
653653
tcx.sess.span_err(
654654
ast_ty.span,
655655
format!("reference to trait `{name}` where a type is expected; \
656-
try `~{name}` or `&{name}`", name=path_str));
656+
try `Box<{name}>` or `&{name}`", name=path_str));
657657
ty::mk_err()
658658
}
659659
ast::DefTy(did) | ast::DefStruct(did) => {

src/test/compile-fail/issue-5883.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
trait A {}
1212

1313
struct Struct {
14-
r: A //~ ERROR reference to trait `A` where a type is expected; try `~A` or `&A`
14+
r: A //~ ERROR reference to trait `A` where a type is expected; try `Box<A>` or `&A`
1515
}
1616

1717
fn new_struct(r: A) -> Struct {
18-
//~^ ERROR reference to trait `A` where a type is expected; try `~A` or `&A`
18+
//~^ ERROR reference to trait `A` where a type is expected; try `Box<A>` or `&A`
1919
Struct { r: r }
2020
}
2121

2222
trait Curve {}
2323
enum E {X(Curve)}
24-
//~^ ERROR reference to trait `Curve` where a type is expected; try `~Curve` or `&Curve`
24+
//~^ ERROR reference to trait `Curve` where a type is expected; try `Box<Curve>` or `&Curve`
2525
fn main() {}

src/test/compile-fail/trait-bounds-not-on-bare-trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait Foo {
1414
// This should emit the less confusing error, not the more confusing one.
1515

1616
fn foo(_x: Foo:Send) {
17-
//~^ERROR reference to trait `Foo` where a type is expected; try `~Foo` or `&Foo`
17+
//~^ERROR reference to trait `Foo` where a type is expected; try `Box<Foo>` or `&Foo`
1818
}
1919

2020
fn main() { }

0 commit comments

Comments
 (0)