Commit Graph

235315 Commits

Author SHA1 Message Date
Nicholas Nethercote
442a66d385 Remove unneeded dependency. 2023-10-06 14:57:09 +11:00
bors
cae0791da4 Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errors
Remove is global hack

In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed.

In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs

This is a fix candidate opened for performance run.

r? `@lcnr`
2023-10-05 19:42:05 +00:00
Oğuz Ağcayazı
e30d27be00 remove is global hack 2023-10-05 21:38:12 +03:00
bors
cdca82c2c8 Auto merge of #116455 - matthiaskrgr:rollup-p226a5u, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116220 (stabilize `Option::as_`(`mut_`)`slice`)
 - #116288 (Add Span to various smir types)
 - #116415 (Move subtyper below reveal_all and change reveal_all)
 - #116428 (Add a note to duplicate diagnostics)
 - #116452 (Do not assert that hidden types don't have erased regions.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-05 17:50:50 +00:00
Matthias Krüger
76d0b794cb
Rollup merge of #116452 - cjgillot:noassert-erased, r=oli-obk
Do not assert that hidden types don't have erased regions.

cc https://github.com/rust-lang/rust/issues/116306

`args` can have erased regions.
In the linked issue, this is reached by computing whether a large type is `Freeze` to compute its ABI.

I do not have a minimized test to include.
2023-10-05 19:24:35 +02:00
Matthias Krüger
c1c5ab717e
Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, r=compiler-errors,estebank
Add a note to duplicate diagnostics

Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into

For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05 19:24:35 +02:00
Matthias Krüger
08cc7428d9
Rollup merge of #116415 - ouz-a:move_subtyper, r=oli-obk
Move subtyper below reveal_all and change reveal_all

In previous attempt https://github.com/rust-lang/rust/pull/116378 we tried to handle `Opaque` in few different places, but this isn't necessary, after moving subtyper below reveal_all and calling `super_place` on reveal_all, issues cease to exist.

r? ``@oli-obk``

Fixes https://github.com/rust-lang/rust/issues/116332
Fixes https://github.com/rust-lang/rust/issues/116265
Fixes https://github.com/rust-lang/rust/issues/116383
Fixes https://github.com/rust-lang/rust/issues/116333
2023-10-05 19:24:34 +02:00
Matthias Krüger
b301bd4220
Rollup merge of #116288 - ouz-a:smir_spans, r=spastorino
Add Span to various smir types

Had to make few extra changes to few structs to attach spans to them.

r? ``@oli-obk``
2023-10-05 19:24:34 +02:00
Matthias Krüger
864e5d8d94
Rollup merge of #116220 - llogiq:stabilize-option-as-slice, r=BurntSushi
stabilize `Option::as_`(`mut_`)`slice`

This is the stabilization to #108545. Thanks to everyone who helped getting this into Rust proper.
2023-10-05 19:24:33 +02:00
ouz-a
3088c4b046 move subtyper change reveal_all 2023-10-05 18:56:30 +03:00
Camille GILLOT
14c846cb05 Do not assert that hidden types don't have erased regions. 2023-10-05 15:50:36 +00:00
bors
3bcad65fbf Auto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee
docs: Correct terminology in std::cmp

This PR is the result of some discussions on URLO:

