This allows executing it like cargo clif build if you add it to your
PATH. It also fixes infinite recursion on Windows when invoking it as
Windows includes the current directory in PATH by default.
Fixes#971
Allow loading LLVM plugins with both legacy and new pass manager
Opening a draft PR to get feedback and start discussion on this feature. There is already a codegen option `passes` which allow giving a list of LLVM pass names, however we currently can't use a LLVM pass plugin (as described here : https://llvm.org/docs/WritingAnLLVMPass.html), the only available passes are the LLVM built-in ones.
The proposed modification would be to add another codegen option `pass-plugins`, which can be set with a list of paths to shared library files. These libraries are loaded using the LLVM function `PassPlugin::Load`, which calls the expected symbol `lvmGetPassPluginInfo`, and register the pipeline parsing and optimization callbacks.
An example usage with a single plugin and 3 passes would look like this in the `.cargo/config`:
```toml
rustflags = [
"-C", "pass-plugins=/tmp/libLLVMPassPlugin",
"-C", "passes=pass1 pass2 pass3",
]
```
This would give the same functionality as the opt LLVM tool directly integrated in rust build system.
Additionally, we can also not specify the `passes` option, and use a plugin which inserts passes in the optimization pipeline, as one could do using clang.
Add codegen option for branch protection and pointer authentication on AArch64
The branch-protection codegen option enables the use of hint-space pointer
authentication code for AArch64 targets.
rustc_metadata: Encode list of all crate's traits into metadata
While working on https://github.com/rust-lang/rust/pull/88679 I noticed that rustdoc is casually doing something quite expensive, something that is used only for error reporting in rustc - collecting all traits from all crates in the dependency tree.
This PR trades some minor extra time spent by metadata encoder in rustc for major gains for rustdoc (and for rustc runs with errors, which execute the `all_traits` query for better diagnostics).
compiletest: Remove some vestigial code
The `check_lines` header is no longer parsed as a header, but instead inside the debuginfo tests. I believe this was changed in #13726.
Rollup of 7 pull requests
Successful merges:
- #92075 (rustdoc: Only special case struct fields for intra-doc links, not enum variants)
- #92118 (Parse and suggest moving where clauses after equals for type aliases)
- #92237 (Visit expressions in-order when resolving pattern bindings)
- #92340 (rustdoc: Start cleaning up search index generation)
- #92351 (Add long error explanation for E0227)
- #92371 (Remove pretty printer space inside block with only outer attrs)
- #92372 (Print space after formal generic params in fn type)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Print space after formal generic params in fn type
Follow-up to #92238 fixing one of the FIXMEs.
```rust
macro_rules! repro {
($ty:ty) => {
stringify!($ty)
};
}
fn main() {
println!("{}", repro!(for<'a> fn(&'a u8)));
}
```
Before: `for<'a>fn(&'a u8)`
After: `for<'a> fn(&'a u8)`
The pretty printer's `print_formal_generic_params` already prints formal generic params correctly with a space, we just need to call it when printing BareFn types instead of reimplementing the printing incorrectly without a space.
83b15bfe1c/compiler/rustc_ast_pretty/src/pprust/state.rs (L1394-L1400)
Visit expressions in-order when resolving pattern bindings
[edited:] Visit the pattern's sub-expressions before defining any bindings.
Otherwise, we might get into a case where a Lit/Range expression in a pattern has a qpath pointing to a Ident pattern that is defined after it, causing an ICE when lowering to HIR. I have a more detailed explanation in the issue linked.
Fixes#92100
Parse and suggest moving where clauses after equals for type aliases
~Mostly the same as #90076, but doesn't make any syntax changes.~ Whether or not we want to land the syntax changes, we should parse the invalid where clause position and suggest moving.
r? `@nikomatsakis`
cc `@petrochenkov` you might have thoughts on implementation
rustdoc: Only special case struct fields for intra-doc links, not enum variants
Variants are already handled by `resolve_str_path_error`, rustdoc doesn't need to consider them separately. Thanks `@camelid` for catching this!
Eventually I'd like to fix the "combine this with `variant_field`" comment but that needs `resolve_field` to take a `ty_res` parameter to avoid it being super hacky (cc https://github.com/rust-lang/rust/issues/83761#issuecomment-813026026).
r? `@camelid`
rustdoc: Remove `String` allocation in iteration in `print_generic_bounds`
(I realized only after making the commit that maybe I shouldn't refer to iteration as looping, but it's close enough)
The string representation of a `clean::GenericBound` instance (evaluated [here](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/format.rs#L397)) is deterministic for a given `self` (the instance), `cx` and `f`, and since `cx` and `f` are constant (as far as I can tell) for a given invocation of `print_generic_bounds`, `self` is the determining factor. Therefore, using the data in `self` shouldn't differ in effect from using its string representation.
Given the totality of the function calls needed to evaluate the string representation as well as the actual allocation, at the very least, this shouldn't negatively affect performance.
This issue was fixed using a hacky recursion "fuel" argument, but the
issue was never minimized nor was a regression test added. The
underlying bug is still unfixed, so this test should help with fixing it
and removing the `recurse` hack.
Rollup of 7 pull requests
Successful merges:
- #92076 (Ignore other `PredicateKind`s in rustdoc auto trait finder)
- #92219 (Remove VCVARS_BAT)
- #92238 (Add a test suite for stringify macro)
- #92330 (Add myself to .mailmap)
- #92333 (Tighten span when suggesting lifetime on path)
- #92335 (Document units for `std::column`)
- #92344 (⬆️ rust-analyzer)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Tighten span when suggesting lifetime on path
This is kind of a hack.
Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that.
Fixes#92324
r? `@cjgillot`
Add a test suite for stringify macro
This attempts to cover the behavior of `stringify!` on various interpolated syntax tree nodes.
The pretty printer has a history of unsightly whitespace (double spaces, missing spaces, spaces where there shouldn't be spaces) — #91437, #91562, #91568. There are several such issues left; the test cases that I consider to be currently behaving incorrectly are marked with `// FIXME` in the PR.
Remove VCVARS_BAT
This environment variable is no longer used. It was used in the original Azure Pipelines configuration (#60777). When GitHub Actions were added (#70190), it was no longer used, and I suspect it was just an oversight while transitioning the configuration.
Ignore other `PredicateKind`s in rustdoc auto trait finder
Fixes#92073
There's not really anything we can do with them, and they're
causing ICEs. I'm not using a wildcard match, as we should check
that any new `PredicateKind`s are handled properly by rustdoc.