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

Bonus format for E0194 #36148

Merged
merged 1 commit into from
Aug 31, 2016
Merged

Bonus format for E0194 #36148

merged 1 commit into from
Aug 31, 2016

Conversation

leikahing
Copy link
Contributor

Bonus fix for #35280. Part of #35233. Fixes #36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.

Errors for E0194 now look like this:

$> ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/E0194.rs 
error[E0194]: type parameter `T` shadows another type parameter of the same name
  --> src/test/compile-fail/E0194.rs:13:26
   |
11 | trait Foo<T> { //~ NOTE first `T` declared here
   |           - first `T` declared here
12 |     fn do_something(&self) -> T;
13 |     fn do_something_else<T: Clone>(&self, bar: T);
   |                          ^ shadows another type parameter

error: aborting due to previous error

r? @jonathandturner

@sophiajt
Copy link
Contributor

@birryree - I'm going to also go on the assumption that the unwraps are okay because the type parameter is local. I tried for a few minutes to come up with a counter example but wasn't able to.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 30, 2016

📌 Commit fb38911 has been approved by jonathandturner

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 30, 2016
…thandturner

Bonus format for E0194

Bonus fix for rust-lang#35280. Part of rust-lang#35233. Fixes rust-lang#36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.

Errors for E0194 now look like this:

```
$> ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/E0194.rs
error[E0194]: type parameter `T` shadows another type parameter of the same name
  --> src/test/compile-fail/E0194.rs:13:26
   |
11 | trait Foo<T> { //~ NOTE first `T` declared here
   |           - first `T` declared here
12 |     fn do_something(&self) -> T;
13 |     fn do_something_else<T: Clone>(&self, bar: T);
   |                          ^ shadows another type parameter

error: aborting due to previous error
```

r? @jonathandturner
@leikahing
Copy link
Contributor Author

@jonathandturner - I've been looking at the well-formed checker heavily and I based it on what I know about Rust currently and what @nikomatsakis mentioned to me as part of #35280. I took this bonus to a separate issue so I could get a review of the unwrap portion, just in case my assumptions were wrong. Thanks for looking and affirming!

@nikomatsakis
Copy link
Contributor

Yes, I think the unwraps are ok. :)

…ng#36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.
@sophiajt
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Aug 31, 2016

📌 Commit 69f0cee has been approved by jonathandturner

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 31, 2016
…thandturner

Bonus format for E0194

Bonus fix for rust-lang#35280. Part of rust-lang#35233. Fixes rust-lang#36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.

Errors for E0194 now look like this:

```
$> ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/E0194.rs
error[E0194]: type parameter `T` shadows another type parameter of the same name
  --> src/test/compile-fail/E0194.rs:13:26
   |
11 | trait Foo<T> { //~ NOTE first `T` declared here
   |           - first `T` declared here
12 |     fn do_something(&self) -> T;
13 |     fn do_something_else<T: Clone>(&self, bar: T);
   |                          ^ shadows another type parameter

error: aborting due to previous error
```

r? @jonathandturner
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 31, 2016
…thandturner

Bonus format for E0194

Bonus fix for rust-lang#35280. Part of rust-lang#35233. Fixes rust-lang#36057. Adding expanded notes/context for what trait a parameter shadows as part of E0194 error messages.

Errors for E0194 now look like this:

```
$> ./build/x86_64-apple-darwin/stage1/bin/rustc src/test/compile-fail/E0194.rs
error[E0194]: type parameter `T` shadows another type parameter of the same name
  --> src/test/compile-fail/E0194.rs:13:26
   |
11 | trait Foo<T> { //~ NOTE first `T` declared here
   |           - first `T` declared here
12 |     fn do_something(&self) -> T;
13 |     fn do_something_else<T: Clone>(&self, bar: T);
   |                          ^ shadows another type parameter

error: aborting due to previous error
```

r? @jonathandturner
@leikahing
Copy link
Contributor Author

@jonathandturner Sorry to give you some extra work, but I just updated my PR to cut down a line that was 101 characters long and broke tidy. Forgot to run the tidy check before my initial commit, sorry. :(

bors added a commit that referenced this pull request Aug 31, 2016
@bors bors merged commit 69f0cee into rust-lang:master Aug 31, 2016
@leikahing leikahing deleted the E0194_bonus_format branch September 6, 2016 16:29
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.

E0194 Bonus Formatting
4 participants