Commit Graph

17216 Commits

Author SHA1 Message Date
Oli Scherer
759c04a00b Some tracing instrumentation cleanups 2022-09-21 11:31:55 +00:00
Oli Scherer
3d69d23a25 Split match out into a helper function 2022-09-21 11:31:55 +00:00
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
bors
432abd86f2 Auto merge of #102061 - notriddle:rollup-kwu9vp8, r=notriddle
Rollup of 12 pull requests

Successful merges:

 - #100250 (Manually cleanup token stream when macro expansion aborts.)
 - #101014 (Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions)
 - #101958 (Improve error for when query is unsupported by crate)
 - #101976 (MirPhase: clarify that linting is not a semantic change)
 - #102001 (Use LLVM C-API to build atomic cmpxchg and fence)
 - #102008 (Add GUI test for notable traits element position)
 - #102013 (Simplify rpitit handling on lower_fn_decl)
 - #102021 (some post-valtree cleanup)
 - #102027 (rustdoc: remove `docblock` class from `item-decl`)
 - #102034 (rustdoc: remove no-op CSS `h1-6 { border-bottom-color }`)
 - #102038 (Make the `normalize-overflow` rustdoc test actually do something)
 - #102053 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-20 19:10:11 +00:00
Michael Howell
b149c48186
Rollup merge of #102021 - lcnr:tyConst-fun, r=b-naber,BoxyUwU
some post-valtree cleanup

r? project-const-generics cc ```@b-naber```
2022-09-20 10:13:01 -07:00
Michael Howell
08b369a501
Rollup merge of #102013 - spastorino:rpitit-lower-fn-decl, r=compiler-errors
Simplify rpitit handling on lower_fn_decl

r? `````@compiler-errors`````
2022-09-20 10:13:00 -07:00
Michael Howell
2c57a5b166
Rollup merge of #102001 - cuviper:build-atomic-capi, r=nikic
Use LLVM C-API to build atomic cmpxchg and fence

We don't need C++ wrappers because the LLVM C API can build these.
2022-09-20 10:12:59 -07:00
Michael Howell
0d2e57cb04
Rollup merge of #101976 - RalfJung:mir-semantic-phases, r=oli-obk
MirPhase: clarify that linting is not a semantic change

r? ```@JakobDegen```
2022-09-20 10:12:58 -07:00
Michael Howell
2c893737a6
Rollup merge of #101958 - hanar3:101666/enhance-error-message, r=oli-obk
Improve error for when query is unsupported by crate

This is an improvement to the error message mentioned on #101666.  It seems like a good idea to also add [this link to the rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html), if explaining the query system in detail is a concern here, but I'm unsure if there is any restrictions on adding links to error messages.
2022-09-20 10:12:58 -07:00
Michael Howell
3f377d3f96
Rollup merge of #101014 - isikkema:fix-zmeta-stats-file-encoder-no-read-perms, r=isikkema
Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions

Fixes #101001

As far as I can tell, #101001 is caused because the file is being created with write-only permissions here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_serialize/src/opaque.rs#L196

but it is trying to be read here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/encoder.rs#L780

This PR attempts to fix this by creating/opening the file with the same permissions as `File::create()` with the addition of read.
2022-09-20 10:12:57 -07:00
Michael Howell
14b27cfd11
Rollup merge of #100250 - cjgillot:recover-token-stream, r=Aaron1011
Manually cleanup token stream when macro expansion aborts.

In case of syntax error in macro expansion, the expansion code can decide to stop processing anything. In that case, the token stream is malformed. This makes downstream users, like derive macros, ICE.

In this case, this PR manually cleans up the token stream by closing all currently open delimiters.

Fixes https://github.com/rust-lang/rust/issues/96818.
Fixes https://github.com/rust-lang/rust/issues/80447.
Fixes https://github.com/rust-lang/rust/issues/81920.
Fixes https://github.com/rust-lang/rust/issues/91023.
2022-09-20 10:12:56 -07:00
bors
cd8cc91045 Auto merge of #101989 - fee1-dead-contrib:const_trait_impl-assoc-caller-bounds, r=oli-obk
make projection bounds with const bounds satisfy const

Fixes #101982.
2022-09-20 16:24:36 +00:00
Sikkema, Isaac
a2cb8a4949 add comment explaining read permissions 2022-09-20 10:06:50 -04:00
bors
4136b59b7d Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Allow patterns to constrain the hidden type of opaque types

fixes #96572

reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864)

TODO:

* check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-20 12:09:52 +00:00
bors
8fd6d03e22 Auto merge of #101806 - BelovDV:issue-fix-fn-find_library, r=petrochenkov
fix verbatim with upstream dependencies

https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:18 +00:00
bors
a38a082afb fix verbatim with upstream dependencies
https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:17 +00:00
bors
acb8934fd5 Auto merge of #102022 - matthiaskrgr:rollup-emwfjd1, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #101389 (Tone down explanation on RefCell::get_mut)
 - #101798 (Make `from_waker`, `waker` and `from_raw` unstably `const`)
 - #101881 (Remove an unused struct field `late_bound`)
 - #101904 (Add help for invalid inline argument)
 - #101966 (Add unit test for identifier Unicode emoji diagnostics)
 - #101979 (Update release notes for 1.64)
 - #101985 (interpret: expose generate_stacktrace without full InterpCx)
 - #102004 (Try to clarify what's new in 1.64.0 ffi types)
 - #102005 (rustdoc: remove unused CSS `td.summary-column`)
 - #102017 (Add all submodules to the list of directories tidy skips)
 - #102019 (Remove backed off PRs from relnotes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-20 02:20:15 +00:00
bors
2019147c56 Auto merge of #101894 - dingxiangfei2009:let-else-avoid-duplicate-storage-live, r=oli-obk
Avoid duplicating StorageLive in let-else

cc `@est31`

Fix #101867
Fix #101932

#101410 introduced directives to activate storages of bindings in let-else earlier. However, since it is using the machinery of `match` and friends for pattern matching and binding, those storages are activated for the second time. This PR adjusts this behavior and avoid the duplicated activation for let-else statements.
2022-09-19 17:27:30 +00:00
Matthias Krüger
8c0f8a285f
Rollup merge of #101985 - RalfJung:generate_stacktrace, r=oli-obk
interpret: expose generate_stacktrace without full InterpCx

In Miri we sometimes want to emit diagnostics without having a full `&InterpCx` available. To avoid duplicating code, this adds a way to get a stacktrace from an arbitrary slice of interpreter frames, that Miri can use with access to just a thread manager.
2022-09-19 17:55:21 +02:00
Matthias Krüger
9f073b0de0
Rollup merge of #101904 - Rageking8:fix-101712, r=oli-obk
Add help for invalid inline argument

Fixes #101712

Removed 1 part of the test as its identical with another one. Do let me know if this is undesirable, so I can revert those changes.
2022-09-19 17:55:20 +02:00
Matthias Krüger
7697a244cc
Rollup merge of #101881 - TaKO8Ki:remove-unused-struct-field, r=sanxiyn
Remove an unused struct field `late_bound`
2022-09-19 17:55:19 +02:00
Oli Scherer
1905f8c441 Document projection condition 2022-09-19 15:33:36 +00:00
lcnr
c54c5a3c77 DestructuredConst split mir and ty 2022-09-19 17:00:38 +02:00
lcnr
526856768d ctfe, const_to_op only for mir constants 2022-09-19 16:17:33 +02:00
lcnr
638b612154 remove ty::Const::from_inline_const 2022-09-19 16:10:18 +02:00
lcnr
7207b4dc66 remove FnCtxt::to_const 2022-09-19 16:08:40 +02:00
Santiago Pastorino
550bd0945f
Simplify rpitit handling on lower_fn_decl 2022-09-19 09:30:39 -03:00
bors
11bb80a92b Auto merge of #101901 - lcnr:early-binder-type-foldable, r=compiler-errors
`EarlyBinder` prevent misuse

folding a type before substituting is pretty much always wrong and could happen by accident, e.g. see https://github.com/rust-lang/rust/pull/99798#discussion_r968666538

this PR removes the `TypeFoldable` and `TypeVisitable` impl from `EarlyBinder`.

r? types cc `@jackh726`
2022-09-19 10:35:09 +00:00
lcnr
0c3e01d8f6 extend polymorphization hack comment. 2022-09-19 11:44:29 +02:00
lcnr
647052fc04 remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
lcnr
d398b54de6 do not implement type traversal for EarlyBinder 2022-09-19 11:28:32 +02:00
bors
503e19d01e Auto merge of #101629 - compiler-errors:issue-101623, r=sanxiyn
Be careful about `expr_ty_adjusted` when noting block tail type

