Do not error during method probe on `Sized` predicates for types that aren't the method receiver
Fixes#61525
This is safe even though we're skipping an error because we end up confirming the method, which means we're still checking the `Sized` predicate in the end. It just means that we don't emit an erroneous message as below:
```
error: the `query` method cannot be invoked on a trait object
--> src/lib.rs:14:11
|
14 | 1.query::<dyn ToString>("")
| ^^^^^
|
= note: another candidate was found in the following trait, perhaps add a `use` for it:
`use crate::Example;`
```
Also fixes erroneously suggesting the same trait over again, as seen in the `issue-35976.rs` UI test.
Don't rerun the build script for the compiler each time on non-windows platforms
In practice, this doesn't matter very much because the script takes ~no time to run.
But this makes `CARGO_LOG=info` easier to read, and theoretically saves a few milliseconds.
Fix sized check ICE in asm check
Fixes (beta nominated, so doesn't close) #99122
1. Moves a check for unresolved inference variables to _before_ other checks that could possibly ICE. We're not changing behavior here, just doing the same thing earlier in the function.
2. Erases region variables in sized check (which are not resolved at this point) because rustc will also ICE when region vars are passed to a query which does not canonicalize them.
Fix duplicated type annotation suggestion
Before, there was more or less duplicated suggestions to add type hints.
Fix by clearing more generic suggestions when a more specific suggestion
is possible.
This fixes#93506 .
Fix rustdoc help options
Fixes#98976.
Since you're the one who found out about the problem and also provided the solution (thanks for both!):
r? ```@jyn514```
Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`
Resolves#97059
This PR adds support for `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`.
Create fresh lifetime parameters for bare fn trait too
The current code fails to account for the equivalence between `dyn FnMut(&mut u8)` and bare `FnMut(&mut u8)`, and treated them differently.
This PR introduces a special case for `Fn` traits, which are always fully resolved.
Fixes#98616Fixes#98726
This will require a beta-backport, as beta contains that bug.
r? `@petrochenkov`
This extracts the linux-isms into variables, so that the script can be
extended to do PGO on windows. These variables will be overriden in a
few spots, in windows-specific blocks.
When building LLVM/LLD as part of a build that asks LLVM to generate profiles, e.g. when
doing PGO, cmake or clang-cl don't automatically link clang's profiler runtime in,
causing undefined reference errors at link-time.
We do that manually, by adding clang's resource library folder to the library search path:
- for LLVM itself, by extending the linker args that `rustc_llvm`'s build script
uses, to avoid the linker errors when linking `rustc_driver`.
- for LLD, by extending cmake's linker flags during the LLD build step.
Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.
Fixes#99071
Rollup of 5 pull requests
Successful merges:
- #98882 (explain doc comments in macros a bit)
- #98907 (Deny float const params even when `adt_const_params` is enabled)
- #99091 (Do not mention private types from other crates as impl candidates)
- #99140 (Implement `SourceMap::is_span_accessible`)
- #99147 (Mention similarly named associated type even if it's not clearly in supertrait)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Mention similarly named associated type even if it's not clearly in supertrait
Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits.
This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible.
Fixes#55673
Implement `SourceMap::is_span_accessible`
This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
explain doc comments in macros a bit
Open to suggestions on improving this... macro parsing is very foreign to me.
Should we have a structured suggestion to turn them into their regular non-doc comments?
Fixes#92846Fixes#97850