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

Show one error for duplicated type definitions #37447

Merged
merged 1 commit into from
Nov 11, 2016

Conversation

estebank
Copy link
Contributor

For the following code:

struct Bar;
struct Bar;

fn main () {
}

show

error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to previous error

instead of

error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error[E0428]: a value named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to 2 previous errors

Fixes #35767.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@estebank estebank force-pushed the non-duplicate-definition-error branch 2 times, most recently from bdf3d24 to 03baeef Compare October 30, 2016 02:59
@nrc
Copy link
Member

nrc commented Nov 7, 2016

Could you use a hash set rather than a vec here? (O(1) vs O(n)).

@estebank estebank force-pushed the non-duplicate-definition-error branch 2 times, most recently from 3132180 to ea9f167 Compare November 7, 2016 04:49
@estebank
Copy link
Contributor Author

estebank commented Nov 7, 2016

@nrc makes complete sense. Changed.

@nrc
Copy link
Member

nrc commented Nov 7, 2016

looks good, thanks!

@bors: r+

@bors
Copy link
Contributor

bors commented Nov 7, 2016

📌 Commit ea9f167 has been approved by nrc

@bors
Copy link
Contributor

bors commented Nov 7, 2016

⌛ Testing commit ea9f167 with merge 7b8fda8...

@bors
Copy link
Contributor

bors commented Nov 7, 2016

💔 Test failed - auto-linux-64-opt-rustbuild

@estebank
Copy link
Contributor Author

estebank commented Nov 7, 2016

@nrc I'm unsure what the error is or how it could have been caused by this patch:

Building stage2 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.18 secs
Building stage2 tool error_index_generator (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.0 secs
Testing error-index stage2
thread 'main' panicked at 'entity not found', /buildslave/rust-buildbot/slave/auto-linux-64-opt-rustbuild/build/src/tools/error_index_generator/main.rs:209
note: Run with `RUST_BACKTRACE=1` for a backtrace.

command did not execute successfully: "/buildslave/rust-buildbot/slave/auto-linux-64-opt-rustbuild/build/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/error_index_generator" "markdown" "/buildslave/rust-buildbot/slave/auto-linux-64-opt-rustbuild/build/obj/build/x86_64-unknown-linux-gnu/test/error-index.md"
expected success, got: exit code: 101

What can I do to get a more verbose error in order to fix it?

@nrc
Copy link
Member

nrc commented Nov 7, 2016

@bors: retry

@estebank I think this is just intermittent failure on the infra, not your patch.

@bors
Copy link
Contributor

bors commented Nov 9, 2016

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

For the following code:

```rustc
struct Bar;
struct Bar;

fn main () {
}
```

show

```nocode
error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to previous error
```

instead of

```nocode
error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error[E0428]: a value named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to 2 previous errors
```
@estebank estebank force-pushed the non-duplicate-definition-error branch from ea9f167 to 43aed32 Compare November 10, 2016 00:20
@alexcrichton
Copy link
Member

@bors: r=nrc

(assuming nothing change, but @nrc feel free to correct me!)

@bors
Copy link
Contributor

bors commented Nov 10, 2016

📌 Commit 43aed32 has been approved by nrc

@estebank
Copy link
Contributor Author

@alexcrichton I only fixed the merge conflicts.

@bors
Copy link
Contributor

bors commented Nov 11, 2016

⌛ Testing commit 43aed32 with merge ba2e892...

bors added a commit that referenced this pull request Nov 11, 2016
Show one error for duplicated type definitions

For the following code:

``` rustc
struct Bar;
struct Bar;

fn main () {
}
```

show

``` nocode
error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to previous error
```

instead of

``` nocode
error[E0428]: a type named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error[E0428]: a value named `Bar` has already been defined in this module
  --> src/test/compile-fail/E0428.rs:12:1
   |
11 | struct Bar;
   | ----------- previous definition of `Bar` here
12 | struct Bar;
   | ^^^^^^^^^^^

error: aborting due to 2 previous errors
```

Fixes #35767.
@bors bors merged commit 43aed32 into rust-lang:master Nov 11, 2016
@estebank estebank deleted the non-duplicate-definition-error branch November 9, 2023 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants