rust/src
bors 1de00d1ac5 Auto merge of #100096 - compiler-errors:fn-return-must-be-sized, r=jackh726
a fn pointer doesn't implement `Fn`/`FnMut`/`FnOnce` if its return type isn't sized

I stumbled upon #83915 which hasn't received much attention recently, and I wanted to revive it since this is one existing soundness hole that seems pretty easy to fix.

I'm not actually sure that the [alternative approach described here](https://github.com/rust-lang/rust/pull/83915#issuecomment-823643322) is sufficient, given the `src/test/ui/function-pointer/unsized-ret.rs` example I provided below. Rebasing the branch mentioned in that comment and testing that UI test, it seems that we actually end up only observing that `str: !Sized` during monomorphization, whereupon we ICE. Even if we were to fix that ICE, ideally we'd be raising an error that a fn pointer is being used badly during _typecheck_ instead of monomorphization, hence adapting the original approach in #83915.

I am happy to close this if people would prefer we rebase the original PR and land that -- I am partly opening to be annoying and get people thinking about this unsoundness again ❤️ 😸

cc: `@estebank` and `@nikomatsakis`
r? types

Here's a link to the thread: https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/PR.20.2383915/near/235421351 for more context.
2022-09-21 04:35:20 +00:00
..
bootstrap Auto merge of #101799 - LukeMathWalker:distribute-json-doc, r=jyn514 2022-09-19 02:13:54 +00:00
ci Auto merge of #101332 - sashashura:patch-1, r=pietroalbini 2022-09-18 14:10:57 +00:00
doc Rollup merge of #101151 - jethrogb:jb/sgx-platform, r=JohnTitor 2022-09-18 02:55:29 +02:00
etc Remove check_missing_items.py 2022-09-14 16:14:15 +01:00
librustdoc Rollup merge of #102034 - notriddle:notriddle/border-bottom, r=GuillaumeGomez 2022-09-20 10:13:02 -07:00
llvm-project@670e5f673a Update LLVM submodule 2022-09-02 10:18:12 +02:00
rustdoc-json-types Document that ResolvedPath can also be a union 2022-09-16 19:51:58 +01:00
test Auto merge of #100096 - compiler-errors:fn-return-must-be-sized, r=jackh726 2022-09-21 04:35:20 +00:00
tools Rollup merge of #102053 - lnicola:rust-analyzer-2022-09-20, r=lnicola 2022-09-20 10:13:03 -07:00
README.md Sunset RLS 2022-08-27 21:36:08 -07:00
stage0.json Bump stage0 2022-08-29 19:30:11 +02:00
version bump version to 1.66.0 2022-09-16 10:51:09 +02:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like cargo, miri, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.