Commit Graph

229880 Commits

Author SHA1 Message Date
Michael Goulet
085ae9e8b4 Add support for inherent projections 2023-07-16 21:14:38 +00:00
bors
d9c24d1b1e Auto merge of #11169 - y21:new_lint_unelide_lifetimes, r=xFrednet
don't hide lifetimes for `LateContext`

Running `cargo dev new_lint --type methods` creates the lint file with hidden lifetimes for the `LateContext` parameter (i.e. `&LateContext`, when it should be `&LateContext<'_>`). This is already warned on with `#![warn(rust_2018_idioms)]`, so clippy should not use hidden lifetimes

changelog: none
2023-07-16 19:56:51 +00:00
y21
498db80d5c don't hide lifetimes for LateContext 2023-07-16 21:37:53 +02:00
bors
c4083faade Auto merge of #113545 - cjgillot:query-entry, r=compiler-errors
Check entry type as part of item type checking.

This code is currently executed inside the root `analysis` query.
Instead, check it during `check_for_entry_fn(CRATE_DEF_ID)` to hopefully avoid some re-executions.

`CRATE_DEF_ID` is chosen by considering that entry fn are typically at crate root, so the corresponding HIR should already be in the dependencies.
2023-07-16 18:54:18 +00:00
Alex Povel
d4184dde6a
Fix typo 2023-07-16 19:55:03 +02:00
bors
cc7d9d534c Auto merge of #113749 - Kobzol:opt-dist-ci-group, r=clubby789
Use log groups in `opt-dist`

Some of the output was quite verbose in CI logs, this should help with that.

r? bootstrap
2023-07-16 17:09:40 +00:00
bors
11da267fdb Auto merge of #112239 - jieyouxu:targeted-no-method-suggestions, r=cjgillot
Add `#[rustc_confusables]` attribute to allow targeted "no method" error suggestions on standard library types

After this PR, the standard library developer can annotate methods on e.g. `BTreeSet::push` with `#[rustc_confusables("insert")]`. When the user mistypes `btreeset.push()`, `BTreeSet::insert` will be suggested if there are no other candidates to suggest. This PR lays the foundations for contributors to add `rustc_confusables` annotations to standard library types for targeted suggestions, as specified in #59450, or to address cases such as #108437.

### Example

Assume `BTreeSet` is the standard library type:

```
// Standard library definition
#![feature(rustc_attrs)]

struct BTreeSet;

impl BTreeSet {
    #[rustc_confusables("push")]
    fn insert(&self) {}
}

// User code
fn main() {
    let x = BTreeSet {};
    x.push();
}
```

A new suggestion (which has lower precedence than suggestions for misspellings and only is shown when there are no misspellings suggestions) will be added to hint the user maybe they intended to write `x.insert()` instead:

```
error[E0599]: no method named `push` found for struct `BTreeSet` in the current scope
  --> test.rs:12:7
   |
3  | struct BTreeSet;
   | --------------- method `push` not found for this struct
...
12 |     x.push();
   |       ^^^^ method not found in `BTreeSet`
   |
help: you might have meant to use `insert`
   |
12 |     x.insert();
   |       ~~~~~~

error: aborting due to previous error
```
2023-07-16 15:25:03 +00:00
Eduardo Sánchez Muñoz
ae2a72deaa Refactor checking function target features during const-eval
* Split into its own function
* Do not build a `Vec` of unavailable features
2023-07-16 16:07:55 +02:00
lcnr
e449daad6c stop mentioning number of applicate implementations 2023-07-16 15:36:19 +02:00
lcnr
19d46b690a self type param infer, avoid ICE 2023-07-16 15:29:08 +02:00
bors
4a07b2baf5 Auto merge of #113557 - Amanieu:no-builtins-prelude, r=petrochenkov
Hide `compiler_builtins` in the prelude

This crate is a private implementation detail. We only need to insert it into the crate graph for linking and should not expose any of its public API.

