Skip to content

Commit 39b5e93

Browse files
Box::new("") creates Box<&str>, not Box<str>. It needs to be let str: Box<str> = Box::from("")
Or `let str = Box::<str>::from("")`
1 parent a0f5ca9 commit 39b5e93

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/language/strings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Rust:
4444

4545
```rust
4646
let span: &str = "Hello, World!";
47-
let str = Box::new("Hello World!");
47+
let str: Box<str> = Box::from("Hello World!");
4848
let mut sb = String::from("Hello World!");
4949
```
5050

0 commit comments

Comments
 (0)