Commit Graph

237133 Commits

Author SHA1 Message Date
bors
c2ef35161f Auto merge of #117076 - oli-obk:privacy_visitor_types, r=petrochenkov
Refactor type visitor walking

r? `@petrochenkov`

pulling out the uncontroversial parts of https://github.com/rust-lang/rust/pull/113671
2023-10-25 08:54:09 +00:00
bors
51ae1fe849 Auto merge of #3141 - rust-lang:rustup-2023-10-25, r=RalfJung
Automatic Rustup
2023-10-25 08:04:36 +00:00
Ralf Jung
19c4fa60ea CLOCK_UPTIME_RAW exists on all macos targets, not just the ARM ones 2023-10-25 10:03:09 +02:00
bors
c716f180e8 Auto merge of #116236 - dtolnay:builtinmacrocomment, r=cjgillot
Modernize rustc_builtin_macros generics helpers

- Rustfmt-compatible formatting for the code snippets in comments
- Eliminate an _"Extra scope required"_ obsoleted by NLL
2023-10-25 06:57:37 +00:00
The Miri Conjob Bot
3751fb09c3 Merge from rustc 2023-10-25 05:40:45 +00:00
bors
9c793e18dd Auto merge of #3140 - RalfJung:gamma, r=RalfJung
add some more gamma function tests
2023-10-25 05:32:41 +00:00
The Miri Conjob Bot
c612ba8e29 Preparing for merge from rustc 2023-10-25 05:31:14 +00:00
Ralf Jung
e83c8c1c2b add some more gamma function tests 2023-10-25 07:30:27 +02:00
bors
98108dc26c Auto merge of #116993 - compiler-errors:clause-kind, r=jackh726
Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`

Uplift `ClauseKind` and `PredicateKind` into `rustc_type_ir`.

Blocked on #116951

r? `@ghost`
2023-10-25 05:02:04 +00:00
Gurinder Singh
079b290439 Do not suggest 'Trait<Assoc=arg>' when in trait impl
because that would be illegal syntax
2023-10-25 09:11:16 +05:30
Michael Goulet
23341434bd Fix unwrap suggestion for async fn 2023-10-25 02:29:51 +00:00
bors
2e4e2a8f28 Auto merge of #117139 - compiler-errors:vid-lifetimes, r=BoxyUwU
Get rid of `'tcx` lifetime on `ConstVid`, `EffectVid`

These are simply newtyped numbers, so don't really have a reason (per se) to have a lifetime -- `TyVid` and `RegionVid` do not, for example.

The only consequence of this is that we need to use a new key type for `UnifyKey` that mentions `'tcx`. This is already done for `RegionVid`, with `RegionVidKey<'tcx>`, but this `UnifyKey` trait implementation may have been the original reason to give `ConstVid` a lifetime. See the changes to `compiler/rustc_middle/src/infer/unify_key.rs` specifically.

I consider the code cleaner this way, though -- we removed quite a few unnecessary `'tcx` in the process. This also makes it easier to uplift these two ids to `rustc_type_ir`, which I plan on doing in a follow-up PR.

r? `@BoxyUwU`
2023-10-25 02:01:04 +00:00
David Tolnay
1a9ea1f1a5
Expose a non-Symbol way to access current rustc version string 2023-10-24 18:11:20 -07:00
David Tolnay
51f7fbab92
CFG_RELEASE is mandatory, no need for option_env
The same file already contains another env!("CFG_RELEASE") on line 632,
so it's impossible for this crate to compile without CFG_RELEASE set.
2023-10-24 18:04:47 -07:00
David Tolnay
fd8907f9cf
Handle structured stable attribute 'since' version in clippy 2023-10-24 18:00:26 -07:00
Weihang Lo
fd7bbc2aa5
Update cargo 2023-10-24 20:51:13 -04:00
Zalathar
65b0f6adb0 Remove support for alias -Z instrument-coverage
This flag was stabilized in rustc 1.60.0 as `-C instrument-coverage`, but the
old unstable flag was kept around as an alias to ease migration.
2023-10-25 11:37:46 +11:00
Zalathar
bc18509719 coverage: UI test for unstable value -C instrument-coverage=branch 2023-10-25 11:36:45 +11:00
David Tolnay
6933a671d3
Handle structured stable attribute 'since' version in rustdoc 2023-10-24 17:34:59 -07:00
bors
848a387967 Auto merge of #116482 - matthewjasper:thir-unsafeck-inline-constants, r=b-naber
Fix inline const pattern unsafety checking in THIR