Fixes #113533
2023-07-16 13:19:14 +00:00
Jakub Beránek
18f20439dd CI: build CMake 3.20 to support LLVM 17 2023-07-16 15:00:53 +02:00
cui fliter
e87c15c8e4 fix wrong link
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-07-16 19:53:19 +08:00
许杰友 Jieyou Xu (Joe)
08c77a6eb4
Add infrastructure #[rustc_confusables] attribute to allow targeted
"no method" errors on standard library types

The standard library developer can annotate methods on e.g.
`BTreeSet::push` with `#[rustc_confusables("insert")]`. When the user
mistypes `btreeset.push()`, `BTreeSet::insert` will be suggested if
there are no other candidates to suggest.
2023-07-16 19:22:03 +08:00
Eduardo Sánchez Muñoz
3e8ce42d42 Add const-eval test for #[target_feature(enable = ...)] function calls 2023-07-16 13:20:06 +02:00
bors
55be59d2ce Auto merge of #113626 - Urgau:dedup-native-static-libs, r=petrochenkov
De-duplicate consecutive libs when printing native-static-libs

This PR adds a de-duplicate step just before printing the `native-static-libs`.

This step de-duplicates all the consecutive libs based only on the relevant comparison elements (this exclude spans, ast elements, ...).

Fixes https://github.com/rust-lang/rust/issues/113209
2023-07-16 10:59:45 +00:00
León Orell Valerian Liehr
c856c74764
Normalize lazy type aliases when probing for ADTs 2023-07-16 12:38:43 +02:00
bors
ca797d2f88 Auto merge of #15295 - bernardosulzbach:fix-ssr-help-message, r=lnicola
Fix rust-analzyer ssr help message

It's missing a `>`, so

```
> rust-analyzer ssr '''$a.foo($b) ==> bar($a, $b)'''
can't parse `rule`, Parse error: Cannot find delimiter `==>>`
```

happens.
2023-07-16 10:21:07 +00:00
Bernardo Sulzbach
0e2c68da64
Fix rust-analzyer ssr help message 2023-07-16 12:12:33 +02:00
nipzu
782bdfd791
Fix sort_unstable_by_key italicization 2023-07-16 12:07:04 +03:00
Jakub Beránek
e04b915a1d Use log groups in opt-dist
Some of the output was quite verbose in CI logs, this should help with that.
2023-07-16 10:36:13 +02:00
bors
00a39cc785 Auto merge of #113745 - tshepang:patch-1, r=workingjubilee
collect.rs: remove "Basic usage" text where not useful
2023-07-16 07:37:33 +00:00
bors
bc0628c9b4 Auto merge of #15292 - kberov:patch-1, r=lnicola
Update flags.rs

Fixed typo in documentation comment
2023-07-16 07:33:53 +00:00
Красимир Беров
8f169f9642
Update flags.rs
Fixed typo in documentation comment
2023-07-16 10:27:20 +03:00
bors
4fad3301b1 Auto merge of #15280 - lnicola:bump-rust-version, r=lnicola
minor: Bump rust-version to 1.70 and use the workspace one in xtask

CC https://github.com/rust-lang/rust-analyzer/issues/15279
2023-07-16 06:50:43 +00:00
bors
f4b5c7c8bd Auto merge of #15291 - rust-lang:revert-15288-15143, r=lnicola
Revert "Handle TyAlias in projected_ty"

Reverts rust-lang/rust-analyzer#15288
2023-07-16 06:36:33 +00:00
Laurențiu Nicola
467f5f418e
Revert "Handle TyAlias in projected_ty" 2023-07-16 09:34:35 +03:00
Tshepang Mbambo
f05dc95346
collect.rs: remove "Basic usage" text where not useful 2023-07-16 05:08:25 +02:00
bors
ffb9b61294 Auto merge of #113430 - Zalathar:hash, r=b-naber
Remove `LLVMRustCoverageHashCString`

Coverage has two FFI functions for computing the hash of a byte string. One takes a ptr/len pair (`LLVMRustCoverageHashByteArray`), and the other takes a NUL-terminated C string (`LLVMRustCoverageHashCString`).

But on closer inspection, the C string version is unnecessary. The calling-side code converts a Rust `&str` into a `CString`, and the C++ code then immediately turns it back into a ptr/len string before actually hashing it. So we can just call the ptr/len version directly instead.

---

This PR also fixes a bug in the C++ declaration of `LLVMRustCoverageHashByteArray`. It should be `size_t`, since that's what is declared and passed on the Rust side, and it's what `StrRef`'s constructor expects to receive on the callee side.
2023-07-16 01:56:23 +00:00
Michael Goulet
8f178d1b0c Don't call predicate_must_hold during fulfillment in intercrate 2023-07-16 01:56:16 +00:00
bors
2c718d1259 Auto merge of #113738 - jyn514:rollup-mjcya4c, r=jyn514
Rollup of 3 pull requests

Successful merges:

 - #113643 (bootstrap: Clean up try_run)
 - #113731 (Remove unused `bootstrap::util::CiEnv` enum)
 - #113737 (update mailmap for myself)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-16 00:05:49 +00:00
jyn
df729c2826
Rollup merge of #113737 - jyn514:mailmap, r=jyn514
update mailmap for myself
2023-07-15 18:52:32 -05:00
jyn
0a299f6512
Rollup merge of #113731 - jyn514:ci-env, r=ozkanonur
Remove unused `bootstrap::util::CiEnv` enum

the right one is `build_helper::CiEnv`; this one wasn't even used.
2023-07-15 18:52:32 -05:00
jyn
90c74e20ce
Rollup merge of #113643 - jyn514:try-run, r=ozkanonur
bootstrap: Clean up try_run

r? `@ozkanonur` since you reviewed `@GuillaumeGomez's` PR

i recommend reviewing commit-by-commit
2023-07-15 18:52:31 -05:00
jyn
2d3a964f26 update mailmap for myself 2023-07-15 18:22:11 -05:00
Eduardo Sánchez Muñoz
b5fde0dae0 miri: fail when calling a function that requires an unavailable target feature
miri will report an UB when calling a function that has a `#[target_feature(enable = ...)]` attribute is called and the required feature is not available.

"Available features" are the same that `is_x86_feature_detected!` (or equivalent) reports to be available during miri execution (which can be enabled or disabled with the `-C target-feature` flag).
2023-07-16 00:23:17 +02:00
bors
4124617c6e Auto merge of #113606 - jyn514:parallel-compiler-cleanup, r=cjgillot
Don't require each rustc_interface tool to opt-in to parallel_compiler

Previously, forgetting to call `interface::set_thread_safe_mode` would cause the following ICE:
```
thread 'rustc' panicked at 'uninitialized dyn_thread_safe mode!', /rustc/dfe0683138de0959b6ab6a039b54d9347f6a6355/compiler/rustc_data_structures/src/sync.rs:74:18
```

This calls `set_thread_safe_mode` in `interface::run_compiler` to avoid requiring it in the caller.

Fixes `tests/run-make-fulldeps/issue-19371` when parallel-compiler is enabled.

r? `@SparrowLii` cc https://github.com/rust-lang/rust/issues/75760
2023-07-15 22:23:05 +00:00
Camille GILLOT
87233da5c2 Check entry type as part of item type checking. 2023-07-15 22:02:16 +00:00
bors
4c8bb79d9f Auto merge of #113697 - GuillaumeGomez:rm-unneeded-externallocation-handling, r=lqd
Remove unneeded handling for `ExternalLocation::Unknown` in rustdoc render context

Should fix perf regression introduced in https://github.com/rust-lang/rust/pull/113623.

r? `@lqd`
2023-07-15 20:31:40 +00:00
bors
425726d46b Auto merge of #113732 - matthiaskrgr:rollup-nm5qy4i, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #113625 (Structurally normalize in selection)
 - #113644 (misc bootstrap cleanups)
 - #113663 (Implement "items do not inherit unsafety" note for THIR unsafeck)
 - #113683 (remove outdated `FIXME`s in bootstrap internals)
 - #113709 (rustdoc: use src consistently over source in CSS/JS)
 - #113724 (Migrate GUI colors test to original CSS color format)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-15 18:13:26 +00:00
