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

On type mismatch error highlight & when type matches #46349

Merged
merged 2 commits into from
Dec 2, 2017

Conversation

estebank
Copy link
Contributor

When the only difference between the two types in a type error is that
one is a reference to the other type (T vs &T) or both are
references differing only in their mutability (&T vs &mut T), don't
highlight the type (T).

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

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

@estebank
Copy link
Contributor Author

New output:

(&ty::TyFloat(_), &ty::TyInfer(ty::InferTy::FloatVar(_))) |
(&ty::TyInfer(ty::InferTy::FloatVar(_)), &ty::TyFloat(_)) |
(&ty::TyInfer(ty::InferTy::FloatVar(_)),
&ty::TyInfer(ty::InferTy::FloatVar(_))) => true,
Copy link
Member

@mark-i-m mark-i-m Nov 29, 2017

Choose a reason for hiding this comment

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

Would it be possible to do some sort of cannonical sorting here to get rid of duplicate cases?

EDIT: By "duplicate" I mean mirrored.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 29, 2017
@michaelwoerister
Copy link
Member

I like it but maybe someone with more type-checking involvement can review?

r? @nikomatsakis for dispatch

@arielb1
Copy link
Contributor

arielb1 commented Nov 29, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Nov 29, 2017

📌 Commit 677381a has been approved by arielb1

@arielb1
Copy link
Contributor

arielb1 commented Nov 29, 2017

Umm test failure

@bors r-

[00:55:34] ---- [compile-fail] compile-fail/associated-const-impl-wrong-lifetime.rs stdout ----

[00:55:34] 	

[00:55:34] error: /checkout/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs:19: unexpected note: '19:5: 19:34: expected type `&str`'

[00:55:34] 

[00:55:34] error: /checkout/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs:19: expected note not found: expected type `&'static str`

[00:55:34] 

[00:55:34] error: 1 unexpected errors found, 1 expected errors not found

[00:55:34] status: exit code: 101

[00:55:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/compile-fail/associated-const-impl-wrong-lifetime.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/associated-const-impl-wrong-lifetime.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/associated-const-impl-wrong-lifetime.stage2-x86_64-unknown-linux-gnu.aux" "-A" "unused"

[00:55:34] unexpected errors (from JSON output): [

[00:55:34]     Error {

[00:55:34]         line_num: 19,

[00:55:34]         kind: Some(

[00:55:34]             Note

[00:55:34]         ),

[00:55:34]         msg: "19:5: 19:34: expected type `&str`"

[00:55:34]     }

[00:55:34] ]

[00:55:34] 

[00:55:34] not found errors (from test file): [

[00:55:34]     Error {

[00:55:34]         line_num: 19,

[00:55:34]         kind: Some(

[00:55:34]             Note

[00:55:34]         ),

[00:55:34]         msg: "expected type `&\'static str`"

[00:55:34]     }

[00:55:34] ]

[00:55:34] 

[00:55:34] thread '[compile-fail] compile-fail/associated-const-impl-wrong-lifetime.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1086:12

[00:55:34] note: Run with `RUST_BACKTRACE=1` for a backtrace.

[00:55:34] 

[00:55:34] ---- [compile-fail] compile-fail/regions-infer-paramd-indirect.rs stdout ----

@estebank
Copy link
Contributor Author

@arielb1 fixed:

@bors r=arielb1

@bors
Copy link
Contributor

bors commented Nov 29, 2017

📌 Commit 02808f1 has been approved by arielb1

@estebank estebank added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 30, 2017
arielb1 pushed a commit to arielb1/rust that referenced this pull request Nov 30, 2017
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Nov 30, 2017
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Nov 30, 2017
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
arielb1 pushed a commit to arielb1/rust that referenced this pull request Nov 30, 2017
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
@bors
Copy link
Contributor

bors commented Dec 2, 2017

⌛ Testing commit 02808f1 with merge 9053fdd...

bors added a commit that referenced this pull request Dec 2, 2017
On type mismatch error highlight `&` when type matches

When the only difference between the two types in a type error is that
one is a reference to the other type (`T` vs `&T`) or both are
references differing only in their mutability (`&T` vs `&mut T`), don't
highlight the type (`T`).
@bors
Copy link
Contributor

bors commented Dec 2, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 9053fdd to master...

@bors bors merged commit 02808f1 into rust-lang:master Dec 2, 2017
@estebank estebank deleted the highlight-ref branch November 9, 2023 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants