Commit Graph

247750 Commits

Author SHA1 Message Date
Guillaume Boisseau
4c65eef269
Rollup merge of - tgross35:f16-f128-step2-intrinsics, r=compiler-errors
`f16` and `f128` step 2: intrinsics

Continuation of https://github.com/rust-lang/rust/pull/121728, another portion of https://github.com/rust-lang/rust/pull/114607.

This PR adds `f16` and `f128` intrinsics, and hooks them up to both HIR and LLVM. This is all still unexposed to the frontend, which will probably be the next step. Also update itanium mangling per `@rcvalle's` in https://github.com/rust-lang/rust/pull/121728/files#r1506570300, and fix a typo from step 1.

Once these types are usable in code, I will add the codegen tests from  (codegen is passing on that branch)

This does add more `unimplemented!`s to Clippy, but I still don't think we can do better until library support is added.

r? `@compiler-errors`
cc `@Nilstrieb`
`@rustbot` label +T-compiler +F-f16_and_f128
2024-03-02 20:13:24 +01:00
Guillaume Boisseau
200019c199
Rollup merge of - oli-obk:eager_opaque_checks, r=compiler-errors
Now that inlining, mir validation and const eval all use reveal-all, we won't be constraining hidden types here anymore

r? `@compiler-errors`

one bubble down, two more to go

the test is unrelated, just something I noticed would be good to test in both the old solver and the new.
2024-03-02 20:13:23 +01:00
Guillaume Boisseau
30976fbe2b
Rollup merge of - Nadrieril:simple-binding-order, r=matthewjasper
match lowering: Lower bindings in a predictable order

After the recent refactorings, we can now lower bindings in a truly predictable order. The order in https://github.com/rust-lang/rust/pull/120214 was an improvement but not very clear. With this PR, we lower bindings from left to right, with the special case that `x @ pat` is traversed as `pat @ x` (i.e. `x` is lowered after any bindings in `pat`).

This description only applies in the absence of or-patterns. Or-patterns make everything complicated, because the binding place depends on the subpattern. Until I have a better idea I leave them to be handled in whatever weird order arises from today's code.

r? `@matthewjasper`
2024-03-02 20:13:23 +01:00
Guillaume Boisseau
b0ca9b5d44
Rollup merge of - dtolnay:wake, r=cuviper
Preserve same vtable pointer when cloning raw waker, to fix Waker::will_wake

Fixes .

As `@jkarneges` identified in https://github.com/rust-lang/rust/issues/121600#issuecomment-1963041051, the issue is two different const promotions produce two statics at different addresses, which may or may not later be deduplicated by the linker (in this case not).

Prior to , the content of the statics was compared, and they were equal. After, the address of the statics are compared and they are not equal.

It is documented that `will_wake` _"works on a best-effort basis, and may return false even when the Wakers would awaken the same task"_ so this PR fixes a quality-of-implementation issue, not a correctness issue.
2024-03-02 20:13:22 +01:00
Guillaume Boisseau
8653c09087
Rollup merge of - rcvalle:rust-dfsan, r=nikic
Add initial support for DataFlowSanitizer