Fix THIR unsafety checking of inline constants.
- Steal THIR in THIR unsafety checking (if enabled) instead of MIR lowering.
- Represent inline constants in THIR patterns.
2023-10-25 00:03:57 +00:00
David Tolnay
7b0e315ae6
Update stability attribute sanity UI test to delete superfluous errors 2023-10-24 15:50:24 -07:00
David Tolnay
ddcb1833ff
Keep track of #[stable] attribute even if version cannot be parsed 2023-10-24 15:50:23 -07:00
David Tolnay
f2ae7b55ae
Store 'since' attribute as parsed Version 2023-10-24 15:50:23 -07:00
Celina G. Val
17f6df9c63 Use IndexMap for handling stable Ty 2023-10-24 15:37:43 -07:00
Celina G. Val
3f60165d27 Remove fold code and add Const::internal()
We are not planning to support user generated constant in the
foreseeable future, so we are removing the Fold logic for now in
favor of the Instance::resolve logic.

The Instance::resolve was however incomplete, since we weren't handling
internalizing constants yet. Thus, I added that.

I decided to keep the Const fields private in case we decide to
translate them lazily.
2023-10-24 14:50:58 -07:00
bors
df871fbf05 Auto merge of #115796 - cjgillot:const-prop-rvalue, r=oli-obk
Generate aggregate constants in DataflowConstProp.
2023-10-24 21:47:53 +00:00
Tomasz Miąsko
011b260cc8 Require target features to match exactly during inlining
In general it is not correct to inline a callee with a target features
that are subset of the callee. Require target features to match exactly
during inlining.

The exact match could be potentially relaxed, but this would require
identifying specific feature that are allowed to differ, those that need
to match, and those that can be present in caller but not in callee.

This resolves MIR part of #116573. For other concerns with respect to
the previous implementation also see areInlineCompatible in LLVM.
2023-10-24 22:49:15 +02:00
Tomasz Miąsko
b3cfd5bb04 Precommit target features compatibility test 2023-10-24 22:44:59 +02:00
Daniel Cheng
8fa800db61 Mark .rmeta files as /SAFESEH on x86 Windows.
Chrome links .rlibs with /WHOLEARCHIVE or -Wl,--whole-archive to prevent
the linker from discarding static initializers. This works well, except
on Windows x86, where lld complains:

  error: /safeseh: lib.rmeta is not compatible with SEH

The fix is simply to mark the .rmeta as SAFESEH aware. This is trivially
true, since the metadata file does not contain any executable code.
2023-10-24 13:42:28 -07:00
Tomasz Miąsko
ff7bf792ce Migrate inline_compatibility.rs test to FileCheck 2023-10-24 22:19:44 +02:00
Michael Goulet
a986ab4d4d Get rid of 'tcx on ConstVid, EffectVid 2023-10-24 20:13:36 +00:00
bors
151256bd4b Auto merge of #117135 - matthiaskrgr:rollup-zdh18i6, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #116094 (Introduce `-C instrument-coverage=branch` to gate branch coverage)
 - #116396 (Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`)
 - #116714 (Derive `Ord`, `PartialOrd` and `Hash` for `SocketAddr*`)
 - #116792 (Avoid unnecessary renumbering during borrowck)
 - #116841 (Suggest unwrap/expect for let binding type mismatch)
 - #116943 (Add target features for LoongArch)
 - #117010 (Add method to convert internal to stable constructs)
 - #117127 (Remove `#[allow(incomplete_features)]` from RPITIT/AFIT tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-24 19:32:19 +00:00
Michael Goulet
18b7d9eb8c Intern LocalDefId list from opaque query 2023-10-24 18:01:01 +00:00
Matthias Krüger
060bdfd9f3
Rollup merge of #117127 - compiler-errors:incomplete, r=lqd
Remove `#[allow(incomplete_features)]` from RPITIT/AFIT tests

They've been unnecessary for a while.
2023-10-24 19:29:56 +02:00
Matthias Krüger
f131a0a771
Rollup merge of #117010 - celinval:smir-internal, r=oli-obk
Add method to convert internal to stable constructs

This is an alternative implementation to https://github.com/rust-lang/rust/pull/116999. I believe we can still improve the logic a bit here, but I wanted to see which direction we should go first.

In this implementation, the API is simpler and we keep Tables somewhat private. The definition is still public though, since we have to expose the Stable trait. However, there's a cost of keeping another thread-local and using `Rc`, but I'm hoping it will be a small cost.

