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

Check arg/ret sizedness at ExprKind::Path #56045

Merged
merged 5 commits into from
Nov 25, 2018

Conversation

qnighy
Copy link
Contributor

@qnighy qnighy commented Nov 18, 2018

This PR solves three problems:

These are caused by lack of Sizedness checks for arguments/retvals at reference sites of FnDef items (not call sites of the functions). Therefore we can basically add more Sized obligations on typeck. However, adding Sized obligations arbitrarily breaks type inference; to prevent that I added a new method require_type_is_sized_deferred which doesn't interfere usual type inference.

@rust-highfive
Copy link
Collaborator

r? @cramertj

(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 Nov 18, 2018
@cramertj
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 19, 2018

📌 Commit 1cd4ab2067f94bd378c02f5ce6f44d1b84c6867a has been approved by cramertj

@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 Nov 19, 2018
@eddyb
Copy link
Member

eddyb commented Nov 21, 2018

cc @nikomatsakis

@bors
Copy link
Contributor

bors commented Nov 21, 2018

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

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 21, 2018
@qnighy
Copy link
Contributor Author

qnighy commented Nov 21, 2018

r? @cramertj

@cramertj
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 21, 2018

📌 Commit c6a803a has been approved by cramertj

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 21, 2018
pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 25, 2018
…ertj

Check arg/ret sizedness at ExprKind::Path

This PR solves three problems:

- rust-lang#50940: ICE on casting unsized tuple struct constructors
- Unsized tuple struct constructors were callable in presence of `unsized_locals`.
- rust-lang#48055 (comment): we cannot relax `Sized` bounds on stable functions because of fn ptr casting

These are caused by lack of `Sized`ness checks for arguments/retvals at **reference sites of `FnDef` items** (not call sites of the functions). Therefore we can basically add more `Sized` obligations on typeck. However, adding `Sized` obligations arbitrarily breaks type inference; to prevent that I added a new method `require_type_is_sized_deferred` which doesn't interfere usual type inference.
bors added a commit that referenced this pull request Nov 25, 2018
Rollup of 14 pull requests

Successful merges:

 - #56024 (Don't auto-inline const functions)
 - #56045 (Check arg/ret sizedness at ExprKind::Path)
 - #56072 (Stabilize macro_literal_matcher)
 - #56075 (Encode a custom "producers" section in wasm files)
 - #56100 (generator fields are not necessarily initialized)
 - #56101 (Incorporate `dyn` into more comments and docs.)
 - #56144 (Fix BTreeSet and BTreeMap gdb pretty-printers)
 - #56151 (Move a flaky process test out of libstd)
 - #56170 (Fix self profiler ICE on Windows)
 - #56176 (Panic setup msg)
 - #56204 (Suggest correct enum variant on typo)
 - #56207 (Stabilize the int_to_from_bytes feature)
 - #56210 (read_c_str should call the AllocationExtra hooks)
 - #56211 ([master] Forward-ports from beta)

Failed merges:

r? @ghost
@bors bors merged commit c6a803a into rust-lang:master Nov 25, 2018
bors added a commit that referenced this pull request Dec 6, 2018
Fix #56237: normalize type before deferred sizedness checking.

This seems to fix #56237, which was introduced by #56045. I don't thoroughly understand how this works, but the problem seemed to be a lack of normalization.

r? @cramertj
@qnighy qnighy deleted the additional-sizedness branch February 3, 2019 09:04
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.

5 participants