| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
early linting: avoid redundant calls to `check_id`
An attempt to address the regression at https://github.com/rust-lang/rust/pull/142240#issuecomment-2964425460
r? `@oli-obk`
cc `@nnethercote` who might have a better understanding of the performance implications
|
|
Do not clone Arc when hashing span.
Tiny improvement I was when trying to profile span hashing.
|
|
move fast reject into inner
to also fast reject inside of the folder
r? `@BoxyUwU`
|
|
rustdoc_json: reduce allocations
These commits reduce the number of allocations done for rustdoc_json, mostly by avoiding unnecessary clones.
Best reviewed one commit at a time.
r? `@aDotInTheVoid`
|
|
[perf] `GenericArgs`-related: Change asserts to debug asserts & use more slice interning over iterable interning
1. The 1st commit yields the following perf gains: [#142289 (comment)](https://github.com/rust-lang/rust/pull/142289#issuecomment-2964041303).
2. The 2nd commit might also have a minor positive perf impact, however that one wasn't tested in isolation.
For reference, the initial approach https://github.com/rust-lang/rust/commit/c7e6accd79d91fe5dec01a81499a08f9db280440 (results: https://github.com/rust-lang/rust/pull/142289#issuecomment-2961076587) had a lot more changes (apart from what's now contained in commit 1 and 2) which seemed to be perf irrelevant (cf. the partial countercheck in https://github.com/rust-lang/rust/commit/6f82bf1cfece61d32714fbfeecf8c5cf1356b3ae (results: https://github.com/rust-lang/rust/pull/142289#issuecomment-2968393647).
|
|
Simplify implementation of Rust intrinsics by using type parameters in the cache
The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function.
(originally was part of rust-lang/rust#140763, split off later)
`@rustbot` label A-codegen A-LLVM
r? codegen
|
|
shepmaster:mismatched-syntaxes-in-function-like-places, r=jieyouxu
Apply `mismatched-lifetime-syntaxes` to trait and extern functions
r? `@jieyouxu`
|
|
Rollup of 9 pull requests
Successful merges:
- rust-lang/rust#140593 (Temporary lifetime extension through tuple struct and tuple variant constructors)
- rust-lang/rust#141399 ([rustdoc] Give more information into extracted doctest information)
- rust-lang/rust#141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`)
- rust-lang/rust#141811 (Unimplement unsized_locals)
- rust-lang/rust#142243 (float tests: deduplicate min, max, and rounding tests)
- rust-lang/rust#142464 (variadic functions: remove list of supported ABIs from error)
- rust-lang/rust#142477 (Fix incorrect suggestion when calling an associated type with a type anchor)
- rust-lang/rust#142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if)
- rust-lang/rust#142489 (Update the `compiler-builtins` subtree)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Update the `compiler-builtins` subtree
Update the Josh subtree to https://github.com/rust-lang/compiler-builtins/commit/7c46e921c117.
r? `@ghost`
|
|
Remove unneeded lifetime bound from signature of BTreeSet::extract_if
One way to observe the difference between these signatures, using 0 explicit lifetimes and 0 contrived where-clauses:
```rust
use std::collections::btree_set::{BTreeSet, ExtractIf};
use std::ops::RangeFull;
fn repro(
set: &mut BTreeSet<i32>,
predicate: impl Fn(i32) -> bool,
) -> ExtractIf<i32, RangeFull, impl FnMut(&i32) -> bool> {
set.extract_if(.., move |x| predicate(*x))
}
```
**Before:**
```console
error[E0311]: the parameter type `impl Fn(i32) -> bool` may not live long enough
--> src/lib.rs:8:5
|
5 | set: &mut BTreeSet<i32>,
| ------------------ the parameter type `impl Fn(i32) -> bool` must be valid for the anonymous lifetime defined here...
...
8 | set.extract_if(.., move |x| predicate(*x))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `impl Fn(i32) -> bool` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
4 ~ fn repro<'a>(
5 ~ set: &'a mut BTreeSet<i32>,
6 ~ predicate: impl Fn(i32) -> bool + 'a,
7 ~ ) -> ExtractIf<'a, i32, RangeFull, impl FnMut(&i32) -> bool> {
|
```
**After:** compiles success.
- Tracking issue: https://github.com/rust-lang/rust/issues/70530
|
|
r=WaffleLapkin
Fix incorrect suggestion when calling an associated type with a type anchor
`sugg_span` here is the span of the call expression.
That span here is the `<Self>::Assoc`, which is exactly what we need here (even though I would expect it to include the arguments, but I guess it doesn't)
r? ``@WaffleLapkin``
One commit with failing tests and one that fixes it for reviewability
closes rust-lang/rust#142473
|
|
variadic functions: remove list of supported ABIs from error
I think this list is problematic for multiple reasons:
- It is bound to go out-of-date as it is in a very different place from where we actually define which functions support varagrs (`fn supports_varargs`).
- Many of the ABIs we list only work on some targets; it makes no sense to mention "aapcs" as a possible ABI when building for x86_64. (This led to a lot of confusion in https://github.com/rust-lang/rust/issues/110505 where the author thought they should use "cdecl" and then were promptly told that "cdecl" is not a legal ABI on their target.)
- Typically, when the programmer wrote `extern "foobar"`, it is because they need the "foobar" ABI. It is of little use to tell them that there are other ABIs with which varargs would work.
Cc ``@workingjubilee``
|
|
float tests: deduplicate min, max, and rounding tests
Part of https://github.com/rust-lang/rust/issues/141726
Best reviewed commit-by-commit.
- Use `assert_biteq!` in the `mod.rs` tests. This requires some trickery to make shadowing macros with imports work.
- The min, max, minimum, maximum tests in `tests/floats/f*.rs` are entirely subsumed by what we already have in `tests/float/mod.rs`, so I just removed them.
- The rounding tests (floor etc) in `f*.rs` had more test points, so I copied them over. They didn't have `0.5` and `-0.5` though which seem like interesting points in particular regarding the sign of the resulting zero if that's what it sounds to, and they didn't max min/max/inf/nan tests, so this was really a merger of both tests.
r? ``@tgross35``
|
|
Unimplement unsized_locals
Implements https://github.com/rust-lang/compiler-team/issues/630
Tracking issue here: https://github.com/rust-lang/rust/issues/111942
Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.
There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas
cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``
``@rustbot`` label F-unsized_locals
Fixes rust-lang/rust#79409
|
|
Delegate `<SocketAddr as Debug>` to `ByteStr`
This allows UTF-8 characters to be printed without escapes, rather than
just ASCII.
r? ``@joshtriplett``
|
|
[rustdoc] Give more information into extracted doctest information
Follow-up of https://github.com/rust-lang/rust/pull/134531.
This update fragment the doctest code into its sub-parts to give more control to the end users on how they want to use it.
The new JSON looks like this:
```json
{
"format_version":2,
"doctests":[
{
"file":"$DIR/extract-doctests-result.rs",
"line":8,
"doctest_attributes":{
"original":"",
"should_panic":false,
"no_run":false,
"ignore":"None",
"rust":true,
"test_harness":false,
"compile_fail":false,
"standalone_crate":false,
"error_codes":[],
"edition":null,
"added_css_classes":[],
"unknown":[]
},
"original_code":"let x = 12;\nOk(())",
"doctest_code":{
"crate_level":"#![allow(unused)]\n",
"code":"let x = 12;\nOk(())",
"wrapper":{
"before":"fn main() { fn _inner() -> core::result::Result<(), impl core::fmt::Debug> {\n",
"after":"\n} _inner().unwrap() }",
"returns_result":true
}
},
"name":"$DIR/extract-doctests-result.rs - (line 8)"
}
]
}
```
for this doctest:
```rust
let x = 12;
Ok(())
```
With this, I think it matches what you need ``@ojeda?`` If so, once merged I'll update the patch I sent to RfL.
r? ``@aDotInTheVoid``
|
|
Temporary lifetime extension through tuple struct and tuple variant constructors
This makes temporary lifetime extension work for tuple struct and tuple variant constructors, such as `Some()`.
Before:
```rust
let a = &temp(); // Extended
let a = Some(&temp()); // Not extended :(
let a = Some { 0: &temp() }; // Extended
```
After:
```rust
let a = &temp(); // Extended
let a = Some(&temp()); // Extended
let a = Some { 0: &temp() }; // Extended
```
So, with this change, this works:
```rust
let a = Some(&String::from("hello")); // New: String lifetime now extended!
println!("{a:?}");
```
Until now, we did not extend through tuple struct/variant constructors (like `Some`), because they are function calls syntactically, and we do not want to extend the String lifetime in:
```rust
let a = some_function(&String::from("hello")); // String not extended!
```
However, it turns out to be very easy to distinguish between regular functions and constructors at the point where we do lifetime extension.
In practice, constructors nearly always use UpperCamelCase while regular functions use lower_snake_case, so it should still be easy to for a human programmer at the call site to see whether something qualifies for lifetime extension or not.
This needs a lang fcp.
---
More examples of what will work after this change:
```rust
let x = Person {
name: "Ferris",
job: Some(&Job { // `Job` now extended!
title: "Chief Rustacean",
organisation: "Acme Ltd.",
}),
};
dbg!(x);
```
```rust
let file = if use_stdout {
None
} else {
Some(&File::create("asdf")?) // `File` now extended!
};
set_logger(file);
```
```rust
use std::path::Component;
let c = Component::Normal(&OsString::from(format!("test-{num}"))); // OsString now extended!
assert_eq!(path.components.first().unwrap(), c);
```
|
|
Out-of-tree testing is broken with the most recent update from
rust-lang/rust because it makes `compiler-builtins` depend on `core` by
path, which isn't usually available. In order to enable testing outside
of rust-lang/rust, add a new crate `builtins-shim` that uses the same
source as `compiler-builtins` but drops the `core` dependency. This has
replaced `compiler-builtins` as the workspace member and entrypoint for
tests.
|
|
https://github.com/rust-lang/rust
Pull recent changes from rust-lang/rust via Josh.
Upstream ref: d087f112b7d1323446c7b39a8b616aee7fa56b3d
Filtered ref: 2d43ce8ac022170e5383f7e5a188b55564b6566a
|
|
Rollup of 16 pull requests
Successful merges:
- rust-lang/rust#140969 (Allow initializing logger with additional tracing Layer)
- rust-lang/rust#141352 (builtin dyn impl no guide inference)
- rust-lang/rust#142046 (add Vec::peek_mut)
- rust-lang/rust#142273 (tests: Minicore `extern "gpu-kernel"` feature test)
- rust-lang/rust#142302 (Rework how the disallowed qualifier in function type diagnostics are generated)
- rust-lang/rust#142405 (Don't hardcode the intrinsic return types twice in the compiler)
- rust-lang/rust#142434 ( Pre-install JS dependencies in tidy Dockerfile)
- rust-lang/rust#142439 (doc: mention that intrinsics should not be called in user code)
- rust-lang/rust#142441 (Delay replacing escaping bound vars in `FindParamInClause`)
- rust-lang/rust#142449 (Require generic params for const generic params)
- rust-lang/rust#142452 (Remove "intermittent" wording from `ReadDir`)
- rust-lang/rust#142459 (Remove output helper bootstrap)
- rust-lang/rust#142460 (cleanup search graph impl)
- rust-lang/rust#142461 (compiletest: Clarify that `--no-capture` is needed with `--verbose`)
- rust-lang/rust#142475 (Add platform support docs & maintainers for *-windows-msvc)
- rust-lang/rust#142480 (tests: Convert two handwritten minicores to add-core-stubs)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
To prepare for merging from rust-lang/rust, set the version file to:
d087f112b7 Auto merge of #134841 - estebank:serde-attr-4, r=wesleywiser
|
|
tests: Convert two handwritten minicores to add-core-stubs
|
|
Add platform support docs & maintainers for *-windows-msvc
Thanks to `@ChrisDenton,` `@dpaoliello,` `@lambdageek` and `@sivadeilra` for agreeing to be target maintainers!
cc rust-lang/rust#113739
|
|
compiletest: Clarify that `--no-capture` is needed with `--verbose`
Confusingly, this does not make compile test print what command is used to run a ui test:
./x test tests/ui/panics/abort-on-panic.rs --verbose
It is also necessary to pass `--no-capture`, like this:
./x test tests/ui/panics/abort-on-panic.rs --verbose --no-capture
Then you will see prints like this:
executing cd "/rust/build/x86_64-unknown-linux-gnu/test/ui/panics/abort-on-panic.next" && \
RUSTC="/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" \
RUST_TEST_THREADS="32" \
"/rust/build/x86_64-unknown-linux-gnu/test/ui/panics/abort-on-panic.next/a"
Add a hint in the code for this that would have helped me figure this out.
(See https://rust-lang.zulipchat.com/#narrow/channel/122651-general/topic/compiltest.20show.20rustc.20commands.3F for some more context.)
|
|
cleanup search graph impl
in preparation for my fix of https://github.com/rust-lang/trait-system-refactor-initiative/issues/109
r? `@BoxyUwU`
|
|
Remove output helper bootstrap
This PR removes output utility helper method.
r? `@Kobzol`
|
|
Remove "intermittent" wording from `ReadDir`
`ReadDir` claims that `next` will return an error "if there’s some sort of intermittent IO error during iteration". I'm really not sure what this was intended to mean but the implementations will simply return all OS errors encountered during iteration to the user. What else can they do?
This is technically a change in the documented API but seeing as how it doesn't bear any relationship with the implementation I don't think it needs a libs-api fcp.
|
|
Require generic params for const generic params
I think that was just an oversight when the support for them was added
r? `@BoxyUwU` or `@camelid`
fixes rust-lang/rust#137188
fixes rust-lang/rust#138166
fixes rust-lang/rust#138240
fixes rust-lang/rust#138266
fixes rust-lang/rust#138359
|
|
Delay replacing escaping bound vars in `FindParamInClause`
By uplifting the `BoundVarReplacer`, which is used by (e.g.) normalization to replace escaping bound vars that are encountered when folding binders, we can use a similar strategy to delay the instantiation of a binder's contents in the `FindParamInClause` used by the new trait solver.
This should alleviate the recently added requirement that `Binder<T>: TypeVisitable` only if `T: TypeFoldable`, which was previously required b/c we were calling `enter_forall` so that we could structurally normalize aliases that we found within the predicates of a param-env clause.
r? lcnr
|
|
doc: mention that intrinsics should not be called in user code
Intrinsic functions declared in `std::intrinsics` are an implementation detail and should not be called directly by the user. The compiler explicitly warns against their use in user code:
```
warning: the feature `core_intrinsics` is internal to the compiler or standard library
--> src/lib.rs:1:12
|
1 | #![feature(core_intrinsics)]
| ^^^^^^^^^^^^^^^
|
= note: using it is strongly discouraged
= note: `#[warn(internal_features)]` on by default
```
[**Playground link**]
This PR documents what the compiler warning says: these intrinsics should not be used in user code.
[**Playground link**]: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=1c893b0698291f550bbdde0151fd221b
|
|
Pre-install JS dependencies in tidy Dockerfile
Also fixes passing `TIDY_PRINT_DIFF` to tidy, which has been passed to `npm install` rather than to tidy after the latest change here.
r? `@GuillaumeGomez`
Fixes: https://github.com/rust-lang/rust/issues/142433
|
|
Don't hardcode the intrinsic return types twice in the compiler
We already manually check intrinsic types in intrinsicck so we don't need to do it in the interpreter
|
|
Rework how the disallowed qualifier in function type diagnostics are generated
This pull request fixes two independent issues:
1. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), the diagnostic suggests removing the incorrect qualifier. Fixes https://github.com/rust-lang/rust/issues/142268, which is an issue created by https://github.com/rust-lang/rust/pull/133151. This is fixed by moving the check into `parse_fn_front_matter`, where better span information is available to generate the right suggestions.
2. When qualifiers of a function type ptr are in the wrong order and one of them is async/const (not permitted on function types), `cargo fix` crashes because "cannot replace slice of data that was already replaced". This is fixed by not generating a suggestion for the "wrong order" diagnostic if the "disallowed qualifier" diagnostic is triggered.
There is a commit with failing tests so the test diff is clearer
r? `@jdonszelmann`
|
|
workingjubilee:rework-gpu-kernel-feature-gate-test, r=jieyouxu
tests: Minicore `extern "gpu-kernel"` feature test
Explicitly cross-build it for GPU targets and check it errors on hosts. A relatively minor cleanup from my other ABI-related PRs that I got tired of rebasing.
|
|
add Vec::peek_mut
Tracking issue: rust-lang/rust#122742
|
|
builtin dyn impl no guide inference
cc https://github.com/rust-lang/rust/pull/141347
we can already slightly restrict this behavior in the old solver, so why not do so. Needs crater and an FCP.
r? `@compiler-errors`
|
|
Allow initializing logger with additional tracing Layer
This PR adds functions to the `rustc_log` and `rustc_driver_impl` crates to allow initializing the logger with an additional `tracing_subscriber::Layer`. This will be used in Miri to save trace events to file using e.g. [`tracing-chrome`](https://github.com/thoren-d/tracing-chrome)'s or [`tracing-tracy`](https://github.com/nagisa/rust_tracy_client)'s `Layer`s.
Additional context on the choice of signature can be found in [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Adding.20a.20dependency.20to.20Miri.20that.20depends.20on.20a.20rustc.20dep/near/515707776).
I re-exported `tracing_subscriber::{Layer, Registry};` from `rustc_log` so that `rustc_driver_impl` can use them in the function signature without depending on `tracing_subscriber` directly. I did this to avoid copy-pasting the dependency line with all of the enabled features from the `rustc_log` to the `rustc_driver_impl`'s Cargo.toml, which would have possibly led to redundancies and inconsistencies.
r? `@RalfJung`
|
|
The config file is not needed anymore since compiler-builtins is no
longer published. Removing it will resolve a CI failure.
|
|
|
|
|
|
Build rustc with assertions in `dist-alt` jobs
Revival of https://github.com/rust-lang/rust/pull/131077, to check CI times now that we don't do PGO/BOLT anymore on Linux `-alt` builds.
r? `@ghost`
try-job: dist-x86_64-msvc-alt
try-job: dist-x86_64-linux-alt
|
|
Look at proc-macro attributes when encountering unknown attribute
```
error: cannot find attribute `sede` in this scope
--> $DIR/missing-derive-2.rs:22:7
|
LL | #[sede(untagged)]
| ^^^^
|
help: the derive macros `Deserialize` and `Serialize` accept the similarly named `serde` attribute
|
LL | #[serde(untagged)]
| +
error: cannot find attribute `serde` in this scope
--> $DIR/missing-derive-2.rs:16:7
|
LL | #[serde(untagged)]
| ^^^^^
|
note: `serde` is imported here, but it is a crate, not an attribute
--> $DIR/missing-derive-2.rs:5:1
|
LL | extern crate serde;
| ^^^^^^^^^^^^^^^^^^^
help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute
|
LL + #[derive(Serialize, Deserialize)]
LL | enum B {
|
```
Partially address #47608. This PR doesn't find [macros that haven't yet been imported by name](https://github.com/rust-lang/rust/pull/109278/commits/af945cb86e03b44a4b6dc4d54ec1424b00a2349e).
|
|
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
Now that this repository is a subtree, we have no need to continue
publishing `compiler-builtins`.
|
|
|
|
|