This removes a version check for LLVM >=13, and specifies prefixes as a series
of independent `--check-prefix` flags instead of a single `--check-prefixes`.
This was caused by 72b172bdf6 in #121206. That commit removed an early
return from `analysis` when there are stashed errors. As a result, it's
possible to reach privacy analysis when there are stashed errors, which
means more code paths can be reached. One such code path was handled in
that commit, where a `span_bug` was changed to a `span_delayed_bug`.
This commit handles another such code path uncovered by fuzzing, in much
the same way.
Fixes#121455.
fix: Fix proc-macro server not accounting for string delimiters correctly
Fixes https://github.com/rust-lang/rust-analyzer/issues/16622
Note that this is a bug a in the proc-macro server, so this won't be fixed until the next subtree sync
remove `sub_relations` from the `InferCtxt`
While doing so, I tried to remove the `delay_span_bug` in `rematch_impl` again, which lead me to discover another `freshen` bug, fixing that one in the second commit. See commit descriptions for the reasoning behind each change.
r? `@compiler-errors`
Having this set to true disrupts compiler development workflows for people who use `llvm.download-ci-llvm = true`
because we don't provide ci-llvm on the `rustc-alt-builds` server. Therefore, it is kept off by default.
Signed-off-by: onur-ozkan <work@onurozkan.dev>
When given
```rust
trait Original {
fn f() -> impl Fn();
}
trait Erased {
fn f(&self) -> Box<dyn Fn()>;
}
impl<T: Original> Erased for T {
fn f(&self) -> Box<dyn Fn()> {
Box::new(<T as Original>::f())
}
}
```
avoid suggestion to restrict the `Trait::{opaque}` type in a `where` clause:
```
error[E0310]: the associated type `<T as Original>::{opaque#0}` may not live long enough
--> $DIR/missing-static-bound-from-impl.rs:11:9
|
LL | Box::new(<T as Original>::f())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| the associated type `<T as Original>::{opaque#0}` must be valid for the static lifetime...
| ...so that the type `impl Fn()` will meet its required lifetime bounds
```
CC #119773.
Rollup of 8 pull requests
Successful merges:
- #120598 (No need to `validate_alias_bound_self_from_param_env` in `assemble_alias_bound_candidates`)
- #121386 (test that we do not support higher-ranked regions in opaque type inference)
- #121393 (match lowering: Introduce a `TestCase` enum to replace most matching on `PatKind`)
- #121401 (Fix typo in serialized.rs)
- #121427 (Fix panic when compiling `Rocket`.)
- #121439 (Fix typo in metadata.rs doc comment)
- #121441 (`DefId` to `LocalDefId`)
- #121452 (Add new maintainers to nto-qnx.md)
r? `@ghost`
`@rustbot` modify labels: rollup
Do not provide a structured suggestion when the arguments don't match.
```
error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in the current scope
--> $DIR/auto-ref-slice-plus-ref.rs:7:7
|
LL | a.test_mut();
| ^^^^^^^^
|
= help: items from traits can only be used if the trait is implemented and in scope
note: `MyIter` defines an item `test_mut`, perhaps you need to implement it
--> $DIR/auto-ref-slice-plus-ref.rs:14:1
|
LL | trait MyIter {
| ^^^^^^^^^^^^
help: there is a method `get_mut` with a similar name, but with different arguments
--> $SRC_DIR/core/src/slice/mod.rs:LL:COL
```
Consider methods beyond inherent ones when suggesting typos.
```
error[E0599]: no method named `owned` found for reference `&dyn Foo` in the current scope
--> $DIR/object-pointer-types.rs:11:7
|
LL | fn owned(self: Box<Self>);
| --------- the method might not be found because of this arbitrary self type
...
LL | x.owned();
| ^^^^^ help: there is a method with a similar name: `to_owned`
```
Fix#101013.
```
error[E0308]: mismatched types
--> $DIR/rustc_confusables_std_cases.rs:20:14
|
LL | x.append(42);
| ------ ^^ expected `&mut Vec<{integer}>`, found integer
| |
| arguments to this method are incorrect
|
= note: expected mutable reference `&mut Vec<{integer}>`
found type `{integer}`
note: method defined here
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
help: you might have meant to use `push`
|
LL | x.push(42);
| ~~~~
```
Help with common API confusion, like asking for `push` when the data structure really has `append`.
```
error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope
--> $DIR/rustc_confusables_std_cases.rs:17:7
|
LL | x.size();
| ^^^^
|
help: you might have meant to use `len`
|
LL | x.len();
| ~~~
help: there is a method with a similar name
|
LL | x.resize();
| ~~~~~~
```
#59450
Add new maintainers to nto-qnx.md
[Ferrous Systems](https://ferrous-systems.com) are volunteering myself and `@japaric` as co-maintainers of the QNX targets.
match lowering: Introduce a `TestCase` enum to replace most matching on `PatKind`
Introduces `TestCase` that represents the specific outcome of a test. It complements `TestKind` which represents a test. In `MatchPair::new()` we select the appropriate `TestCase` for the pattern, and after that we almost never have to inspect the pattern directly during match lowering.
Together with https://github.com/rust-lang/rust/pull/120904, this makes `MatchPair` into a standalone abstraction that hides the details of `thir::Pat`. This will become even truer in the next PR where I make `TestCase` handle or patterns. This opens the door to a lot of future simplifications.
r? `@matthewjasper`
No need to `validate_alias_bound_self_from_param_env` in `assemble_alias_bound_candidates`
We already fully normalize the self type before we reach `assemble_alias_bound_candidates`, so there's no reason to double check that a projection is truly rigid by checking param-env bounds.
I think this is also blocked on us making sure to always normalize opaques: #120549.
r? lcnr
Migrate compiletest to use `ui_test`-style `//@` directives
## Preface
There's an on-going effort to rewrite parts of or the entirety of compiletest
(<https://github.com/rust-lang/compiler-team/issues/536>). A step towards this involve migrating
compiletest tests to use the [`ui_test`](https://github.com/oli-obk/ui_test) framework, which
involves changing compiletest directives in `// <directive-name>` style to `ui_test`
`//@ <directive-name>` style (https://github.com/rust-lang/compiler-team/issues/512).
This PR aims to implement the directive-style change from `//` to `//`@`` for the remaining
non-"ui" test suite tests.
## Key Changes
1. All `tests/` tests now use `//`@`` directives.
2. Compiletest only accepts `//`@`` and issues an error if an old-style directive is detected.
3. `// ignore-tidy` and `// ignore-tidy-*` are considered tidy directives and are ignored by
compiletest header parsing.
## Diff Generation
The diff is generated by:
- Collecting directives from `tests/` via hijacking compiletest to emit successfully parsed
directive lines.
- Using a migration tool
(<https://github.com/jieyouxu/compiletest-ui_test-header-migration/tree/master>) to replace
`//` directives in compiletest tests with `//`@`.`
### Reproduction Steps
0. Delete the temporary file `$RUSTC_REPO_PATH/build/<target_triple>/test/__directive_lines.txt`,
if the collection script was previously ran.
1. Use the <https://github.com/jieyouxu/rust/tree/collect-test-directives> collect-test-directives
script, which outputs a temporary file recording headers occuring in each compiletest test.
- You need to checkout this branch: `git checkout collect-test-directives`.
- This needs to be rebased on latest master to ensure up-to-date test directives can be collected.
- You need to run `./x test` on each of the `test/*` subfolders once:
```bash
./x test tests/assembly/ --stage 1 --force-rerun
./x test tests/codegen/ --stage 1 --force-rerun
./x test tests/codegen-units/ --stage 1 --force-rerun
./x test tests/coverage/ --stage 1 --force-rerun
./x test tests/coverage-run-rustdoc/ --stage 1 --force-rerun
./x test tests/debuginfo/ --stage 1 --force-rerun
./x test tests/incremental/ --stage 1 --force-rerun
./x test tests/mir-opt/ --stage 1 --force-rerun
./x test tests/pretty/ --stage 1 --force-rerun
./x test tests/run-make/ --stage 1 --force-rerun
./x test tests/run-make-fulldeps/ --stage 1 --force-rerun
./x test tests/run-pass-valgrind/ --stage 1 --force-rerun
./x test tests/rustdoc/ --stage 1 --force-rerun
TARGET=<target-triple> ./x test tests/rustdoc-gui/ --stage 1 --force-rerun
./x test tests/rustdoc-js/ --stage 1 --force-rerun
./x test tests/rustdoc-js-std/ --stage 1 --force-rerun
./x test tests/rustdoc-json/ --stage 1 --force-rerun
./x test tests/rustdoc-ui/ --stage 1 --force-rerun
./x test tests/ui/ --stage 1 --force-rerun
./x test tests/ui-fulldeps/ --stage 1 --force-rerun
```
2. Checkout the `migrate-compiletest-directives` branch.
3. Run the migration tool <https://github.com/jieyouxu/compiletest-ui_test-header-migration>.
4. Check that the migration at least does not cause test failures if you change compiletest to
accept `//`@`` directives only. This is also required if the test outputs somehow need to be
blessed.
- `RUSTC_TEST_FAIL_FAST=1 ./x test tests/<secondary-directory> --stage 1 --bless`
5. Confirm that there is no difference after running the migration tool when you are on the
`migrate-compiletest-directives` branch.
## Follow Up Work
- [ ] Adjust rustc-dev-guide docs for compiletest directives (this time for all the other suites and modes). <https://github.com/rust-lang/rustc-dev-guide/pull/1895>.
Without doing so we use the same candidate cache entry
for `?0: Trait<?1>` and `?0: Trait<?0>`. These goals are different
and we must not use the same entry for them.
we don't track them when canonicalizing or when freshening,
resulting in instable caching in the old solver, and issues when
instantiating query responses in the new one.