Skip to content
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

Cleanup E0749 #75328

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
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
23 changes: 19 additions & 4 deletions src/librustc_error_codes/error_codes/E0749.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
Negative impls are not allowed to have any items. Negative impls
declare that a trait is **not** implemented (and never will be) and
hence there is no need to specify the values for trait methods or
other items.
An item was added on a negative impl.
Copy link
Contributor

@pickfire pickfire Aug 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnTitor I think the "item" here like you said means "type". Should we change it?

Suggested change
An item was added on a negative impl.
An associated type was added on a negative impl.

The one below too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, "item" means "associated items" so I don't think we should change it.


Erroneous code example:

```compile_fail,E0749
# #![feature(negative_impls)]
trait MyTrait {
type Foo;
}

impl !MyTrait for u32 {
type Foo = i32; // error!
}
# fn main() {}
Copy link
Contributor

@pickfire pickfire Aug 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we suggest how to fix this? Is it clear that the user should remove the type and put?

 impl !MyTrait for u32 {}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm it's verbose for me. "item" here is ambiguous a bit?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explanation below isn't enough?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just enough but it is not as straightforward.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum... I'm not sure to see what's missing so could please open a PR with your vision? (let's switch position for once! :p)

Set me as reviewer on it so we can move forward quickly! :)

```

Negative impls are not allowed to have any items. Negative impls declare that a
trait is **not** implemented (and never will be) and hence there is no need to
specify the values for trait methods or other items.
2 changes: 1 addition & 1 deletion src/tools/tidy/src/error_codes_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const EXEMPTED_FROM_TEST: &[&str] = &[
];

// Some error codes don't have any tests apparently...
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0570", "E0601", "E0602", "E0639", "E0729", "E0749"];
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0570", "E0601", "E0602", "E0639", "E0729"];

fn check_error_code_explanation(
f: &str,
Expand Down