Closed
Description
Given the following code: link
use std::process::Termination;
fn foo<T: Termination>(_: T) {}
fn bar() {foo(1_i32);}
The current output is:
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): `main` has invalid return type `i32`
--> src/lib.rs:3:15
|
3 | fn bar() {foo(1_i32);}
| --- ^^^^^ `main` can only return types that implement `Termination`
| |
| required by a bound introduced by this call
|
= help: the trait `Termination` is not implemented for `i32`
note: required by a bound in `foo`
--> src/lib.rs:2:11
|
2 | fn foo<T: Termination>(_: T) {}
| ^^^^^^^^^^^ required by this bound in `foo`
Ideally the output should look like:
error[[E0277]](https://doc.rust-lang.org/stable/error-index.html#E0277): the trait bound `i32: std::process::Termination` is not satisfied
--> src/lib.rs:3:15
|
3 | fn bar() {foo(1_i32);}
| --- ^^^^^ the trait `std::process::Termination` is not implemented for `i32`
| |
| required by a bound introduced by this call
rust/library/std/src/process.rs
Lines 2154 to 2160 in 3271760