Matthias Krüger
5f94c876ad
Rollup merge of #113724 - GuillaumeGomez:migrate-gui-test-color-21, r=notriddle
Migrate GUI colors test to original CSS color format

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

r? `@notriddle`
2023-07-15 19:42:53 +02:00
Matthias Krüger
331b5baddd
Rollup merge of #113709 - notriddle:notriddle/src, r=GuillaumeGomez
rustdoc: use src consistently over source in CSS/JS

The two terms have been used, inconsistently, in closely related spots like the `src/` directory vs `source-files.js`, and with things like `src-sidebar-toggle` vs the `source-sidebar`. This PR changes most use of `source` to `src` instead (except the localStorage configuration variables, which would be very complicated to migrate).

It also renames `.srclink` to `.src`. This is mostly aiming to cut out one of those many little peanut-butter bits of bloat, and is consistent with how other link classes are done (like how you have `a.mod` stylesheet rules, but there's also a `mod` class put on the body tag).
2023-07-15 19:42:53 +02:00
Matthias Krüger
d0ef799156
Rollup merge of #113683 - ozkanonur:polished, r=jyn514
remove outdated `FIXME`s in bootstrap internals

self-explanatory
2023-07-15 19:42:52 +02:00
Matthias Krüger
9b8be2f0e1
Rollup merge of #113663 - syvb:non_inherited_unsafe_thir, r=cjgillot
Implement "items do not inherit unsafety" note for THIR unsafeck

Implements the "items do not inherit unsafety from separate enclosing items" note from the MIR unsafety checker in the THIR unsafety checker (`-Z thir-unsafeck`) to maintain parity between the two unsafety checkers. The logic to find the separate enclosing item is nearly the same as in the MIR unsafety checker.
2023-07-15 19:42:52 +02:00
Matthias Krüger
e76ae3e4c5
Rollup merge of #113644 - jyn514:bootstrap-cleanups, r=albertlarsan68
misc bootstrap cleanups

- rename `detail_exit_macro` to `exit`
- remove unnecessary `Builder::new_standalone` function
- support `x suggest` with build-metrics
2023-07-15 19:42:51 +02:00
Matthias Krüger
da18cf8572
Rollup merge of #113625 - compiler-errors:structurally-norm-in-selection, r=lcnr
Structurally normalize in selection

We need to do this because of the fact that we're checking the `Ty::kind` on a type during selection, but goals passed into select are not necessarily normalized.

Right now, we're (kinda) unnecessarily normalizing the RHS of a trait upcasting goal, which is broken for different reasons (#113393). But I'm waiting for this PR to land before discussing that one.

r? `@lcnr`
2023-07-15 19:42:51 +02:00
jyn
6f589d53ba Remove unused bootstrap::util::CiEnv enum
the right one is `build_helper::CiEnv`; this one wasn't even used.
2023-07-15 12:37:11 -05:00
jyn
c0c6a24f89 Replace builder::try_run_quiet with run_quiet_delaying_failure
It was only used when a `builder` is available, and I want to encourage using the version that supports `--no-fail-fast`.
2023-07-15 12:31:31 -05:00
jyn
78f51a4be0 Rename Builder::try_run to run_delaying_failure 2023-07-15 12:31:31 -05:00
jyn
63d7992353 Deduplicate Builder::try_run and mark Config::try_run as deprecated
This does three things:
1. Remove `forward!(Build, fn try_run())`. Having `try_run` behave differently as a free function than an associated function is confusing, and `Builder::try_run` is a very desirable name.
2. Move `test::try_run` and `run::try_run` to `Builder::try_run`. These functions are different than `Config::try_run` - they delay the failure and print it out at the end of the build.
3. Mark `Config::try_run` as deprecated to encourage people to use `Builder::try_run` instead.
2023-07-15 12:27:53 -05:00