r? ``@oli-obk``
r? ``@spastorino``
2023-10-24 19:29:56 +02:00
Matthias Krüger
84f0befac5
Rollup merge of #116943 - heiher:target-features, r=wesleywiser
Add target features for LoongArch
2023-10-24 19:29:55 +02:00
Matthias Krüger
7a0a2d2d23
Rollup merge of #116841 - chenyukang:yukang-suggest-unwrap-expect, r=b-naber
Suggest unwrap/expect for let binding type mismatch

Found it when investigating https://github.com/rust-lang/rust/issues/116738
I'm not sure whether it's a good style to suggest `unwrap`, seems it's may helpful for newcomers.

#116738 needs another fix to improve it.
2023-10-24 19:29:55 +02:00
Matthias Krüger
61ff4dbedd
Rollup merge of #116792 - JonasAlaif:renumber-fix, r=b-naber
Avoid unnecessary renumbering during borrowck

Currently, after renumbering there are always unused `RegionVid`s if the return type contains any regions, this is due to `visit_ty` being called twice on the same `Ty`: once with `TyContext::ReturnTy` and once with `TyContext::LocalDecl { local: _0 }`. This PR skips renumbering the first time around.
2023-10-24 19:29:54 +02:00
Matthias Krüger
845c414fae
Rollup merge of #116714 - WaffleLapkin:order-the-order, r=joshtriplett
Derive `Ord`, `PartialOrd` and `Hash` for `SocketAddr*`

Fixes #116711

The main pain of this PR is to fix the buggy impl of `Ord` for `SocketAddrV6`, which ignored half of the fields (while `PartialEq` is derived):
4603f0b8af/library/core/src/net/socket_addr.rs (L99-L106)

4603f0b8af/library/core/src/net/socket_addr.rs (L676)

For me it looks like a simple copy-paste error made in https://github.com/rust-lang/rust/pull/72239 (copy from v4 impl) (cc `@hch12907),` as I don't see this behavior being mentioned anywhere on the PR and it also does not respect `cmp` trait "rules". I also do not see any reasons for those impls to _not_ be derived.

It's a shame we did not notice this for 28 versions/3 years. I guess this is a bug fix, but I'm not sure what the process here should be.

