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

Make overlapping_inherent_impls lint a hard error #40728

Merged
merged 1 commit into from
Apr 1, 2017

Conversation

topecongiro
Copy link
Contributor

Closes #36889.

@rust-highfive
Copy link
Collaborator

r? @arielb1

(rust_highfive has picked a reviewer for you, use r? to override)

@brson brson added the relnotes Marks issues that should be documented in the release notes of the next release. label Mar 23, 2017
self.tcx.span_of_impl(item1).unwrap(),
E0592,
"duplicate definitions with name `{}`",
name)
Copy link
Contributor

@estebank estebank Mar 25, 2017

Choose a reason for hiding this comment

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

The code looks good, but could you add a span_label to this diagnostic pointing at item1's and another pointing at item2's span?

That way the code output would look this way:

error: duplicate definitions with name `id`
 --> <anon>:4:5
  |
4 |     fn id() {} //~ ERROR duplicate definitions
  |     ^^^^^^^^^^ duplicate definitions for `id`
...
8 |     fn id() {}
  |     ---------- other definition for `id`

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@estebank Thank you for your comment. I will rebase accordingly 😸

@bors
Copy link
Contributor

bors commented Mar 29, 2017

☔ The latest upstream changes (presumably #40867) made this pull request unmergeable. Please resolve the merge conflicts.

@arielb1
Copy link
Contributor

arielb1 commented Mar 30, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Mar 30, 2017

📌 Commit 11ce5b7 has been approved by arielb1

@bors
Copy link
Contributor

bors commented Mar 30, 2017

⌛ Testing commit 11ce5b7 with merge ba21ac0...

@bors
Copy link
Contributor

bors commented Mar 30, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Mar 31, 2017

⌛ Testing commit 11ce5b7 with merge c9c7c45...

@bors
Copy link
Contributor

bors commented Mar 31, 2017

💔 Test failed - status-appveyor

@alexcrichton
Copy link
Member

alexcrichton commented Mar 31, 2017 via email

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 31, 2017
Make overlapping_inherent_impls lint a hard error

Closes rust-lang#36889.
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Mar 31, 2017
Make overlapping_inherent_impls lint a hard error

Closes rust-lang#36889.
bors added a commit that referenced this pull request Mar 31, 2017
Rollup of 6 pull requests

- Successful merges: #40703, #40728, #40763, #40871, #40935, #40947
- Failed merges:
@bors bors merged commit 11ce5b7 into rust-lang:master Apr 1, 2017
@estebank
Copy link
Contributor

estebank commented Apr 3, 2017

@topecongiro, is it me or the rebased version that was merged didn't have the "hard error" code? If that is the case, could you please send a PR with it?

@topecongiro
Copy link
Contributor Author

@estebank Looks like #40683 splitted src/librustc_typeck/coherence/inherent.rs into two files and the hard error code disappeared when I rebased without paying attention. Sorry for confusion. I will create a PR shortly.

arielb1 pushed a commit to arielb1/rust that referenced this pull request Apr 5, 2017
…pls, r=estebank

Make 'overlapping_inherent_impls' lint a hard error

This is ought to be implemented in PR rust-lang#40728. Unfortunately, when I rebased the PR to resolve merge conflict, the "hard error" code disappeared. This PR complements the initial PR.

Now the following rust code gives the following error:
```rust
struct Foo;

impl Foo {
    fn id() {}
}

impl Foo {
    fn id() {}
}

fn main() {}
```
```
error[E0592]: duplicate definitions with name `id`
 --> /home/topecongiro/test.rs:4:5
  |
4 |     fn id() {}
  |     ^^^^^^^^^^ duplicate definitions for `id`
...
8 |     fn id() {}
  |     ---------- other definition for `id`

error: aborting due to previous error
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants