Commit Graph

262708 Commits

Author SHA1 Message Date
Oli Scherer
67a08b5deb Attribute checking simplifications
remove an unused boolean and then merge two big matches into one
2024-07-30 15:02:40 +00:00
A. Wilcox
b1b48dc584
tidy: Fix quote in error message 2024-07-30 09:35:12 -05:00
bors
f1e8c54082 Auto merge of #3776 - oli-obk:duplicator, r=oli-obk
Use Scalar consistently in foreign item emulation

Step 0 of #3772

This just makes the code consistent. While we could also go for consistency the other way, that would only allow us to use integers in some cases where we use `Scalar` right now, because `Scalar` can also hold pointers where applicable.

There's also no danger in messing up (even though we do lose some compile-time checks), as `Scalar` knows the size of the integer stored within, so it will check that against the destination when it is written. In fact, this makes the checks much stronger compared with `write_int`, which just checks that the integer fits into the destination size.
2024-07-30 14:29:09 +00:00
Michael Goulet
4776ac0f88 Suppress must_use on eat calls in rustfmt 2024-07-30 10:10:36 -04:00
Oli Scherer
92f263b792 Make RUSTC_OVERRIDE_VERSION_STRING overwrite the rendered version output, too 2024-07-30 14:08:02 +00:00
Oli Scherer
cbab16feaf Test RUSTC_OVERRIDE_VERSION_STRING 2024-07-30 14:08:02 +00:00
onur-ozkan
6fcc630e56 update download-rustc documentation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-30 17:00:07 +03:00
onur-ozkan
bbeff8c786 set force_recompile: true if library is modified
This allows the standard library to be compiled even with `download-rustc` enabled.
Which means it's no longer a requirement to compile `rustc` in order to compile `std`.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-07-30 17:00:00 +03:00
Oli Scherer
6fc1b69993 Use Scalar consistently in foreign item emulation 2024-07-30 13:32:54 +00:00
bors
595316b400 Auto merge of #127955 - chenyukang:yukang-fix-mismatched-delimiter-issue-12786, r=nnethercote
Add limit for unclosed delimiters in lexer diagnostic

Fixes #127868

The first commit shows the original diagnostic, and the second commit shows the changes.
2024-07-30 13:02:16 +00:00
Liigo Zhuang
918cdcc9c5
More detailed note to deprecate ONCE_INIT 2024-07-30 19:36:28 +08:00
bors
51a0dd2677 Auto merge of #17744 - alibektas:debug_env_not_set, r=Veykril
minor: Set tracing level to debug when `cargo config get env` fails

fixes #17739
2024-07-30 11:02:21 +00:00
Ali Bektas
2169fc7f0f Set tracing level to debug when cargo config get env fails 2024-07-30 12:57:21 +02:00
bors
1ddedbaa59 Auto merge of #125929 - Bryanskiy:delegation-generics-3, r=petrochenkov
Delegation: support generics for delegation from free functions

(The PR was split from https://github.com/rust-lang/rust/pull/123958, explainer - https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md)

This PR implements generics inheritance from free functions to free functions and trait methods.

#### free functions to free functions:

```rust
fn to_reuse<T: Clone>(_: T) {}

reuse to_reuse as bar;
// desugaring:
fn bar<T: Clone>(x: T) {
  to_reuse(x)
}
```

Generics, predicates and signature are simply copied. Generic arguments in paths are ignored during generics inheritance:

```rust
fn to_reuse<T: Clone>(_: T) {}

reuse to_reuse::<u8> as bar;
// desugaring:
fn bar<T: Clone>(x: T) {
  to_reuse::<u8>(x) // ERROR: mismatched types
}
```

Due to implementation limitations callee path is lowered without modifications. Therefore, it is a compilation error at the moment.

#### free functions to trait methods:

```rust
trait Trait<'a, A> {
    fn foo<'b, B>(&self, x: A, y: B) {...}
}

reuse Trait::foo;
// desugaring:
fn foo<'a, 'b, This: Trait<'a, A>, A, B>(this: &This, x: A, y: B) {
  Trait::foo(this, x, y)
}
```

The inheritance is similar to the previous case but with some corrections:

- `Self` parameter converted into `T: Trait`
- generic parameters need to be reordered so that lifetimes go first

Arguments are similarly ignored.

---

In the future, we plan to  support generic inheritance for delegating from all contexts to all contexts (from free/trait/impl to free/trait /impl). These cases were considered first as the simplest from the implementation perspective.
2024-07-30 10:39:33 +00:00
Folkert
58bfd98baf
make /// doc comments compatible with naked functions 2024-07-30 12:20:18 +02:00
Ralf Jung
cc7e7bc096 cargo-miri: better error when we seem to run inside bootstrap but something is wrong 2024-07-30 12:13:04 +02:00
Nikita Popov
b960390548 Crash test for issue 121444 has been fixed 2024-07-30 10:22:48 +02:00
Krasimir Georgiev
00bfd702dc Disable MC/DC tests on LLVM 19
Disable the tests and generate an error if MC/DC is used on LLVM 19.
The support will be ported separately, as it is substantially
different on LLVM 19, and there are no plans to support both
versions.
2024-07-30 10:22:48 +02:00
Nikita Popov
579ab05e76 Update to LLVM 19 2024-07-30 10:22:48 +02:00
bors
e69c19ea0b Auto merge of #128336 - Bryanskiy:inst-binder-with-fresh, r=lcnr
Use Vec in instantiate_binder_with_fresh_vars

`FxHashMap`  was replaced with a pre-computed `Vec` of infer vars.

r? `@lcnr`
2024-07-30 08:15:17 +00:00
bors
33fdfb4673 Auto merge of #17735 - alibektas:ratoml_workspaces, r=Veykril
feat: Introduce workspace `rust-analyzer.toml`s

In order to globally configure a project it was, prior to this PR, possible to have a `ratoml` at the root path of a project. This is not the case anymore. Instead we now let ratoml files that are placed at the root of any workspace have a new scope called `workspace`. Although there is not a difference between a `workspace` scope and and a `global` scope, future PRs will change that.
2024-07-30 06:49:14 +00:00
bors
cd266e0433 Auto merge of #17742 - Veykril:wrong-retries, r=Veykril
fix: Fix incorrect retrying of inlay hint requests
2024-07-30 06:35:28 +00:00
bors
cf63c16269 Auto merge of #3770 - oli-obk:duplicator, r=oli-obk
Some FileDescriptor/FileDescription refactorings

follow-up to https://github.com/rust-lang/miri/pull/3763#discussion_r1694866428

I opted not to change the method names, as I think they are already pretty good (and the common one is the short name), and the docs should explain what they actually do, but if you feel like the names you proposed would be better, I'll just do that.
2024-07-30 06:24:44 +00:00
Lukas Wirth
13c095aaf1 fix: Fix incorrect retrying of inlay hint requests 2024-07-30 08:23:17 +02:00
bors
5fa145eab9 Auto merge of #17741 - Veykril:include-raw, r=Veykril
fix: Fix builtin includes rejecting raw string literals

Fixes https://github.com/rust-lang/rust-analyzer/issues/17701
2024-07-30 06:21:07 +00:00
Lukas Wirth
90e1a58cc6 fix: Fix builtin includes rejecting raw string literals 2024-07-30 08:19:32 +02:00
aissata
dadf3d2a97 the output in stderr expects panic-unwind 2024-07-30 08:16:47 +02:00
bors
37e7688992 Auto merge of #3759 - newpavlov:flock, r=oli-obk
Add `flock` shim
2024-07-30 06:00:12 +00:00
bors
7e3a971870 Auto merge of #128378 - matthiaskrgr:rollup-i3qz9uo, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #127574 (elaborate unknowable goals)
 - #128141 (Set branch protection function attributes)
 - #128315 (Fix vita build of std and forbid unsafe in unsafe in the os/vita module)
 - #128339 ([rustdoc] Make the buttons remain when code example is clicked)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-30 05:50:05 +00:00
bors
a8b8a070e0 Auto merge of #3773 - rust-lang:rustup-2024-07-30, r=oli-obk
Automatic Rustup
2024-07-30 05:35:08 +00:00
The Miri Cronjob Bot
8f712b5728 Merge from rustc 2024-07-30 05:11:47 +00:00
The Miri Cronjob Bot
fc584d7da3 Preparing for merge from rustc 2024-07-30 05:03:59 +00:00
bors
710ce90fbe Auto merge of #128250 - Amanieu:select_unpredictable, r=nikic
Add `select_unpredictable` to force LLVM to use CMOV

Since https://reviews.llvm.org/D118118, LLVM will no longer turn CMOVs into branches if it comes from a `select` marked with an `unpredictable` metadata attribute.

This PR introduces `core::intrinsics::select_unpredictable` which emits such a `select` and uses it in the implementation of `binary_search_by`.
2024-07-30 03:22:27 +00:00
Matthias Krüger
c2b085b4d4
Rollup merge of #128339 - GuillaumeGomez:click-code-example, r=notriddle
[rustdoc] Make the buttons remain when code example is clicked

Follow-up of https://github.com/rust-lang/rust/pull/125779.

One current issue we have with "run" button and the newly added copy code button is that if you're on mobile devices, you can't use them. I took a look at how `mdbook` is handling it and when you click on a code example, they show the buttons. I think it's a really good idea as if you want to copy the code on your mobile device, you will click on it, showing the buttons.

Feature can be tested [here](https://rustdoc.crud.net/imperio/click-code-example/foo/struct.Bar.html).

r? `@notriddle`
2024-07-30 04:31:55 +02:00
Matthias Krüger
f396a42ed6
Rollup merge of #128315 - zetanumbers:psvita-unsafe-in-unsafe, r=workingjubilee
Fix vita build of std and forbid unsafe in unsafe in the os/vita module

See #127747

r? `@workingjubilee`

`@pheki` `@nikarh`
2024-07-30 04:31:55 +02:00
Matthias Krüger
6b23cb5cdf
Rollup merge of #128141 - nikic:aarch64-bti, r=DianQK,cuviper
Set branch protection function attributes

Since LLVM 19, it is necessary to set not only module flags, but also function attributes for branch protection on aarch64. See e15d67cfc2 for the relevant LLVM change.

Fixes https://github.com/rust-lang/rust/issues/127829.
2024-07-30 04:31:54 +02:00
Matthias Krüger
ae92125a75
Rollup merge of #127574 - lcnr:coherence-check-supertrait, r=compiler-errors
elaborate unknowable goals

A reimplemented version of #124532 affecting only the new solver. Always trying to prove super traits ends up causing a fatal overflow error in diesel, so we cannot land this in the old solver.

The following test currently does not pass coherence:
```rust
trait Super {}
trait Sub<T>: Super {}

trait Overlap<T> {}
impl<T, U: Sub<T>> Overlap<T> for U {}
impl<T> Overlap<T> for () {}

fn main() {}
```

We check whether `(): Sub<?t>` holds. This stalls with ambiguity as downstream crates may add an impl for `(): Sub<Local>`. However, its super trait bound `(): Super` cannot be implemented downstream, so this one is known not to hold.

By trying to prove that all the super bounds of a trait before adding a coherence unknowable candidate, this compiles. This is necessary to prevent breakage from enabling `-Znext-solver=coherence` (#121848), see tests/ui/coherence/super-traits/super-trait-knowable-2.rs for more details. The idea is that while there may be an impl of the trait itself we don't know about, if we're able to prove that a super trait is definitely not implemented, then that impl would also never apply/not be well-formed.

This approach is different from #124532 as it allows tests/ui/coherence/super-traits/super-trait-knowable-3.rs to compile. The approach in #124532 only elaborating the root obligations while this approach tries it for all unknowable trait goals.

r? `@compiler-errors`
2024-07-30 04:31:54 +02:00
carbotaniuman
d8bc8761a5 Deny unsafe on more builtin attributes 2024-07-29 21:00:09 -05:00
Michael Goulet
e4076e34f8 Mark Parser::eat/check methods as must_use 2024-07-29 21:29:08 -04:00
bors
dba8e2d2c2 Auto merge of #128234 - jcsp:retain-empty-case, r=tgross35
Optimize empty case in Vec::retain

While profiling some code that happens to call Vec::retain() in a tight loop, I noticed more runtime than expected in retain, even in a bench case where the vector was always empty.  When I wrapped my call to retain in `if !myvec.is_empty()` I saw faster execution compared with doing retain on an empty vector.

On closer inspection, Vec::retain is doing set_len(0) on itself even when the vector is empty, and then resetting the length again in BackshiftOnDrop::drop.

Unscientific screengrab of a flamegraph illustrating how we end up spending time in set_len and drop:
![image](https://github.com/user-attachments/assets/ebc72ace-84a0-4432-9b6f-1b3c96d353ba)
2024-07-30 00:55:52 +00:00
Esteban Küber
51b5bb1798 Enforce sort order 2024-07-30 00:18:38 +00:00
Esteban Küber
b61570ac11 Structured suggestion for extern crate foo when foo isn't resolved in import
When encountering a name in an import that could have come from a crate that wasn't imported, use a structured suggestion to suggest `extern crate foo;` pointing at the right place in the crate.

When encountering `_` in an import, do not suggest `extern crate _;`.

```
error[E0432]: unresolved import `spam`
  --> $DIR/import-from-missing-star-3.rs:2:9
   |
LL |     use spam::*;
   |         ^^^^ maybe a missing crate `spam`?
   |
help: consider importing the `spam` crate
   |
LL + extern crate spam;
   |
```
2024-07-29 23:49:51 +00:00
bors
368e2fd458 Auto merge of #128360 - matthiaskrgr:rollup-wwy5mkj, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #126247 (rustdoc: word wrap CamelCase in the item list table and sidebar)
 - #128104 (Not lint pub structs without pub constructors intentionally)
 - #128153 (Stop using `MoveDataParamEnv` for places that don't need a param-env)
 - #128284 (Stabilize offset_of_nested)
 - #128342 (simplify the use of `CiEnv`)
 - #128355 (triagebot: make sure Nora is called Nora)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-07-29 21:46:59 +00:00
Nicholas Nethercote
70fcf9e790 Insert some blank lines.
After things that are immediately followed by a `use` declaration and
look like they might apply to that `use` item but actually don't.
2024-07-30 07:25:15 +10:00
Nicholas Nethercote
bd24763aaf Move a comment.
In #125443 this comment ended up in the wrong spot. I'm not sure why;
after careful checking this was the only case I could find like this.
2024-07-30 07:24:19 +10:00
Miguel Ojeda
77cc18fd79 CI: rfl: build the documentation
Since the `rfl` CI job has not had almost any issue for some weeks,
it is a good time to try to increase a bit the scope of what it tests.

The kernel does not use any particular `rustdoc` unstable issue (apart
from the doctests ones) so far, so in principle it should not introduce
extra issues here, and may be a good extra test case for Rust.

In addition, it may help to test new unstable features in the future.

In the worst case, we can revert it.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29 23:19:02 +02:00
Miguel Ojeda
d280b8ca14 CI: rfl: build the generated doctests
We were already generating the doctests, which should already catch most
issues with our hack around `--test-builder` and `--no-run`.

However, we were not building the result of that transformation, thus
build it for completeness and to ensure the hack may not have produced
something completely broken.

In the worst case, we can revert it.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29 23:18:15 +02:00
Matthias Krüger
c2616203bc
Rollup merge of #128355 - jieyouxu:rename-nora, r=aDotInTheVoid
triagebot: make sure Nora is called Nora

r? `@Noratrieb`
2024-07-29 21:26:14 +02:00
Matthias Krüger
4d78d11bf9
Rollup merge of #128342 - onur-ozkan:ci-env-usage, r=Kobzol
simplify the use of `CiEnv`

self-explanatory
2024-07-29 21:26:14 +02:00
Matthias Krüger
a73a025190
Rollup merge of #128284 - GKFX:stabilize-offset-of-nested, r=dtolnay,jieyouxu
Stabilize offset_of_nested

Tracking issue #120140. Closes #120140.

As the FCP is now nearing its end I have opened a stabilization PR. I have done this separately to the offset_of_enum feature, since that FCP has not started.

`@rustbot` label  F-offset_of_nested T-lang T-libs-api
2024-07-29 21:26:13 +02:00