r? libs
2023-10-24 19:29:54 +02:00
Matthias Krüger
f3e18e4a60
Rollup merge of #116396 - obeis:hir-analysis-migrate-diagnostics-7, r=oli-obk
Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`

r? ``@compiler-errors``
2023-10-24 19:29:53 +02:00
Matthias Krüger
c07ff9c810
Rollup merge of #116094 - Swatinem:coverage-branch-gate, r=wesleywiser
Introduce `-C instrument-coverage=branch` to gate branch coverage

This was extracted from https://github.com/rust-lang/rust/pull/115061 and can land independently from other coverage related work.

The flag is unused for now, but is added in advance of adding branch coverage support.
It is an unstable, nightly only flag that needs to be used in combination with `-Zunstable-options`, like so: `-Zunstable-options -C instrument-coverage=branch`.

The goal is to develop branch coverage as an unstable opt-in feature first, before it matures and can be turned on by default.
2023-10-24 19:29:53 +02:00
bors
98b4a64a16 Auto merge of #117126 - matthiaskrgr:rollup-8huie8f, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #117081 (fix typos in comments)
 - #117091 (`OptWithInfcx` naming nits, trait bound simplifications)
 - #117092 (Add regression test for #117058)
 - #117093 (Update books)
 - #117105 (remove change-id assertion in bootstrap test)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-24 17:28:45 +00:00
Michael Goulet
a947654a96 Merge impl_wf_inference into coherence checking 2023-10-24 17:01:25 +00:00
yukang
f3d20be42b suggest unwrap/expect for let binding type mismatch 2023-10-25 00:32:58 +08:00
Michael Goulet
90e3aaeca2 Remove incomplete features from RPITIT/AFIT tests 2023-10-24 15:27:06 +00:00
Camille GILLOT
9c85dfa1d7 Tweak test to avoid platform dependency. 2023-10-24 15:16:57 +00:00
Matthias Krüger
9510e972e3
Rollup merge of #117105 - onur-ozkan:remove-change-id-assertion, r=albertlarsan68
remove change-id assertion in bootstrap test

In the bootstrap test, the assertion of the change-id fails whenever we update the change-id next to a breaking change in build configurations. This commit removes the assertion, as it's not critical or useful to have.

ref https://github.com/rust-lang/rust/pull/115898#issuecomment-1775909050
2023-10-24 17:09:01 +02:00
Matthias Krüger
5a0e51e28b
Rollup merge of #117093 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

1 commits in 72187f5cd0beaaa9c6f584156bcd88f921871e83..3dca2fc50b922a8efb94903b9fee8bb42ab48f38
2023-10-19 18:01:47 UTC to 2023-10-19 18:01:47 UTC

- Fix cargo doc links (rust-lang/book#3751)

## rust-embedded/book

1 commits in eac173690b8cc99094e1d88bd49dd61127fbd285..22bca3d0f6e9b9b556689b54ce96f25b46ecd1b3
2023-10-16 22:47:38 UTC to 2023-10-16 22:47:38 UTC

- Improved hardware.md chapter. (rust-embedded/book#361)

## rust-lang/nomicon

1 commits in ddfa4214487686e91b21aa29afb972c08a8f0d5b..1842257814919fa62e81bdecd5e8f95be2839dbb
2023-10-17 15:11:58 UTC to 2023-10-17 15:11:58 UTC

- Fixed `Hole::get` marked as unsafe in `exception-safety.md` (rust-lang/nomicon#427)

## rust-lang/reference

2 commits in 142b2ed77d33f37a9973772bd95e6144ed9dce43..16fd3c06d9e558dae2d52000818274ae70c9e90a
2023-10-14 22:31:04 UTC to 2023-10-11 15:35:55 UTC

- Adjust reference for return-position `impl Trait` in trait and `async fn` in trait (rust-lang/reference#1409)
- Fix temporary drop scope for last expression. (rust-lang/reference#1416)

## rust-lang/rust-by-example

1 commits in 8eb3a01ab74c567b7174784892fb807f2c632d6b..6709beeb7d0fbc5ffc91ac4893a24434123b9bfa
2023-10-20 19:11:21 UTC to 2023-10-20 19:11:21 UTC

- docs: fix a typo (rust-lang/rust-by-example#1752)

## rust-lang/rustc-dev-guide

5 commits in b98af7d661e4744baab81fb8dc7a049e44a4a998..b0ee9ec8fa59a6c7620165e061f4747202377a62
2023-10-22 03:18:44 UTC to 2023-10-11 06:30:26 UTC

- Add WF to glossary (rust-lang/rustc-dev-guide#1810)
- recommend `unpretty=hir` alongside `unpretty=hir-tree` (rust-lang/rustc-dev-guide#1804)
- Start a chapter about the evolving const effect system (rust-lang/rustc-dev-guide#1808)
- Document subtle implied bounds issue in RPITIT inference (rust-lang/rustc-dev-guide#1807)
- [suggested.md]  `changelog-seen` -> `change-id` in `shell.nix` (rust-lang/rustc-dev-guide#1806)
2023-10-24 17:09:01 +02:00
Matthias Krüger
af58cdab18
Rollup merge of #117092 - matthewjasper:attribute-validation, r=compiler-errors
Add regression test for #117058

The new behavior in nightly is correct, so add a test that it stays this way.

Closes #117058
2023-10-24 17:09:00 +02:00
Matthias Krüger
cb651300ec
Rollup merge of #117091 - compiler-errors:debug, r=lcnr
`OptWithInfcx` naming nits, trait bound simplifications

* Use an associated type `Interner` on `InferCtxtLike` to remove a redundant interner parameter (`I: Interner, Infcx: InferCtxtLike<I>` -> `Infcx: InferCtxtLike`).
* Remove double-`Option` between `infcx: Option<Infcx>` and `fn universe_of_ty(&self, ty: ty::InferTy) -> Option<ty::UniverseIndex>`. We don't need the infcx to be optional if we can provide a "noop" (`NoInfcx`) implementation that just always returns `None` for universe index.
    * Also removes the `core::convert::Infallible` implementation which I found a bit weird...
* Some naming nits with params.
    * I found `InferCtxt` + `InfCtx` and `Infcx` to be a lot of different ways to spell "inference context", so I got rid of the `InfCtx` type parameter name in favor of `Infcx` which is a more standard name.
    * I found `OptWithInfcx` to be a bit redundant -> `WithInfcx`.

I'm making these changes because I intend to reuse the `InferCtxtLike` trait for uplifting the canonicalizer into a new trait -- conveniently, the information I need for uplifting the canonicalizer also is just the universe information of a type var, so it's super convenient 😸

r? `@BoxyUwU` or `@lcnr`
2023-10-24 17:09:00 +02:00