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

Projects
None yet
5 participants
@qnighy
Contributor

qnighy commented Nov 18, 2018

This PR solves three problems:

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

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

This comment has been minimized.

Collaborator

rust-highfive commented Nov 18, 2018

r? @cramertj

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

@cramertj

This comment has been minimized.

Member

cramertj commented Nov 19, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 19, 2018

📌 Commit 1cd4ab2 has been approved by cramertj

@eddyb

This comment has been minimized.

Member

eddyb commented Nov 21, 2018

@bors

This comment has been minimized.

Contributor

bors commented Nov 21, 2018

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

@qnighy qnighy force-pushed the qnighy:additional-sizedness branch from 1cd4ab2 to c6a803a Nov 21, 2018

@qnighy

This comment has been minimized.

Contributor

qnighy commented Nov 21, 2018

@cramertj

This comment has been minimized.

Member

cramertj commented Nov 21, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 21, 2018

📌 Commit c6a803a has been approved by cramertj

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Nov 25, 2018

Rollup merge of rust-lang#56045 - qnighy:additional-sizedness, r=cram…
…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

Auto merge of #56215 - pietroalbini:rollup, r=pietroalbini
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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

bors added a commit that referenced this pull request Dec 6, 2018

Auto merge of #56282 - qnighy:additional-sizedness-fix, r=nikomatsakis
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment