Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
aaac69f
Fix Issue #48345, is_file, is_dir, and is_symlink note mutual exclusion
Mar 16, 2018
683ad94
Add OnDrop
Zoxc Mar 15, 2018
3b43dcb
Replace Rc with Lrc
Zoxc Mar 14, 2018
910bf84
Always print `aborting due to n previous error(s)` and only print it …
Zoxc Mar 15, 2018
b1d872b
Update tests
Zoxc Mar 15, 2018
6fd4d67
rustbuild: Tweak where timing information goes
alexcrichton Mar 16, 2018
b57ea56
Stabilise FromUtf8Error::as_bytes
varkor Mar 17, 2018
b498192
Add a -Z flag for LLVM align attributes on arguments
scottmcm Mar 17, 2018
efa9016
Add a CI job for parallel rustc using x.py check
Zoxc Mar 17, 2018
c5c650d
Split out termination_trait_test feature gate
tmandry Mar 19, 2018
97b3bf9
Stabilize termination_trait
tmandry Mar 19, 2018
e5a55e7
Stabilize termination_trait in 1.25, not 1.26
tmandry Mar 19, 2018
be29e52
Match against friendly error message
tmandry Mar 20, 2018
5ccf3ff
diagnostics: Remove main return type errors from E0580
tmandry Mar 20, 2018
72334fe
typeck: Report main return type errors on return type span
tmandry Mar 20, 2018
57896ab
Make resuming generators unsafe instead of the creation of immovable …
Zoxc Mar 19, 2018
1937661
Revert "Stabilize termination_trait in 1.25, not 1.26"
tmandry Mar 21, 2018
94bdeb6
termination_trait: Add () example to error message
tmandry Mar 21, 2018
2cdc7af
Use NOTE instead of error-pattern directive
tmandry Mar 21, 2018
5201e7c
document format_args! behavior wrt. Display and Debug
Centril Mar 21, 2018
afff64e
document format_args! further wrt. Debug & Display"
Centril Mar 21, 2018
06f8103
Bump racer and home
Eijebong Mar 21, 2018
75dcc61
Cargo fmt libtest
topecongiro Mar 21, 2018
b6934c9
termination_trait: Put examples in error help, not label
tmandry Mar 21, 2018
178652a
Add support to rustbuild for a 'rustc docs' component tarball
davidtwco Mar 20, 2018
1392179
Configure the dist-x86_64-linux builder to produce compiler documenta…
davidtwco Mar 20, 2018
c116b0e
Fixed clockwise/counter-clockwise in atan2 documentation in f32 and f64
Tacklebox Mar 22, 2018
776c0be
Stabilize universal_impl_trait
cramertj Mar 22, 2018
d818194
Stabilize conservative_impl_trait
cramertj Mar 22, 2018
2b13d95
termination_trait: Make error message more helpful
tmandry Mar 22, 2018
613fb8b
document format_args! - fix trailing whitespace
Centril Mar 22, 2018
a1a3bf2
Fix DefKey lookup for proc-macro crates.
michaelwoerister Mar 22, 2018
9839e5f
Remove slow HashSet during miri stack frame creation
oli-obk Mar 22, 2018
9fa14e4
Skip checking for Storage* statements in constants/statics
oli-obk Mar 22, 2018
1b0e9f5
Only generate documentation for local rustc crates.
davidtwco Mar 22, 2018
73fa6d5
Remove std/test documentation from compiler docs.
davidtwco Mar 22, 2018
86f7d89
Allow installing rustfmt without config.extended
cuviper Mar 23, 2018
bf8e4f2
Vec<_> -> IndexVec<Local, _>
oli-obk Mar 23, 2018
b18b776
Replace uses of `Hash(Map|Set)` with `FxHash(Map|Set)` in miri
oli-obk Mar 23, 2018
4ea4dd2
Don't allocate a local array at all if there are no locals
oli-obk Mar 23, 2018
ee67e14
Stabilize the copy_closures and clone_closures features
SimonSapin Mar 23, 2018
f9019ae
Simplify local accessors
oli-obk Mar 23, 2018
00721de
Mention closures in docs for Clone and Copy
SimonSapin Mar 23, 2018
1efe0b3
Rename variables in rustc’s SelectionContext::copy_clone_conditions
SimonSapin Mar 23, 2018
90588a9
Fix IE11 search
GuillaumeGomez Mar 23, 2018
700fd5a
Remove getopts leftover from tree
Mark-Simulacrum Mar 23, 2018
3bfed9e
Better diagnostics for '..' pattern fragment not in the last position
ordovicia Mar 22, 2018
f8fc5c0
Fix error annotations in test
ordovicia Mar 22, 2018
3d0ccb2
Fix test for PR #49268
ordovicia Mar 23, 2018
e551f24
Rollup merge of #49089 - alexcrichton:fix-timings, r=Mark-Simulacrum
kennytm Mar 24, 2018
537f0d5
Rollup merge of #49120 - Zoxc:parallel-ci, r=alexcrichton
kennytm Mar 24, 2018
cd9981c
Rollup merge of #49121 - varkor:stabilise-from_utf8_error_as_bytes, r…
kennytm Mar 24, 2018
0809a7b
Rollup merge of #49122 - scottmcm:z-align-attr, r=cramertj
kennytm Mar 24, 2018
22447cf
Rollup merge of #49193 - davidtwco:issue-29893, r=alexcrichton
kennytm Mar 24, 2018
1a890a6
Rollup merge of #49235 - topecongiro:run-rustfmt/libtest, r=nrc
kennytm Mar 24, 2018
0e4de4a
Rollup merge of #49254 - Tacklebox:atan2_doc, r=QuietMisdreavus
kennytm Mar 24, 2018
3dd136d
Rollup merge of #49268 - ordovicia:dotdot-pattern-diag, r=petrochenkov
kennytm Mar 24, 2018
f81f871
Rollup merge of #49273 - michaelwoerister:fix-extern-proc-macro-defke…
kennytm Mar 24, 2018
be5a452
Rollup merge of #49274 - oli-obk:slow_miri, r=michaelwoerister,eddyb
kennytm Mar 24, 2018
d6febd5
Rollup merge of #49290 - cuviper:unextended-dist-rustfmt, r=nikomatsakis
kennytm Mar 24, 2018
5082bde
Rollup merge of #49312 - GuillaumeGomez:fix-ie11-search, r=QuietMisdr…
kennytm Mar 24, 2018
8d2792e
Rollup merge of #49314 - Mark-Simulacrum:remove-getopts, r=alexcrichton
kennytm Mar 24, 2018
a64cd26
Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikom…
kennytm Mar 24, 2018
101f7c2
Rollup merge of #49076 - bobdavelisafrank:filetype-metadata-docfix, r…
kennytm Mar 24, 2018
85abb05
Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj
kennytm Mar 24, 2018
175595a
Rollup merge of #49229 - Centril:doc/format_args_display_debug, r=ste…
kennytm Mar 24, 2018
0acfcb8
Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoerister
kennytm Mar 24, 2018
6560452
Rollup merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakis
kennytm Mar 24, 2018
02d6f64
Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakis
kennytm Mar 24, 2018
f34d4f6
Rollup merge of #49203 - Eijebong:lets-cleanup-dependencies, r=Mark-S…
kennytm Mar 24, 2018
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
Prev Previous commit
Next Next commit
termination_trait: Make error message more helpful
  • Loading branch information
