Commit Graph

248210 Commits

Author SHA1 Message Date
Jonas Pleyer
e46306043b
include feedback from workingjubilee
- Refer to trait directly
- small typo in encapsulate

Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
2024-03-04 10:04:46 +01:00
roblabla
9eb927e025 Don't run test_get_os_named_thread on win7
This test won't work on windows 7, as the Thread::set_name function is
not implemented there (win7 does not provide a documented mechanism to
set thread names).
2024-03-04 09:24:41 +01:00
bors
7606c13961 Auto merge of #121964 - matthiaskrgr:rollup-rtcju5m, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #121130 (Suggest moving definition if non-found macro_rules! is defined later)
 - #121912 (Properly deal with GATs when looking for method chains to point at)
 - #121927 (Add a proper `with_no_queries` to printing)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-04 08:07:34 +00:00
Zalathar
4146136d6d Extract an arguments struct for Builder::then_else_break
Most of this method's arguments are usually or always forwarded as-is to
recursive invocations.

Wrapping them in a dedicated struct allows us to document each struct field,
and lets us use struct-update syntax to indicate which arguments are being
modified when making a recursive call.
2024-03-04 18:42:12 +11:00
Matthias Krüger
de95c39a78
Rollup merge of #121927 - Zoxc:print-no-query, r=estebank
Add a proper `with_no_queries` to printing
2024-03-04 07:57:57 +01:00
Matthias Krüger
cd9e5b5f43
Rollup merge of #121912 - fmease:diag-method-chains-gat, r=compiler-errors,estebank
Properly deal with GATs when looking for method chains to point at

Fixes #121898.

~~While it prevents an ICE and the structured suggestion is correct, the method chain diagnostic notes are weird / useless / incorrect judging by a quick look. I guess I should improve that in this PR.~~ Sufficiently taken care of.