Adds initial support for DataFlowSanitizer to the Rust compiler. It currently supports `-Zsanitizer-dataflow-abilist`. Additional options for it can be passed to LLVM command line argument processor via LLVM arguments using `llvm-args` codegen option (e.g., `-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-02 20:13:22 +01:00
bors
5257aee7dd Auto merge of - matthiaskrgr:rollup-mv26uwt, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 -  (fix typo in documentation for std::fs::Permissions)
 -  (Update E0716.md for clarity)
 -  (match lowering: pre-simplify or-patterns too)
 -  (Display short types for unimplemented trait)
 -  (Move `gather_comments`.)
 -  (Move `HandleStore` into `server.rs`.)
 -  (Remove hidden use of Global)
 -  (Use the guaranteed precision of a couple of float functions in docs)
 -  ( Account for unmet T: !Copy in E0277 message)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-02 11:21:44 +00:00
Matthias Krüger
07bd4590fb
Rollup merge of - estebank:e0277-drive-by, r=compiler-errors
Account for unmet T: !Copy in E0277 message

```
error[E0277]: the trait bound `T: !Copy` is not satisfied
  --> $DIR/simple.rs:10:16
   |
LL |     not_copy::<T>();
   |                ^ the trait bound `T: !Copy` is not satisfied
```
instead of the current

```
error[E0277]: the trait bound `T: !Copy` is not satisfied
  --> $DIR/simple.rs:10:16
   |
LL |     not_copy::<T>();
   |                ^ the trait `!Copy` is not implemented for `T`
```
2024-03-02 10:09:38 +01:00
Matthias Krüger
c95f485744
Rollup merge of - tbu-:pr_floating_point_exact_examples, r=workingjubilee
Use the guaranteed precision of a couple of float functions in docs
2024-03-02 10:09:37 +01:00
Matthias Krüger
78249a6790
Rollup merge of - shamatar:btreemap_fix_implicits, r=cuviper
Remove hidden use of Global

Fixes 
2024-03-02 10:09:37 +01:00
Matthias Krüger
4f3d7e2d11
Rollup merge of - nnethercote:mv-HandleStore, r=bjorn3
Move `HandleStore` into `server.rs`.

This just moves the server-relevant parts of handles into `server.rs`. It introduces a new higher-order macro `with_api_handle_types` to avoid some duplication.

This fixes two `FIXME` comments, and makes things clearer, by not having server code in `client.rs`.

r? ```@bjorn3```
2024-03-02 10:09:36 +01:00
Matthias Krüger
9b2644030a
Rollup merge of - nnethercote:mv-gather_comments, r=est31
Move `gather_comments`.

To the module where it is used, so it doesn't have to be `pub`.

r? ```@est31```
2024-03-02 10:09:36 +01:00
Matthias Krüger
3432d1b087
Rollup merge of - jieyouxu:loooong-typename, r=estebank
Display short types for unimplemented trait

Shortens unimplemented trait diagnostics. Now shows:

```
error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display`
  --> $DIR/on_unimplemented_long_types.rs:4:17
   |
LL |   pub fn foo() -> impl std::fmt::Display {
   |                   ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter
LL |
LL | /     Some(Some(Some(Some(Some(Some(Some(Some(Some(S...
LL | |         Some(Some(Some(Some(Some(Some(Some(Some(So...
LL | |             Some(Some(Some(Some(Some(Some(Some(Som...
LL | |                 Some(Some(Some(Some(Some(Some(Some...
...  |
LL | |         ))))))))))),
LL | |     )))))))))))
   | |_______________- return type was inferred to be `Option<Option<Option<...>>>` here
   |
   = help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>`
   = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
```

I'm not 100% sure if this is desirable, or if we should just let the long types remain long. This is also kinda a short-term bandaid solution. The real long term solution is to properly migrate `rustc_trait_selection`'s error reporting to use translatable diagnostics and then properly handle type name printing.

Fixes .
2024-03-02 10:09:36 +01:00
Matthias Krüger
b2c933a1b9
Rollup merge of - Nadrieril:testcase-or, r=matthewjasper
match lowering: pre-simplify or-patterns too

This is the final part of my work to simplify match pairs early: now we do it for or-patterns too. This makes it possible to collect fake borrows separately from the main match lowering algorithm. That'll enable more simplifications of or-pattern handling.

Note: I was tempted to have `Candidate` contain a `FlatPat`, but there are so many places that use `candidate.match_pairs` etc directly that I chose not to.

r? `@matthewjasper`
2024-03-02 10:09:35 +01:00
Matthias Krüger
1c724ee110
Rollup merge of - carschandler:patch-1, r=nnethercote
Update E0716.md for clarity

When reading through this, I got slightly hung up thinking the `let` it was referring to was the `let tmp` on line 25, which was confusing considering the comment states that the temporary is freed at the end of the block. I think adding this clarification could potentially help some beginners like myself without being overly verbose.
2024-03-02 10:09:35 +01:00
Matthias Krüger
d0e5431eb0
Rollup merge of - squell:master, r=cuviper
fix typo in documentation for std::fs::Permissions

Please check and re-check this PR carefully to see if I got this right.

But by my logic, if the `read_only` function returns `true`, I would not expect be able to write to the file (it being read only); so this text is meant to clarify that `read_only` being `false` doesn't mean *you* can actually write to the file, just that "in general" someone is able to.
2024-03-02 10:09:34 +01:00
bors
2e3581bca9 Auto merge of - compiler-errors:type-relating-variances, r=aliemjay
Don't grab variances in `TypeRelating` relation if we're invariant

Since `Invariant.xform(var) = Invariant` always, so just copy what the generalizer relation does.

Fixes 
2024-03-02 08:52:26 +00:00
bors
4cdd20584c Auto merge of - estebank:issue-119665, r=davidtwco
Detect more cases of `=` to `:` typo

When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span arround and mention it. If the type could continue being parsed as an expression, suggest replacing the `:` with a `=`.

```
error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.`
 --> file.rs:2:32
  |
2 |     let _: std::env::temp_dir().join("foo");
  |          -                     ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=`
  |          |
  |          while parsing the type for `_`
  |          help: use `=` if you meant to assign
```

Fix .
2024-03-02 05:03:46 +00:00
Ramon de C Valle
dee4e02102 Add initial support for DataFlowSanitizer
Adds initial support for DataFlowSanitizer to the Rust compiler. It
currently supports `-Zsanitizer-dataflow-abilist`. Additional options
for it can be passed to LLVM command line argument processor via LLVM
arguments using `llvm-args` codegen option (e.g.,
`-Cllvm-args=-dfsan-combine-pointer-labels-on-load=false`).
2024-03-01 18:50:40 -08:00
bors
1dc5f73c13 Auto merge of - weihanglo:update-cargo, r=weihanglo
Update cargo

12 commits in 8964c8ccff6e420e2a38b8696d178d69fab84d9d..f772ec0224d3755ce52ac5128a80319fb2eb45d0
2024-02-27 19:22:46 +0000 to 2024-03-01 22:57:35 +0000
- feat(toml): Warn on unset Edition ()
- fix(msrv): Report all incompatible packages, not just a random one ()
- refactor: abstract `std::fs` away from on-disk index cache ()
- chore(deps): update compatible ()
- chore(deps): update rust crate rusqlite to 0.31.0 ()
- [docs]: Clarify vendored sources as read-only and way to modify ()
- chore(deps): update rust crate supports-hyperlinks to v3 ()
- refactor: Clarify more Config -&gt; Context ()
- test: Make `edition` explicit in packages ()
- Add all unit's children recursively for `doc.extern-map` option ()
- fix(rustc): Always pass --edition to rustc ()
- Silently ignore `cargo::rustc-check-cfg` to avoid MSRV annoyance when stabilizing `-Zcheck-cfg` ()

r? ghost
2024-03-02 02:34:03 +00:00
Esteban Küber
7f97dfe700 Account for unmet T: !Copy in E0277 message 2024-03-02 01:53:37 +00:00
Weihang Lo
bae2b51c5f
Update cargo 2024-03-01 19:41:46 -05:00
bors
eaee1e9453 Auto merge of - matthiaskrgr:rollup-mfpa3jx, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 -  (Made `INVALID_DOC_ATTRIBUTES` lint deny by default)
 -  (Delete line if suggestion would replace it with an empty line)
 -  (Suggest removing superfluous semicolon when statements used as expression)
 -  (`-Znext-solver=coherence`: suggest increasing recursion limit)
 -  (Clarify behavior of slice prefix/suffix operations in case of equality)
 -  (match lowering: Remove hacky branch in sort_candidate)
 -  (Add profiling support to AIX)
 -  (match lowering: Separate the `bool` case from other integers in `TestKind`)
 -  (Never say "`Trait` is implemented for `{type error}`")
 -  (Move sanitizer ui tests to sanitizer directory)
 -  (Implement missing ABI structures in StableMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-02 00:06:46 +00:00
carschandler
50ff36239a
Update E0716.md
Clearer wording
2024-03-01 17:31:02 -06:00
Matthias Krüger
63e916e26c
Rollup merge of - celinval:smir-scalar, r=oli-obk
Implement missing ABI structures in StableMIR

Add implementations for Scalar, Primitive and WrappingRange for StableMIR.

FYI, I thought about reusing the `rustc_abi` module, since it is designed to not necessarily depend on the `rustc` internals, but the maintenance burden to maintain this crate in crates.io doesn't seem worth it at this point.

Fixes https://github.com/rust-lang/project-stable-mir/issues/58
2024-03-01 22:38:50 +01:00
Matthias Krüger
d2d1823178
Rollup merge of - rcvalle:rust-cfi-move-ui-tests-to-sanitizer-directory, r=compiler-errors
Move sanitizer ui tests to sanitizer directory

Moves the sanitizer ui tests to the sanitizer directory and removes the sanitizer prefix from tests file names similarly to how the sanitizer codegen tests are organized.
2024-03-01 22:38:50 +01:00
Matthias Krüger
06ca0de91c
Rollup merge of - estebank:dont-mention-type-error-e0277, r=compiler-errors
Never say "`Trait` is implemented for `{type error}`"

When a trait bound error occurs, we look for alternative types that would have made the bound succeed. For some reason `{type error}` sometimes would appear as a type that would do so.

We now remove `{type error}` from the list in every case to avoid nonsensical `note`s.
2024-03-01 22:38:49 +01:00
Matthias Krüger
0d2205f9a6
Rollup merge of - Nadrieril:switchkind-if, r=matthewjasper
match lowering: Separate the `bool` case from other integers in `TestKind`

`TestKind::SwitchInt` had a special case for `bool` essentially everywhere it's used, so I made `TestKind::If` to handle the bool case on its own.

r? `@matthewjasper`
2024-03-01 22:38:49 +01:00
Matthias Krüger
4f32f78fc6
Rollup merge of - ecnelises:aix_pgo, r=wesleywiser
Add profiling support to AIX

AIX ld needs special option to merge objects with profiling. Also, profiler_builtins should include builtins for AIX from compiler-rt.
2024-03-01 22:38:48 +01:00
Matthias Krüger
1fbc53af48
Rollup merge of - Nadrieril:simplify-sort-candidate, r=matthewjasper
match lowering: Remove hacky branch in sort_candidate

Reusing `self.test()` there wasn't actually pulling a lot of weight. In particular the `TestKind::Len` cases were all already correctly handled.

r? `@matthewjasper`
2024-03-01 22:38:48 +01:00
Matthias Krüger
441217d9b5
Rollup merge of - RavuAlHemio:slice-prefix-suffix-docs, r=cuviper
Clarify behavior of slice prefix/suffix operations in case of equality

Operations such as starts_with, ends_with, strip_prefix and strip_suffix can be either strict (do not consider a slice to be a prefix/suffix of itself) or not. In Rust's case, they are not strict. Add a few phrases to the documentation to clarify this.
2024-03-01 22:38:47 +01:00
Matthias Krüger
4d71fe7cc1
Rollup merge of - lcnr:coherence-suggest-increasing-recursion-limit, r=compiler-errors
`-Znext-solver=coherence`: suggest increasing recursion limit

r? `@compiler-errors`
2024-03-01 22:38:47 +01:00
Matthias Krüger
b8cdcfa144
Rollup merge of - chenyukang:yukang-fix-105431-type-mismatch, r=estebank
Suggest removing superfluous semicolon when statements used as expression

Fixes 

- it's not a pure recursive visitor, so I guess there may be some more complex scenarios not covered.
- moved `consider_removing_semicolon` to `compiler/rustc_infer` for reusing this helper function.
2024-03-01 22:38:46 +01:00
Matthias Krüger
3c89280684
Rollup merge of - clubby789:unused-import-line, r=estebank
Delete line if suggestion would replace it with an empty line

Fixes 
2024-03-01 22:38:45 +01:00
Matthias Krüger
8185c843f3
Rollup merge of - GuillaumeGomez:turn-invalid-doc-attr-into-err, r=rustdoc
Made `INVALID_DOC_ATTRIBUTES` lint deny by default

Fixes https://github.com/rust-lang/rust/issues/82730.

# Explanations

The `INVALID_DOC_ATTRIBUTES` lint was marked as "will become a hard error into the future" for quite some time so making it `deny` by default.

<del>Waiting on https://github.com/rust-lang/backtrace-rs/pull/524 for now.</del>
2024-03-01 22:38:45 +01:00
bors
e612d079a1 Auto merge of - nikic:update-llvm-21, r=cuviper
Update to LLVM 18.1.0 rc 4

Fixes https://github.com/rust-lang/rust/issues/120819.
Fixes https://github.com/rust-lang/rust/issues/121180.
Fixes https://github.com/rust-lang/rust/issues/121239.
Fixes https://github.com/rust-lang/rust/issues/121367.
2024-03-01 21:35:07 +00:00
Celina G. Val
0567162933 Add support to new float types 2024-03-01 11:16:35 -08:00
bors
2dceda4f32 Auto merge of - matthiaskrgr:rollup-i724wpm, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 -  (Fix incorrect suggestion for uninitialized binding in pattern)
 -  (Improve error messages for generics with default parameters)
 -  (Add tidy check for .stderr/.stdout files for non-existent test revisions)
 -  (make unused_imports less assertive in test modules)
 -  (Remove `Mutex::unlock` Function)
 -  (Make the success arms of `if lhs || rhs` meet up in a separate block)
 -  (CFI: Remove unused `typeid_for_fnsig`)
 -  (Handle stashing of delayed bugs)
 -  (Remove unused fluent messages)
 -  (Fix typo in comment)
 -  (Make `ZeroablePrimitive` trait unsafe.)
 -  (normalizes-to: handle negative impls)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-01 19:06:39 +00:00
许杰友 Jieyou Xu (Joe)
62baa670e3
Avoid silently writing to a file when the involved ty is long 2024-03-01 19:02:34 +00:00
Celina G. Val
e3ac2c68b8 Implement missing ABI structures in StableMIR 2024-03-01 11:02:05 -08:00
Trevor Gross
01755e3ff3 Add f16 and f128 intrinsics to HIR 2024-03-01 13:59:06 -05:00
Trevor Gross
12948a31c9 Propegate HIR and AST f16 and f128 types to clippy 2024-03-01 13:59:06 -05:00
Trevor Gross
6781801d33 Propegate HIR and AST f16 and f128 types to rustdoc 2024-03-01 13:59:06 -05:00
Trevor Gross
baba49d8f0 Add f16 and f128 to the AST 2024-03-01 13:59:06 -05:00
Trevor Gross
02778b3e0e Add f16 and f128 LLVM intrinsics 2024-03-01 13:59:06 -05:00
Michael Goulet
003b920591 Don't grab variances if we're invariant 2024-03-01 18:11:45 +00:00
Tobias Bucher
bcccab88ca Use the guaranteed precision of a couple of float functions in docs 2024-03-01 18:57:42 +01:00
Matthias Krüger
ff22925e50
Rollup merge of - lcnr:normalizes_to-polarity, r=compiler-errors
normalizes-to: handle negative impls

necessary to build the stage 2 compiler in  😁

r? `@compiler-errors`
2024-03-01 17:51:33 +01:00
Matthias Krüger
68dd5e65a9
Rollup merge of - reitermarkus:generic-nonzero-unsafe-trait, r=Nilstrieb
Make `ZeroablePrimitive` trait unsafe.

Tracking issue: https://github.com/rust-lang/rust/issues/120257

r? `@dtolnay`
2024-03-01 17:51:33 +01:00
Matthias Krüger
96e3777a9f
Rollup merge of - gurry:fix-typo, r=oli-obk
Fix typo in comment

"pop" should have been "prop"
2024-03-01 17:51:32 +01:00
Matthias Krüger
01b58bddd4
Rollup merge of - mu001999:clean, r=Nilstrieb
Remove unused fluent messages

Unused fluent messages after 
2024-03-01 17:51:32 +01:00