Commit Graph

251240 Commits

Author SHA1 Message Date
Michael Goulet f487d83390 Stop doing so much to handle subdiagnostics 2024-03-29 22:23:10 -04:00
Michael Goulet bc1f1ef2c8 Stop removing substs from Adt type in coherence 2024-03-29 21:21:52 -04:00
Michael Goulet 5e2c549772 Assert that ADTs have the right number of substs 2024-03-29 20:40:47 -04:00
bors 877d36b192 Auto merge of #122976 - caibear:optimize_reserve_for_push, r=cuviper
Remove len argument from RawVec::reserve_for_push

Removes `RawVec::reserve_for_push`'s `len` argument since it's always the same as capacity.
Also makes `Vec::insert` use `RawVec::reserve_for_push`.
2024-03-30 00:29:24 +00:00
Nathan Henrie 41e97a0a3f Add rust-lldb pretty printing for Path and PathBuf
Fixes https://github.com/rust-lang/rust/issues/120553
Fixes https://github.com/rust-lang/rust/issues/48462
2024-03-29 18:02:26 -06:00
Aria Beingessner ea92faec49 stabilize ptr.is_aligned, move ptr.is_aligned_to to a new feature gate
This is an alternative to #121920
2024-03-29 19:59:46 -04:00
Cai Bear 4500c83c62 Fix test. 2024-03-29 15:37:43 -07:00
bors a3cfa031fa Auto merge of #123208 - weihanglo:update-cargo, r=weihanglo
Update cargo