r? estebank or compiler-errors (#105332, #105674).
2024-03-04 07:57:56 +01:00
Matthias Krüger
c620ae5be9
Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, r=matthiaskrgr
Suggest moving definition if non-found macro_rules! is defined later

Fixes #121061
2024-03-04 07:57:56 +01:00
Nicholas Nethercote
4260f7ec67 Rename a misnamed Session parameter. 2024-03-04 16:32:37 +11:00
bors
f7cb53e54b Auto merge of #121900 - chenyukang:yukang-fix-121425-repr-pack-error, r=compiler-errors
Fix misleading message in struct repr alignment and packed

Fixes #121425

By the way, fix the spans for the argument in the second commit.
2024-03-04 05:32:26 +00:00
Nicholas Nethercote
0d4ebe1c1b Move sess function and use it more. 2024-03-04 16:26:51 +11:00
Nicholas Nethercote
3996447b37 Remove file_path_mapping param from ParseSess::new.
It's always empty.
2024-03-04 16:22:06 +11:00
Nicholas Nethercote
aa38c26bbf Tweak parse_asm_args.
It doesn't need a `Parser` and a `ParseSess`, because the former
contains the latter.
2024-03-04 16:12:33 +11:00
surechen
6e9f59f967 add test for #78894 2024-03-04 12:34:11 +08:00
bors
8b1af4c661 Auto merge of #120585 - Amanieu:ohos-tier2, r=Kobzol
Promote OpenHarmony targets to tier 2

MCP: rust-lang/compiler-team#719
2024-03-04 03:03:35 +00:00
Sundeep KOKKONDA
a9a979839b
Removing absolute path in proc-macro
With rust 1.75 the absolute build path is embedding into '.rustc' section and which causes reproducibility issues. Detailed issue is here.
https://github.com/rust-lang/rust/issues/120825#issuecomment-1964307219

With this change the 'absolute path' changed back to '/rust/$hash' format.
2024-03-04 08:18:54 +05:30
bors
89b78304e8 Auto merge of #121955 - matthiaskrgr:rollup-1i3lo0j, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #121248 (Move some tests)
 - #121528 (Consider middle segments of paths in `unused_qualifications`)
 - #121749 (Don't lint on executable crates with `non_snake_case` names)
 - #121935 (library/ptr: mention that ptr::without_provenance is equivalent to deriving from the null ptr)
 - #121945 (Run some ui-fulldeps tests on stage 1 again)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-04 00:37:20 +00:00
bors
70aa0b86c0 Auto merge of #121665 - erikdesjardins:ptradd, r=nikic
Always generate GEP i8 / ptradd for struct offsets

This implements #98615, and goes a bit further to remove `struct_gep` entirely.

Upstream LLVM is in the beginning stages of [migrating to `ptradd`](https://discourse.llvm.org/t/rfc-replacing-getelementptr-with-ptradd/68699). LLVM 19 will [canonicalize](https://github.com/llvm/llvm-project/pull/68882) all constant-offset GEPs to i8, which has roughly the same effect as this change.

Fixes #121719.

Split out from #121577.

r? `@nikic`
2024-03-03 22:21:53 +00:00
Matthias Krüger
e5a6d21729
Rollup merge of #121945 - Nilstrieb:ignore-stage1, r=compiler-errors
Run some ui-fulldeps tests on stage 1 again

This is the second time I'm doing this... I'm starting to feel like stage1 ui-fulldeps tests were a mistake. Maybe I should have just put `#[cfg(bootstrap)]` there to let the bootstrap bumper fix it.

`@George-lewis` :)

finishes https://github.com/rust-lang/rust/pull/119088#issuecomment-1890389583
2024-03-03 22:56:14 +01:00
Matthias Krüger
dc8b71ae2b
Rollup merge of #121935 - RalfJung:ptr-without-prov, r=scottmcm
library/ptr: mention that ptr::without_provenance is equivalent to deriving from the null ptr

This might help clarify why you can't do memory accesses with it.
2024-03-03 22:56:14 +01:00
Matthias Krüger
10234fc246
Rollup merge of #121749 - jieyouxu:issue-45127-fix, r=petrochenkov
Don't lint on executable crates with `non_snake_case` names

Revives #111130, cc `@GilShoshan94.`
Closes #45127.
2024-03-03 22:56:13 +01:00
Matthias Krüger
ed6d17523a
Rollup merge of #121528 - Alexendoo:unused_qualifications, r=petrochenkov
Consider middle segments of paths in `unused_qualifications`

Currently `unused_qualifications` looks at the last segment of a path to see if it can be trimmed, this PR extends the check to the middle segments also

```rust
// currently linted
use std::env::args();
std::env::args(); // Removes `std::env::`
```
```rust
// newly linted
use std::env;
std::env::args(); // Removes `std::`
```

Paths with generics in them are now linted as long as the part being trimmed is before any generic args, e.g. it will now suggest trimming `std::vec::` from `std::vec::Vec<usize>`

Paths with any segments that are from an expansion are no longer linted

Fixes #100979
Fixes #96698
2024-03-03 22:56:13 +01:00
Matthias Krüger
d37ad03513
Rollup merge of #121248 - c410-f3r:testsssssss, r=petrochenkov
Move some tests

r? `@petrochenkov`
2024-03-03 22:56:12 +01:00
John Kåre Alsaker
6fb4ac64ec Add a proper with_no_queries to printing 2024-03-03 21:12:04 +01:00
bors
516b6162a2 Auto merge of #121763 - clubby789:llvm-old-comment, r=cjgillot
Update outdated LLVM comment

The first path no longer exists, but the second does.
2024-03-03 19:59:03 +00:00
Caio
2aab000105 Move tests 2024-03-03 16:30:48 -03:00
Alex Macleod
4ea9f72c72 Consider middle segments of paths in unused_qualifications 2024-03-03 19:14:28 +00:00
Esteban Küber
40f9dccad6 Use can_eq instead of Ty<'_> == Ty<'_> 2024-03-03 18:53:36 +00:00
Esteban Küber
89a3c19832 Be more lax in .into_iter() suggestion when encountering Iterator methods on non-Iterator
```
error[E0599]: no method named `map` found for struct `Vec<bool>` in the current scope
  --> $DIR/vec-on-unimplemented.rs:3:23
   |
LL |     vec![true, false].map(|v| !v).collect::<Vec<_>>();
   |                       ^^^ `Vec<bool>` is not an iterator
   |
help: call `.into_iter()` first
   |
LL |     vec![true, false].into_iter().map(|v| !v).collect::<Vec<_>>();
   |                       ++++++++++++
```

We used to provide some help through `rustc_on_unimplemented` on non-`impl Trait` and non-type-params, but this lets us get rid of some otherwise unnecessary conditions in the annotation on `Iterator`.
2024-03-03 18:53:36 +00:00
Esteban Küber
f0c93117ed Use root obligation on E0277 for some cases
When encountering trait bound errors that satisfy some heuristics that
tell us that the relevant trait for the user comes from the root
obligation and not the current obligation, we use the root predicate for
the main message.

This allows to talk about "X doesn't implement Pattern<'_>" over the
most specific case that just happened to fail, like  "char doesn't
implement Fn(&mut char)" in
`tests/ui/traits/suggest-dereferences/root-obligation.rs`

The heuristics are:

 - the type of the leaf predicate is (roughly) the same as the type
   from the root predicate, as a proxy for "we care about the root"
 - the leaf trait and the root trait are different, so as to avoid
   talking about `&mut T: Trait` and instead remain talking about
   `T: Trait` instead
 - the root trait is not `Unsize`, as to avoid talking about it in
   `tests/ui/coercion/coerce-issue-49593-box-never.rs`.

```
error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
  --> $DIR/root-obligation.rs:6:38
   |
LL |         .filter(|c| "aeiou".contains(c))
   |                             -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
   |                             |
   |                             required by a bound introduced by this call
   |
   = note: required for `&char` to implement `FnOnce<(char,)>`
   = note: required for `&char` to implement `Pattern<'_>`
note: required by a bound in `core::str::<impl str>::contains`
  --> $SRC_DIR/core/src/str/mod.rs:LL:COL
help: consider dereferencing here
   |
LL |         .filter(|c| "aeiou".contains(*c))
   |                                      +
```

Fix #79359, fix #119983, fix #118779, cc #118415 (the suggestion needs
to change).
2024-03-03 18:53:35 +00:00
Nilstrieb
93f595fb2b Run some ui-fulldeps tests on stage 1 again
This is the second time I'm doing this... I'm starting to feel like
stage1 ui-fulldeps tests were a mistake. Maybe I should have just put
`#[cfg(bootstrap)]` there to let the bootstrap bumper fix it.
2024-03-03 18:41:25 +01:00
bors
279c9ba260 Auto merge of #121936 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-03-03 16:34:15 +00:00
Lukas Bergdoll
c45f0a977a
Apply suggestions from code review
Co-authored-by: Josh Stone <cuviper@gmail.com>
2024-03-03 15:30:46 +01:00
Jonas Pleyer
fb2b918866 Small enhancement to description of From trait
- fix small typo
- avoid repetition of formulations
2024-03-03 15:29:09 +01:00
bors
26907374b9 Auto merge of #121937 - GuillaumeGomez:rollup-9684vg3, r=GuillaumeGomez
Rollup of 3 pull requests

Successful merges:

 - #121917 (Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching)
 - #121933 (Add missing get_name for wasm::thread.)
 - #121934 (rustc_log: expose tracing-tree "wraparound" in an env var)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-03 14:01:47 +00:00
许杰友 Jieyou Xu (Joe)
d0111cb57a
Only run lint tests on x86_64-unknown-linux-gnu
We're trying to test lint behavior, not per-target crate-type support.
2024-03-03 13:58:35 +00:00
Guillaume Gomez
e634a0a51b
Rollup merge of #121934 - RalfJung:tree-wraparound, r=oli-obk
rustc_log: expose tracing-tree "wraparound" in an env var

This would be RUSTC_LOG_WRAPTREE, but I am open to other names.

r? `@oli-obk`
2024-03-03 14:07:44 +01:00
Guillaume Gomez
d769aceab6
Rollup merge of #121933 - Iansa9:thread-name-wasm-fix, r=Nilstrieb
Add missing get_name for wasm::thread.

Fixing #121932 by implementing `get_name` in `wasm:🧵:Thread`.
2024-03-03 14:07:43 +01:00
Guillaume Gomez
7d8f74f8b2
Rollup merge of #121917 - GuillaumeGomez:pattern-complexity_limit.rs, r=Nadrieril
Add new `pattern_complexity` attribute to add possibility to limit and check recursion in pattern matching

Needed for https://github.com/rust-lang/rust-analyzer/issues/9528.

This PR adds a new attribute only available when running rust testsuite called `pattern_complexity` which allows to set the maximum recursion for the pattern matching. It is quite useful to ensure the complexity doesn't grow, like in `tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs`.

r? `@Nadrieril`
2024-03-03 14:07:43 +01:00
许杰友 Jieyou Xu (Joe)
82ceec9d1d
Ignore cdylib test for i686-unknown-linux-musl 2024-03-03 13:05:15 +00:00
Guillaume Gomez
f04c5c5112 Add feature gate test for pattern_complexity attribute 2024-03-03 13:10:15 +01:00
Guillaume Gomez
f04b7ee130 Add and update tests to use pattern_complexity 2024-03-03 13:10:15 +01:00
Guillaume Gomez
be31b6b6cd Add new pattern_complexity attribute to add possibility to limit and check recursion in pattern matching 2024-03-03 13:10:15 +01:00
Ralf Jung
d579caf384 library/ptr: mention that ptr::without_provenance is equivalent to deriving from the null ptr 2024-03-03 12:34:38 +01:00
bors
9e73597e5a Auto merge of #121903 - Nilstrieb:rename-qnx-file, r=WaffleLapkin
Remove underscore from QNX target file name

For consistency with the other QNX targets and the actual target names.
2024-03-03 11:34:21 +00:00
Ralf Jung
90162ea7b1 rustc_log: expose tracing-tree "wraparound" in an env var 2024-03-03 12:33:26 +01:00
bors
639fab7f9a Auto merge of #3345 - RalfJung:win-get-thread-name, r=RalfJung
Windows: support getting the thread name

Also organize the thread name tests a bit.
2024-03-03 10:32:43 +00:00
bors
cdf1071309 Auto merge of #3346 - RalfJung:alloc-accesses, r=RalfJung
Add -Zmiri-track-alloc-accesses to readme and fix its wording

I forgot that yesterday...
2024-03-03 09:45:04 +00:00
Ralf Jung
c72b48778d Windows: support getting the thread name 2024-03-03 10:43:44 +01:00
Ralf Jung
931e45389a fix wording of alloc access tracking message 2024-03-03 10:27:24 +01:00
Ralf Jung
7f485fc923 readme 2024-03-03 10:12:19 +01:00