about summary refs log tree commit diff
path: root/src/test/run-pass
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-11-25 17:04:58 +0100
committerGitHub <noreply@github.com>2018-11-25 17:04:58 +0100
commit6c2513c0d38c8690ef0d2f9d024fafa2391671db (patch)
treeaeaa819308ab9e8e89dc13360309c302c75ba67f /src/test/run-pass
parent1aa3ffaf9912e2ba60295a28a820c38a78346dc5 (diff)
parentc6a803a286faae901a6ebd35ec222901f691c7ec (diff)
downloadrust-6c2513c0d38c8690ef0d2f9d024fafa2391671db.tar.gz
rust-6c2513c0d38c8690ef0d2f9d024fafa2391671db.zip
Rollup merge of #56045 - qnighy:additional-sizedness, r=cramertj
Check arg/ret sizedness at ExprKind::Path

This PR solves three problems:

- #50940: ICE on casting unsized tuple struct constructors
- Unsized tuple struct constructors were callable in presence of `unsized_locals`.
- https://github.com/rust-lang/rust/issues/48055#issuecomment-437178966: 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.
Diffstat (limited to 'src/test/run-pass')
-rw-r--r--src/test/run-pass/unsized-locals/unsized-exprs.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/test/run-pass/unsized-locals/unsized-exprs.rs b/src/test/run-pass/unsized-locals/unsized-exprs.rs
index 4b988f1e72d..bc64fcdec2e 100644
--- a/src/test/run-pass/unsized-locals/unsized-exprs.rs
+++ b/src/test/run-pass/unsized-locals/unsized-exprs.rs
@@ -34,4 +34,5 @@ fn main() {
     udrop::<[u8]>((*foo()));
     udrop::<[u8]>((*tfoo()).1);
     *afoo() + 42;
+    udrop as fn([u8]);
 }