rust/src/librustc_passes
bors 4640615ce7 Auto merge of #49372 - Phlosioneer:inherent-impl-default-error-message, r=nagisa
Better error message when trying to write default impls

Previously, if you tried to write this (using the specialization
feature flag):

default impl PartialEq<MyType> {
...
}

The compiler would give you the mysterious warning "inherent impls
cannot be default". What it really means is that you're trying to
write an impl for a Structure or *Trait Object*, and that cannot
be "default". However, one of the ways to encounter this error
(as shown by the above example) is when you forget to write "for
MyType".

This PR adds a help message that reads "maybe missing a `for`
keyword?" This is useful, actionable advice that will help any user
identify their mistake, and doesn't get in the way or mislead any
user that really meant to use the "default" keyword for this weird
purpose. In particular, this help message will be useful for any
users who don't know the "inherent impl" terminology, and/or users
who forget that inherent impls CAN be written for traits (they apply
to the trait objects). Both of these are somewhat confusing, seldom-
used concepts; a one-line error message without any error number for
longer explanation is NOT the place to introduce these ideas.

I wasn't quite sure what grammar / wording to use. I'm open to suggestions. CC @rust-lang/docs (I hope I'm doing that notation right)

(Apparently not. :( )
2018-04-23 10:40:08 +00:00
..
ast_validation.rs Auto merge of #49372 - Phlosioneer:inherent-impl-default-error-message, r=nagisa 2018-04-23 10:40:08 +00:00
Cargo.toml Move librustc_const_eval to librustc_mir 2018-03-08 08:08:14 +01:00
diagnostics.rs Nuke the entire ctfe from orbit, it's the only way to be sure 2018-03-08 08:08:14 +01:00
hir_stats.rs Add GenericParam, refactor Generics in ast, hir, rustdoc 2017-12-21 13:38:10 +01:00
lib.rs Move deny(warnings) into rustbuild 2018-04-08 16:59:14 -06:00
loops.rs Suggest removing value from break when invalid 2018-01-28 11:14:09 -08:00
mir_stats.rs Added UserAssertTy statement. 2018-03-22 21:10:59 +00:00
rvalue_promotion.rs AST/HIR: Merge field access expressions for named and numeric fields 2018-04-12 23:02:09 +03:00