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

Provide context on E0308 involving fn items #73630

Merged
merged 2 commits into from
Jun 24, 2020

Conversation

estebank
Copy link
Contributor

Fix #73487.

@rust-highfive
Copy link
Collaborator

r? @eddyb

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 22, 2020
@estebank
Copy link
Contributor Author

r? @davidtwco

@rust-highfive rust-highfive assigned davidtwco and unassigned eddyb Jun 22, 2020
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

Looks good, a couple minor comments - if you don't think they're worth addressing then r=me.

src/librustc_typeck/check/mod.rs Outdated Show resolved Hide resolved
@@ -6,34 +6,57 @@ LL | eq(foo::<u8>, bar::<u8>);
|
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
found fn item `fn(_) -> _ {bar::<u8>}`
= note: different `fn` items always have unique types, even if their signatures are the same
= help: change the expectation to require function pointer `fn(isize) -> isize`
Copy link
Member

Choose a reason for hiding this comment

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

I find the "expectation" terminology to be confusing here - it took me a little bit to understand what that would mean in terms of concrete changes to the source. I don't have any better suggestions though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the wording to

   = help: change the expected type to be function pointer `fn(isize) -> isize`
   = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`

@estebank
Copy link
Contributor Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Jun 23, 2020

📌 Commit 6e8aa1f has been approved by davidtwco

@bors bors 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 Jun 23, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jun 23, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 23, 2020
…arth

Rollup of 11 pull requests

Successful merges:

 - rust-lang#72780 (Enforce doc alias check)
 - rust-lang#72876 (Mention that BTreeMap::new() doesn't allocate)
 - rust-lang#73244 (Check for assignments between non-conflicting generator saved locals)
 - rust-lang#73488 (code coverage foundation for hash and num_counters)
 - rust-lang#73523 (Fix -Z unpretty=everybody_loops)
 - rust-lang#73587 (Move remaining `NodeId` APIs from `Definitions` to `Resolver`)
 - rust-lang#73601 (Point at the call span when overflow occurs during monomorphization)
 - rust-lang#73613 (The const propagator cannot trace references.)
 - rust-lang#73614 (fix `intrinsics::needs_drop` docs)
 - rust-lang#73630 (Provide context on E0308 involving fn items)
 - rust-lang#73665 (rustc: Modernize wasm checks for atomics)

Failed merges:

r? @ghost
@bors bors merged commit 4f2e540 into rust-lang:master Jun 24, 2020
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
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.

Explain why fn pointers for different fn items are different types
6 participants