* [Traits in `std::cmp` and mathematical terminology](https://users.rust-lang.org/t/traits-in-std-cmp-and-mathematical-terminology/69887)
* [Are poker hands `Ord` or `PartialOrd`?](https://users.rust-lang.org/t/are-poker-hands-ord-or-partialord/82644)

Arguably, the documentation currently isn't very precise regarding mathematical terminology. This can lead to misunderstandings of what `PartialEq`, `Eq`, `PartialOrd`, and `Ord` actually do.

While I believe this PR doesn't give any new API guarantees, it expliclitly mentions that `PartialEq::eq(a, b)` may return `true` for two distinct values `a` and `b` (i.e. where `a` and `b` are not equal in the mathematical sense). This leads to the consequence that `Ord` may describe a weak ordering instead of a total ordering.

In either case, I believe this PR should be thoroughly reviewed, ideally by someone with mathematical background to make sure the terminology is correct now, and also to ensure that no unwanted new API guarantees are made.

In particular, the following problems are addressed:

* Some clarifications regarding used (mathematical) terminology:
    * Avoid using the terms "total equality" and "partial equality" in favor of "equivalence relation" and "partial equivalence relation", which are well-defined and unambiguous.
    * Clarify that `Ordering` is an ordering between two values (and not an order in the mathematical sense).
    * Avoid saying that `PartialEq` and `Eq` are "equality comparisons" because the terminology "equality comparison" could be misleading: it's possible to implement `PartialEq` and `Eq` for other (partial) equivalence relations, in particular for relations where `a == b` for some `a` and `b` even when `a` and `b` are not the same value.
    * Added a section "Strict and non-strict partial orders" to document that the `<=` and `>=` operators do not correspond to non-strict partial orders.
    * Corrected section "Corollaries" in documenation of `Ord` in regard to `<` only describing a strict total order in cases where `==` conforms to mathematical equality.
    * ~~Added a section "Weak orders" to explain that `Ord` may also describe a weak order or total preorder, depending on how `PartialEq::eq` has been implemented.~~ (Removed, see [comment](https://github.com/rust-lang/rust/pull/103046#issuecomment-1279929676))
* Made documentation easier to understand:
    * Explicitly state at the beginning of `PartialEq`'s documentation comment that implementing the trait will provide the `==` and `!=` operators.
    * Added an easier to understand rule when to implement `Eq` in addition to `PartialEq`: "if it’s guaranteed that `PartialEq::eq(a, a)` always returns `true`."
    *  Explicitly mention in documentation of `Eq` that the properties "symmetric" and "transitive" are already required by `PartialEq`.
2023-10-05 15:24:54 +00:00
bors
cf9fd95b1c Auto merge of #114042 - liushuyu:ubuntu/i586-fpmath, r=workingjubilee
core library: Disable fpmath tests for i586 ...

This patch disables the floating-point epsilon test for i586 since x87 registers are too imprecise and can't produce the expected results.
2023-10-05 13:35:18 +00:00
Jan Behrens
86b031b734 docs: Correct terminology in std::cmp
Some clarifications regarding used (mathematical) terminology:

* Avoid using the terms "total equality" and "partial equality" in favor
  of "equivalence relation" and "partial equivalence relation", which
  are well-defined and unambiguous.
* Clarify that `Ordering` is an ordering between two values (and not an
  order in the mathematical sense).
* Avoid saying that `PartialEq` and `Eq` are "equality comparisons"
  because the terminology "equality comparison" could be misleading:
  it's possible to implement `PartialEq` and `Eq` for other (partial)
  equivalence relations, in particular for relations where `a == b` for
  some `a` and `b` even when `a` and `b` are not the same value.
* Added a section "Strict and non-strict partial orders" to document
  that the `<=` and `>=` operators do not correspond to non-strict
  partial orders.
* Corrected section "Corollaries" in documenation of Ord in regard to
  `<` only describing a strict total order in cases where `==` conforms
  to mathematical equality.

Made documentation easier to understand:

* Explicitly state at the beginning of `PartialEq`'s documentation
  comment that implementing the trait will provide the `==` and `!=`
  operators.
* Added an easier to understand rule when to implement `Eq` in addition
  to `PartialEq`: "if it’s guaranteed that `PartialEq::eq(a, a)` always
  returns `true`."
* Explicitly mention in documentation of `Eq` that the properties
  "symmetric" and "transitive" are already required by `PartialEq`.
2023-10-05 14:44:42 +02:00
bors
90f3a6f920 Auto merge of #104153 - tspiteri:doc-float-constants, r=workingjubilee
doc: expand description for f32 and f64 associated constants

This explains the meaning of some of the floating-point associated constants.
2023-10-05 11:46:55 +00:00
bors
5c3a0e932b Auto merge of #116427 - cjgillot:no-internal, r=oli-obk
Remove mir::LocalDecl::internal.

It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-05 09:59:14 +00:00
Oğuz Ağcayazı
a49138e46e impl stable for kinds 2023-10-05 11:15:34 +03:00
ouz-a
a79567b01c add span to statements 2023-10-05 11:15:34 +03:00
bors
e293927016 Auto merge of #116443 - workingjubilee:rollup-r9mh13f, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #116223 (Fix misuses of a vs an)
 - #116296 (More accurately point to where default return type should go)
 - #116429 (Diagnostics: Be more careful when suggesting struct fields)
 - #116431 (Tweak wording of E0562)
 - #116432 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 2))

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-05 08:12:55 +00:00
Jubilee
4a14a80605
Rollup merge of #116432 - notriddle:master, r=fmease
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 2)

Follow up https://github.com/rust-lang/rust/pull/116214
2023-10-05 00:56:31 -07:00
Jubilee
d7b02c3d40
Rollup merge of #116431 - estebank:issue-80476, r=compiler-errors
Tweak wording of E0562

Fix #80476.
2023-10-05 00:56:30 -07:00
Jubilee
a9a389cf44
Rollup merge of #116429 - fmease:clean-up-struct-field-suggs, r=compiler-errors
Diagnostics: Be more careful when suggesting struct fields

Consolidate the various places which filter out struct fields that shouldn't be suggested into a single function.

Previously, each of those code paths had slightly different and incomplete metrics for no good reason. Now, there's only a single 'complete' metric (namely `is_field_suggestable`) which also filters out hygienic fields that come from different syntax contexts.

Fixes #116334.
2023-10-05 00:56:30 -07:00
Jubilee
cfce3a919d
Rollup merge of #116296 - compiler-errors:default-return, r=estebank
More accurately point to where default return type should go

When getting the "default return type" span, instead of pointing to the low span of the next token, point to the high span of the previous token. This:

1. Makes forming return type suggestions more uniform, since we expect them all in the same place.
2. Arguably makes labels easier to understand, since we're pointing to where the implicit `-> ()` would've gone, rather than the starting brace or the semicolon.

r? ```@estebank```
2023-10-05 00:56:29 -07:00
Jubilee
ea3454eabb
Rollup merge of #116223 - catandcoder:master, r=cjgillot
Fix misuses of a vs an

Fixes the misuse of "a" vs "an", according to English grammatical
expectations and using https://www.a-or-an.com/
2023-10-05 00:56:29 -07:00
bors
5236c8e1fa Auto merge of #116273 - compiler-errors:refine2, r=tmandry
Only trigger `refining_impl_trait` lint on reachable traits

Public but unreachable traits don't matter 😸

r? `@tmandry`
2023-10-05 03:00:30 +00:00
bors
b781645332 Auto merge of #116184 - compiler-errors:afit-lint, r=tmandry
Add `async_fn_in_trait` lint

cc https://github.com/rust-lang/rust/pull/115822#issuecomment-1731168465

Mostly unsure what the messaging should be. Feedback required.

r? `@tmandry`
2023-10-05 01:14:25 +00:00
Alex Macleod
5453a9f34d Add a note to duplicate diagnostics 2023-10-05 01:04:41 +00:00
bors
afe67fa2ef Auto merge of #116370 - nnethercote:more-arena-stuff, r=cjgillot
Remove the `TypedArena::alloc_from_iter` specialization.

It was added in #78569. It's complicated and doesn't actually help
performance.

r? `@cjgillot`
2023-10-04 22:32:46 +00:00
Tyler Mandry
2f5249019e
Apply suggestions from code review
Co-authored-by: Travis Cross <tc@traviscross.com>
2023-10-04 18:20:05 -04:00
Michael Goulet
dd5f26c42d Fix spans for comments in rustfmt 2023-10-04 21:09:54 +00:00
Michael Goulet
1f079cfb44 Point to closure return instead of output if defaulted 2023-10-04 21:09:54 +00:00
Michael Goulet
89b14ae212 Fix clippy 2023-10-04 21:09:54 +00:00
Michael Goulet
137b6d0b01 Point to where missing return type should go 2023-10-04 21:09:54 +00:00
bors
2bbb619893 Auto merge of #114417 - chinedufn:fix-expect-unused-in-impl-block-rust-issue-114416, r=cjgillot
Fix multiple `expect` attribs in impl block

Closes #114416
2023-10-04 20:44:38 +00:00
Michael Howell
a46ccd8d3f Add URL to test case issues 2023-10-04 13:04:45 -07:00
Michael Howell
9266270ef5 Rename issue-\d+.rs tests to have meaningful names 2023-10-04 12:58:06 -07:00
Esteban Küber
041e54bd92 Tweak wording of E0562
Fix #80476.
2023-10-04 19:51:43 +00:00
León Orell Valerian Liehr
867cc41b5b
clean up struct field suggestions 2023-10-04 21:36:04 +02:00
Michael Howell
a198aff4a4 Add crate_name to test so that it can be renamed 2023-10-04 12:13:01 -07:00
bors
eea26141ec Auto merge of #115200 - rcvalle:rust-cfi-fix-115199, r=workingjubilee
Disable CFI for core and std CFI violations

Work around https://github.com/rust-lang/rust/issues/115199 by temporarily disabling CFI for core and std CFI violations to allow the user rebuild and use both core and std with CFI enabled using the Cargo build-std feature.
2023-10-04 18:54:49 +00:00
Camille GILLOT
e63d19c4dd Remove mir::LocalDecl::internal. 2023-10-04 17:55:15 +00:00
Ramon de C Valle
abece4facc Update documentation for LLVM CFI support
Updates documentation for LLVM CFI support with recommended information
since the user can now rebuild and use both core and std with CFI
enabled using the Cargo build-std feature.
2023-10-04 10:05:57 -07:00
Ramon de C Valle
7b45674015 Disable CFI for core and std CFI violations
Works around #115199 by temporarily disabling CFI for core and std CFI
violations to allow the user rebuild and use both core and std with CFI
enabled using the Cargo build-std feature.
2023-10-04 10:05:54 -07:00
bors
f306362fb9 Auto merge of #116413 - nnethercote:rm-E0551, r=compiler-errors
Remove E0551

Because it's the same as E0539.

Fixes #51489.

r? `@Nilstrieb`
2023-10-04 16:51:42 +00:00
bors
2ffeb4636b Auto merge of #116381 - Mark-Simulacrum:drop-wasm32-unknown-emscripten, r=Kobzol
Remove wasm32-unknown-emscripten tests from CI

This builder tested the wasm32-unknown-emscripten target, which is tier 2 (and so not eligible for testing). In the recent beta [promotion](https://github.com/rust-lang/rust/pull/116362#issuecomment-1744960904), we ran into a problem with this target: emscripten doesn't support passing environment variables into the std environment, so we can't enable RUSTC_BOOTSTRAP for libtest in order to pass -Zunstable-options.

We worked around this for the beta/stable branches, but given this problem, and its tier 2 status, just dropping the target's tests entirely seems warranted. Downgrading to tier 3 may also be a good idea, but that is a separate conversation not proposed here.
2023-10-04 14:17:57 +00:00
bors
65519f5fc0 Auto merge of #116360 - compiler-errors:async-span, r=oli-obk
Point to full `async fn` for future

Semi-follow-up to https://github.com/rust-lang/rust/pull/116296#discussion_r1342007575

cc `@asquared31415`
2023-10-04 09:55:02 +00:00
bors
9fbd593a56 Auto merge of #116353 - Kobzol:new-bors-event, r=Mark-Simulacrum
Add new bors try branches to CI

Workflows for the new bors weren't launching, because its branches weren't whitelisted here.

r? `@Mark-Simulacrum`
2023-10-04 07:46:03 +00:00
Nicholas Nethercote
0ece171c2f Remove E0551.
Because it's the same as E0539.

Fixes #51489.
2023-10-04 18:12:20 +11:00
Nicholas Nethercote
81136cb391 Sort compiler/rustc_attr/Cargo.toml dependencies.
It's easier to read in sorted order.
2023-10-04 17:23:04 +11:00
bors
dd513e1150 Auto merge of #116406 - weihanglo:update-cargo, r=weihanglo
Update cargo

9 commits in 59596f0f31a94fde48b5aa7e945cd0b7ceca9620..794d0a82547f3081044c0aca7b6083733ce51344
2023-09-29 19:29:17 +0000 to 2023-10-03 23:19:33 +0000
- Prep for automating MSRV management (rust-lang/cargo#12767)
- chore(deps): update rust crate itertools to 0.11.0 (rust-lang/cargo#12759)
- fix bug: corruption when cargo killed while writing (rust-lang/cargo#12744)
- Disable custom_target::custom_bin_target on windows-gnu (rust-lang/cargo#12763)
- chore(deps): update compatible (rust-lang/cargo#12757)
- Add more missing `strip` info to docs. (rust-lang/cargo#12754)
- chore(deps): update actions/checkout action to v4 (rust-lang/cargo#12762)
- chore(deps): update rust crate cargo_metadata to 0.18.0 (rust-lang/cargo#12758)
- fix(test): Add back in newlines to diffs (rust-lang/cargo#12753)

r? ghost
2023-10-04 05:29:56 +00:00