tmandry committed Mar 22, 2018
commit 2b13d95da02d318c12814261dd36edd91ae6879e
16 changes: 7 additions & 9 deletions src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,17 +585,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
trait_ref.to_predicate(), post_message)
}));

let explanation = match obligation.cause.code {
ObligationCauseCode::MainFunctionType => {
let explanation =
if obligation.cause.code == ObligationCauseCode::MainFunctionType {
"consider using `()`, or a `Result`".to_owned()
}
_ => {
} else {
format!("{}the trait `{}` is not implemented for `{}`",
pre_message,
trait_ref,
trait_ref.self_ty())
}
};
pre_message,
trait_ref,
trait_ref.self_ty())
};

if let Some(ref s) = label {
// If it has a custom "#[rustc_on_unimplemented]"
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,9 @@ pub fn id() -> u32 {
/// a successful execution. In case of a failure, `libc::EXIT_FAILURE` is returned.
#[cfg_attr(not(test), lang = "termination")]
#[unstable(feature = "termination_trait_lib", issue = "43301")]
#[rustc_on_unimplemented =
"`main` can only return types that implement {Termination}, not `{Self}`"]
#[rustc_on_unimplemented(
message="`main` has invalid return type `{Self}`",
label="`main` can only return types that implement {Termination}")]
pub trait Termination {
/// Is called to get the representation of the value as status code.
/// This status code is returned to the operating system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// except according to those terms.

fn main() -> i32 {
//~^ ERROR `i32: std::process::Termination` is not satisfied
//~| NOTE `main` can only return types that implement std::process::Termination, not `i32`
//~^ ERROR `main` has invalid return type `i32`
//~| NOTE `main` can only return types that implement std::process::Termination
//~| HELP consider using `()`, or a `Result`
0
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

struct ReturnType {}

fn main() -> ReturnType { //~ ERROR `ReturnType: std::process::Termination` is not satisfied
fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType`
ReturnType {}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `char: std::process::Termination` is not satisfied
error[E0277]: `main` has invalid return type `char`
--> $DIR/termination-trait-main-wrong-type.rs:11:14
|
LL | fn main() -> char { //~ ERROR
| ^^^^ `main` can only return types that implement std::process::Termination, not `char`
| ^^^^ `main` can only return types that implement std::process::Termination
|
= help: consider using `()`, or a `Result`

Expand Down