8 commits in 499a61ce7a0fc6a72040084862a68b2603e770e8..a59aba136aab5510c16b0750a36cbd9916f91796
2024-03-26 04:17:04 +0000 to 2024-03-28 21:21:41 +0000
- refactor(package): Simplify getting of published Manifest (rust-lang/cargo#13666)
- fix(toml): Warn on unused workspace.dependencies keys on virtual workspaces (rust-lang/cargo#13664)
- docs: clarify `--locked` ensures Cargo uses dependency versions in lockfile (rust-lang/cargo#13665)
- RUSTC_WORKSPACE_WRAPPER: clarify docs (rust-lang/cargo#13648)
- fix(add): Preserve comments when updating simple deps (rust-lang/cargo#13655)
- fix(generate-lockfile): hold lock before querying index (rust-lang/cargo#13657)
- test: Add asserts to catch BorrowMutError's (rust-lang/cargo#13651)
- Publish test crates (rust-lang/cargo#13418)

r? ghost
2024-03-29 22:26:56 +00:00
Weihang Lo fe8dc2a3ea
Update cargo 2024-03-29 17:56:19 -04:00
Urgau 16d11c539f Add support for NonNull in ambiguous_wide_ptr_comparisions 2024-03-29 22:02:07 +01:00
bors faae5f1ffe Auto merge of #122520 - scottmcm:stabilize_unchecked_math_basics, r=jhpratt
Stabilize `unchecked_{add,sub,mul}`

Tracking issue: #85122

I think we might as well just stabilize these basic three.  They're the ones that have `nuw`/`nsw` flags in LLVM.

Notably, this doesn't include the potentially-more-complex or -more-situational things like `unchecked_neg` or `unchecked_shr` that are under different feature flags.

To quote Ralf https://github.com/rust-lang/rust/issues/85122#issuecomment-1681669646,

> Are there any objections to stabilizing at least `unchecked_{add,sub,mul}`? For those there shouldn't be any surprises about what their safety requirements are.

*Semantially* these are [already available on stable, even in `const`, via](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=bdb1ff889b61950897f1e9f56d0c9a36) `checked_*`+`unreachable_unchecked`.  So IMHO we might as well just let people write them directly, rather than try to go through a `let Some(x) = x.checked_add(y) else { unsafe { hint::unreachable_unchecked() }};` dance.

I added additional text to each method to attempt to better describe the behaviour and encourage `wrapping_*` instead.

r? rust-lang/libs-api
2024-03-29 20:25:08 +00:00
Esteban Küber d54e9833e3 Do not attempt to write `ty::Err` on binding that isn't from current HIR Owner
Fix #123009.
2024-03-29 19:05:54 +00:00
bors af4a5a13a1 Auto merge of #121268 - Urgau:improve_ambi_wide_ptr_cmps, r=Nadrieril
Add detection of [Partial]Ord methods in the `ambiguous_wide_pointer_comparisons` lint

Partially addresses https://github.com/rust-lang/rust/issues/121264 by adding diagnostics items for PartialOrd and Ord methods, detecting such diagnostics items as "binary operation" and suggesting the correct replacement.

I also took the opportunity to change the suggestion to use new methods `.cast()` on `*mut T` an d `*const T`.
2024-03-29 18:23:57 +00:00
Matthew Maurer d301f40c84 CFI: Encode Virtual calls as calls through the defining trait
For example, if `trait Foo: Bar`, and we try to call a method from `Bar`
on `dyn Foo`, encode the callsite as passing a `dyn Bar`, not a `dyn
Foo`.
2024-03-29 18:15:41 +00:00
Wilfred Hughes 7804edebfe
Improve wording in std::any explanation
Prefer 'log' over 'log out' to avoid confusion, and use backticks consistently.
2024-03-29 10:10:52 -07:00
bors f5a9250147 Auto merge of #16975 - HKalbasi:test-explorer, r=HKalbasi
Prompt the user to reload the window when enabling test explorer
2024-03-29 17:01:51 +00:00
Matthew Maurer 29c1a2b9e9 KCFI: Require -C panic=abort
While the KCFI scheme is not incompatible with unwinding, LLVM's
`invoke` instruction does not currently support KCFI bundles. While it
likely will in the near future, we won't be able to assume that in Rust
for a while.
2024-03-29 16:35:58 +00:00
bors 399fa2f6e4 Auto merge of #123194 - matthiaskrgr:rollup-vhdc8hw, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #123176 (Normalize the result of `Fields::ty_with_args`)
 - #123186 (copy any file from stage0/lib to stage0-sysroot/lib)
 - #123187 (Forward port 1.77.1 release notes)
 - #123188 (compiler: fix few unused_peekable and needless_pass_by_ref_mut clippy lints)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-29 16:02:04 +00:00
Urgau d4b514f982 Add detection of [Partial]Ord methods to the ambiguous wide ptr cmp lint 2024-03-29 16:36:17 +01:00
Urgau 4a9f3cac88 Add diagnostic items for Ord and PartialOrd methods 2024-03-29 16:25:41 +01:00
hkalbasi 34cde2cebc Prompt the user to reload the window when enabling test explorer 2024-03-29 18:08:16 +03:30
Matthias Krüger 8d820c0c47
Rollup merge of #123188 - klensy:clippy-me2, r=Nilstrieb
compiler: fix few unused_peekable and needless_pass_by_ref_mut clippy lints

This fixes few instances of `unused_peekable` and `needless_pass_by_ref_mut`. While i expected to fix more warnings, `needless_pass_by_ref_mut` produced too much for one PR, so i stopped here.

Better reviewed commit by commit, as fixes splitted by chunks.
2024-03-29 15:17:11 +01:00
Matthias Krüger a18da0088e
Rollup merge of #123187 - yedayak:relnotes-1.77.1, r=Mark-Simulacrum
Forward port 1.77.1 release notes
2024-03-29 15:17:11 +01:00
Matthias Krüger b48411bcd4
Rollup merge of #123186 - onur-ozkan:llvm-library-bug, r=Kobzol
copy any file from stage0/lib to stage0-sysroot/lib

With the LLVM 18 upgrade, the name of the LLVM library has been changed to something like `libLLVM.so.18.1-rust-1.78.0-beta`, which `is_dylib` function cannot determine as it only looks whether files are ending with ".so" or not.
This change resolves this problem by no longer doing that ".so" check, as we need all files from the stage0/lib as they are all dependency of rustc anyway.

Fixes #122913
2024-03-29 15:17:10 +01:00
Matthias Krüger 73a4208638
Rollup merge of #123176 - celinval:smir-field-ty, r=oli-obk
Normalize the result of `Fields::ty_with_args`

We were only instantiating before, which would leak an AliasTy. I added a test case that reproduce the issue seen here:

https://github.com/model-checking/kani/issues/3113

r? ``@oli-obk``
2024-03-29 15:17:10 +01:00
bors 685927aae6 Auto merge of #122450 - Urgau:simplify-trim-paths-feature, r=michaelwoerister
Simplify trim-paths feature by merging all debuginfo options together

This PR simplifies the trim-paths feature by merging all debuginfo options together, as described in https://github.com/rust-lang/rust/issues/111540#issuecomment-1994010274.

And also do some correctness fixes found during the review.

cc `@weihanglo`
r? `@michaelwoerister`
2024-03-29 14:00:21 +00:00
bors 9d84142ef2 Auto merge of #16974 - dfireBird:generic_params_refactor, r=lnicola
refactor: Implement len and is_empty method in generic_params
2024-03-29 13:15:08 +00:00
dfireBird 69c4ac6304
implement len and is_empty method in generic_params 2024-03-29 18:26:46 +05:30
bors 45796d1c24 Auto merge of #123080 - Jules-Bertholet:mut-ref-mut, r=Nadrieril
Match ergonomics 2024: implement mutable by-reference bindings

Implements the mutable by-reference bindings portion of match ergonomics 2024 (#123076), with the `mut ref`/`mut ref mut` syntax, under feature gate `mut_ref`.

r? `@Nadrieril`

`@rustbot` label A-patterns A-edition-2024
2024-03-29 11:08:11 +00:00
bors 58dcd1fdb9 Auto merge of #123071 - rcvalle:rust-cfi-fix-method-fn-ptr-cast, r=compiler-errors
CFI: Fix methods as function pointer cast

Fix casting between methods and function pointers by assigning a secondary type id to methods with their concrete self so they can be used as function pointers.

This was split off from #116404.

cc `@compiler-errors` `@workingjubilee`
2024-03-29 09:04:05 +00:00
Jakub Beránek a4087b7915
Log BOLT args in bootstrap `rustc` shim 2024-03-29 09:36:56 +01:00
Yedaya Katsman 5eb78c515c Forward port 1.77.1 release notes 2024-03-29 10:44:19 +03:00
onur-ozkan 5fe364afdd copy any file from stage0/lib to stage0-sysroot/lib
With the LLVM 18 upgrade, the name of the LLVM library has been changed to something like
`libLLVM.so.18.1-rust-1.78.0-beta`, which `is_dylib` function cannot determine as it only
looks whether files are ending with ".so" or not.
This change resolves this problem by no longer doing that ".so" check, as we need all files
from the stage0/lib as they are all dependency of rustc anyway.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-03-29 10:07:44 +03:00
bors 1c19595575 Auto merge of #122616 - Jules-Bertholet:casemappingiter-layout, r=Nilstrieb
Optimize `core::char::CaseMappingIter`

Godbolt says this saves a few instructions…

`@rustbot` label T-libs A-layout C-optimization
2024-03-29 07:02:56 +00:00
bors eae940fcef Auto merge of #3427 - rust-lang:rustup-2024-03-29, r=saethlin
Automatic Rustup
2024-03-29 06:16:56 +00:00
The Miri Cronjob Bot ed29546a27 Merge from rustc 2024-03-29 05:02:09 +00:00
The Miri Cronjob Bot 29a59beaa6 Preparing for merge from rustc 2024-03-29 04:54:51 +00:00
Stepan Koltsov b110cb3dc6 Require Debug for Pointee::Metadata
Useful for debugging
2024-03-29 03:53:29 +00:00
bors 760e567af5 Auto merge of #122975 - DianQK:simplify_ub_check, r=saethlin
Eliminate `UbChecks` for non-standard libraries

 The purpose of this PR is to allow other passes to treat `UbChecks` as constants in MIR for optimization after #122629.

r? RalfJung
2024-03-29 02:25:43 +00:00
bors a8b7acf22f Auto merge of #16971 - HKalbasi:test-explorer, r=HKalbasi
Resolve tests per file instead of per crate in test explorer

Fix part of #16827
2024-03-29 02:06:22 +00:00
hkalbasi beec6914c8 Resolve tests per file instead of per crate in test explorer 2024-03-29 05:34:43 +03:30
bors db2f9759f4 Auto merge of #122671 - Mark-Simulacrum:const-panic-msg, r=Nilstrieb
Codegen const panic messages as function calls

This skips emitting extra arguments at every callsite (of which there
can be many). For a librustc_driver build with overflow checks enabled,
this cuts 0.7MB from the resulting shared library (see [perf]).

A sample improvement from nightly:

```
        leaq    str.0(%rip), %rdi
        leaq    .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdx
        movl    $25, %esi
        callq   *_ZN4core9panicking5panic17h17cabb89c5bcc999E@GOTPCREL(%rip)
```

to this PR:

```
        leaq    .Lalloc_d6aeb8e2aa19de39a7f0e861c998af13(%rip), %rdi
        callq   *_RNvNtNtCsduqIKoij8JB_4core9panicking11panic_const23panic_const_div_by_zero@GOTPCREL(%rip)
```

[perf]: https://perf.rust-lang.org/compare.html?start=a7e4de13c1785819f4d61da41f6704ed69d5f203&end=64fbb4f0b2d621ff46d559d1e9f5ad89a8d7789b&stat=instructions:u
2024-03-29 00:24:01 +00:00
Cai Bear aba592d09c Rename reserve_for_push to grow_one and fix comment. 2024-03-28 16:38:01 -07:00
Cai Bear 78dc89b0d5 Fix previous. 2024-03-28 16:21:54 -07:00
Cai Bear 18d390883e Remove len argument from RawVec::reserve_for_push because it's always equal to capacity. Also make Vec::insert use reserve_for_push. 2024-03-28 16:21:54 -07:00
bors d74804636f Auto merge of #123178 - Nilstrieb:🥷-build, r=Mark-Simulacrum
Update ninja on Windows

Errors started showing up, and I read somewhere that this might be because of old ninja versions. This ninja version is indeed *ancient*.

```
multiple outputs aren't (yet?) supported by depslog; bring this up on the mailing list if it affects you
```

This requires someone uploading https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip as `2024-03-28-v1.11.1-ninja-win.zip`.

should end https://github.com/rust-lang/rust/pull/122671#issuecomment-2026178791
2024-03-28 22:16:03 +00:00
Nilstrieb b546764cbe Update ninja on Windows
Errors started showing up, and I read somewhere that this might be
because of old ninja versions. This ninja version is indeed *ancient*.

```
multiple outputs aren't (yet?) supported by depslog; bring this up on the mailing list if it affects you
```
2024-03-28 22:54:20 +01:00
Ralf Jung fd7909aa59 x.py test miri: respect --no-doc / --doc 2024-03-28 22:46:25 +01:00
Celina G. Val a325bce3cd Normalize the result of Fields::ty_with_args
We were only instantiating before, which would leak an AliasTy.
I added a test case that reproduce the issue seen here:

https://github.com/model-checking/kani/issues/3113
2024-03-28 13:22:10 -07:00
Trevor Gross d7d5fc9734 Add basic trait impls for `f16` and `f128`
Split off part of <https://github.com/rust-lang/rust/pull/122470> so the
compiler doesn't ICE because it expects primitives to have some minimal
traits.

Fixes <https://github.com/rust-lang/rust/issues/123074>
2024-03-28 15:02:51 -04:00