Skip to content

the reference was inferring values that didn't fit into their target type #30871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3677,10 +3677,10 @@ sites are:

* `let` statements where an explicit type is given.

For example, `128` is coerced to have type `i8` in the following:
For example, `42` is coerced to have type `i8` in the following:

```rust
let _: i8 = 128;
let _: i8 = 42;
```

* `static` and `const` statements (similar to `let` statements).
Expand All @@ -3690,36 +3690,36 @@ sites are:
The value being coerced is the actual parameter, and it is coerced to
the type of the formal parameter.

For example, `128` is coerced to have type `i8` in the following:
For example, `42` is coerced to have type `i8` in the following:

```rust
fn bar(_: i8) { }

fn main() {
bar(128);
bar(42);
}
```

* Instantiations of struct or variant fields

For example, `128` is coerced to have type `i8` in the following:
For example, `42` is coerced to have type `i8` in the following:

```rust
struct Foo { x: i8 }

fn main() {
Foo { x: 128 };
Foo { x: 42 };
}
```

* Function results, either the final line of a block if it is not
semicolon-terminated or any expression in a `return` statement

For example, `128` is coerced to have type `i8` in the following:
For example, `42` is coerced to have type `i8` in the following:

```rust
fn foo() -> i8 {
128
42
}
```

Expand Down