File: unsized-str-in-return-expr-arg-and-local.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (74 lines) | stat: -rw-r--r-- 2,681 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:1:13
   |
LL | fn foo() -> impl Sized {
   |             ^^^^^^^^^^ doesn't have a size known at compile-time
...
LL |     *""
   |     --- return type was inferred to be `str` here
   |
   = help: the trait `Sized` is not implemented for `str`
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     *""
LL +     ""
   |

error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:15:9
   |
LL |     let x = *"";
   |         ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `str`
   = note: all local variables must have a statically known size
   = help: unsized locals are gated as an unstable feature
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     let x = *"";
LL +     let x = "";
   |

error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:22:9
   |
LL |     bar(*"");
   |     --- ^^^ doesn't have a size known at compile-time
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `Sized` is not implemented for `str`
note: required by a bound in `bar`
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:6:16
   |
LL | fn bar(_: impl Sized) {}
   |                ^^^^^ required by this bound in `bar`
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     bar(*"");
LL +     bar("");
   |

error[E0277]: the size for values of type `str` cannot be known at compilation time
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:26:11
   |
LL |     S.baz(*"");
   |       --- ^^^ doesn't have a size known at compile-time
   |       |
   |       required by a bound introduced by this call
   |
   = help: the trait `Sized` is not implemented for `str`
note: required by a bound in `S::baz`
  --> $DIR/unsized-str-in-return-expr-arg-and-local.rs:10:27
   |
LL |     fn baz(&self, _: impl Sized) {}
   |                           ^^^^^ required by this bound in `S::baz`
help: references are always `Sized`, even if they point to unsized data; consider not dereferencing the expression
   |
LL -     S.baz(*"");
LL +     S.baz("");
   |

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0277`.