Fixes #101623
2022-09-19 07:41:54 +00:00
bors
efa717bc2d Auto merge of #101924 - jackh726:revert-static-hrtb-error, r=compiler-errors
Re-add HRTB implied static bug note

r? `@compiler-errors` since you reviewed it previously

I deleted a `normalize` call and forgot about it. Whoops.
2022-09-19 04:56:14 +00:00
Josh Stone
fac12e25dd Use LLVM C-API to build atomic cmpxchg and fence 2022-09-18 16:01:57 -07:00
Ralf Jung
9fa3171015 interpret: expose generate_stacktrace without full InterpCx 2022-09-18 20:51:04 +02:00
Deadbeef
ee96ae0a32 make projection bounds with const bounds satisfy const 2022-09-18 18:05:30 +00:00
Ralf Jung
eed6fdb0eb clarify that linting is not a semantic change 2022-09-18 14:14:42 +02:00
Ding Xiang Fei
48c1c1d190
avoid duplicating StorageLive in let-else 2022-09-18 12:10:53 +08:00
bors
65c16dc3a8 Auto merge of #101960 - matthiaskrgr:rollup-1l5v7ip, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #101151 (Document x86_64-fortanix-unknown-sgx platform)
 - #101912 (Update `unicode-rs` crates to Unicode 15)
 - #101923 (Don't add rustdoc's CSS to other doc pages)
 - #101953 (Fix tooltip display for error codes)
 - #101954 (rustdoc: remove redundant `.location a { font-weight: 500 }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-18 03:40:01 +00:00
Matthias Krüger
46ebe7cf41
Rollup merge of #101912 - crlf0710:compiler_update_unicode_15, r=Manishearth
Update `unicode-rs` crates to Unicode 15

r? `@Manishearth`
2022-09-18 02:55:29 +02:00
bors
bc7b17cfe3 Auto merge of #101862 - cjgillot:lint-regression, r=oli-obk
Do not fetch HIR node when iterating to find lint.

Addresses the regression in https://github.com/rust-lang/rust/pull/101620
2022-09-18 00:46:14 +00:00
hanar3
0405a5d4e9 improve error message for when a query isn't supported 2022-09-17 20:25:37 -03:00
bors
5253b0a0a1 Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101093 (Initial version of 1.64 release notes)
 - #101713 (change AccessLevels representation)
 - #101821 (Bump Unicode to version 15.0.0, regenerate tables)
 - #101826 (Enforce "joined()" and "joined_with_noop()" test)
 - #101835 (Allow using vendoring when running bootstrap from outside the source root)
 - #101942 (Revert "Copy stage0 binaries into stage0-sysroot")
 - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 22:04:28 +00:00
Matthias Krüger
a6b34cd928
Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov
change AccessLevels representation

Part of RFC (https://github.com/rust-lang/rust/issues/48054). This patch implements effective visibility table with basic methods and change AccessLevels table representation according to it.

r? ``@petrochenkov``
2022-09-17 23:30:49 +02:00
Matthias Krüger
4757d2d57e
Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebank
add note for `layout_of` when query depth overflows

Fixes #101747
Added `try_find_layout_root` function to add a note for `layout_of` when query depth overflows. This would make the error in #101747 look like this:
```
error: queries overflow the depth limit!
   |
note: Query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`!
  --> D:\rust-backup\parallel_rust\query_depth.rs:40:1
   |
40 | fn main() {
   | ^^^^^^^^^

error: aborting due to previous error
```

cc ``@semicoleon``
2022-09-17 19:27:06 +02:00
Jack Huey
e7ca6e1b47 Use Predicate ConstraintCategory when normalizing 2022-09-17 11:46:05 -04:00
Jack Huey
1eb71f0893 Add back in normalize call 2022-09-17 11:46:04 -04:00
bors
48de123d7a Auto merge of #101857 - lcnr:make-dyn-again, r=jackh726
change `FnMutDelegate` to trait objects

cc #100016 as mentioned in the last t-compiler meeting

r? `@jackh726`
2022-09-17 13:37:48 +00:00
Dylan DPC
7c55c992ab
Rollup merge of #101807 - jackh726:no-gat-defaults, r=lcnr
Disallow defaults on type GATs

Fixes #99205
2022-09-17 15:31:08 +05:30
Dylan DPC
4c64c14420
Rollup merge of #101790 - TaKO8Ki:do-not-suggest-placeholder-to-const-and-static-without-type, r=compiler-errors
Do not suggest a placeholder to const and static without a type

Fixes #101755
2022-09-17 15:31:08 +05:30