Commit Graph

262788 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
fdb64b9478 tests: add regression test to make sure cfg_attr isn't considered unhandled 2024-08-06 06:12:10 +00:00
Esteban Küber
1bbaf6eb2f On short error format, append primary span label to message
The `error-format=short` output only displays the path, error code and
main error message all in the same line. We now add the primary span label
as well after the error message, to provide more context.
2024-08-06 04:08:10 +00:00
bors
8c7e0e1608 Auto merge of #128200 - estebank:normalize-whitespace, r=pnkfelix
Change output normalization logic to be linear against size of output

Modify the rendered output normalization routine to scan each character *once* and construct a `String` to be printed out to the terminal *once*, instead of using `String::replace` in a loop multiple times. The output doesn't change, but the time spent to prepare a diagnostic is now faster (or rather, closer to what it was before #127528).
2024-08-06 03:44:38 +00:00
bors
c9687a95a6 Auto merge of #125558 - Amanieu:const-asm-type, r=lcnr
Tweak type inference for `const` operands in inline asm

Previously these would be treated like integer literals and default to `i32` if a type could not be determined. To allow for forward-compatibility with `str` constants in the future, this PR changes type inference to use an unbound type variable instead.

The actual type checking is deferred until after typeck where we still ensure that the final type for the `const` operand is an integer type.

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-08-06 01:20:43 +00:00
y21
fdf3b31165 pass the right ParamEnv to might_permit_raw_init_strict 2024-08-06 01:53:50 +02:00
Chris Denton
3fd645e254
Check staticlib name falls back to rust_out 2024-08-05 23:50:15 +00:00
bors
b586701f78 Auto merge of #128707 - matthiaskrgr:rollup-63klywk, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #122049 (Promote riscv64gc-unknown-linux-musl to tier 2)
 - #128580 (Use `ParamEnv::reveal_all` in CFI)
 - #128688 (custom MIR: add support for tail calls)
 - #128694 (Normalize when equating `dyn` tails in MIR borrowck)
 - #128697 (interpret: move nullary-op evaluation into operator.rs)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-05 22:53:14 +00:00
Chris Denton
c6d94821f0
Don't ICE if getting the input's file_stem fails 2024-08-05 22:30:13 +00:00
Chris Denton
c8d50ef2ee
Windows: Test if \\.\NUL works as an input file 2024-08-05 22:13:17 +00:00
Matthias Krüger
c53698b399
Rollup merge of #128697 - RalfJung:nullary-op, r=compiler-errors
interpret: move nullary-op evaluation into operator.rs

We call it an operator, so we might as well treat it like one. :)

Also use more consistent naming for the "evaluate intrinsic" functions. "emulate" is really the wrong term, this *is* a genuine implementation of the intrinsic semantics after all.
2024-08-05 23:35:24 +02:00
Matthias Krüger
77f57cbcac
Rollup merge of #128694 - compiler-errors:norm, r=WaffleLapkin
Normalize when equating `dyn` tails in MIR borrowck

See the explanation in the comment.

Fixes #128621
cc `@WaffleLapkin`
2024-08-05 23:35:23 +02:00
Matthias Krüger
83155b3900
Rollup merge of #128688 - RalfJung:custom-mir-tail-calls, r=compiler-errors
custom MIR: add support for tail calls

Cc ``@WaffleLapkin``
2024-08-05 23:35:23 +02:00
Matthias Krüger
9cb3688f1f
Rollup merge of #128580 - compiler-errors:cfi-param-env, r=lcnr
Use `ParamEnv::reveal_all` in CFI

I left a huge comment for why this ICEs in the test I committed.

`typeid_for_instance` should only be called on monomorphic instances during codegen, and we should just be using `ParamEnv::reveal_all()` rather than the param-env of the instance itself. I added an assertion to ensure that we only do this for fully substituted instances (this may break with polymorphization, but I kinda don't care lol).

Fixes #114160
cc `@rcvalle`
2024-08-05 23:35:22 +02:00
Matthias Krüger
8cbf1c1b22
Rollup merge of #122049 - Amanieu:riscv64-musl-tier2, r=Mark-Simulacrum
Promote riscv64gc-unknown-linux-musl to tier 2
2024-08-05 23:35:22 +02:00
Ralf Jung
46896d6f66 interpret: move nullary-op evaluation into operator.rs 2024-08-05 22:42:34 +02:00
bors
e57f3090ae Auto merge of #128699 - RalfJung:miri-sync, r=RalfJung
Miri subtree update

r? `@ghost`
2024-08-05 20:22:35 +00:00
binarycat
4af77dfea5 implement BufReader::peek 2024-08-05 15:44:54 -04:00
Ralf Jung
f6edc8a07c update lockfile 2024-08-05 20:39:56 +02:00
Michael Goulet
c6f8672dd5 Normalize when equating dyn tails in MIR borrowck 2024-08-05 14:28:06 -04:00
Folkert
19679510c7
add test for symbol visibility of #[naked] functions 2024-08-05 19:55:35 +02:00
bors
a554f4d715 Auto merge of #3789 - RalfJung:deps, r=RalfJung
bump dependencies

In particular pick up https://github.com/RalfJung/rustc-build-sysroot/pull/22 to fix the fallout from https://github.com/rust-lang/rust/pull/128534.
2024-08-05 17:54:48 +00:00
Trevor Gross
c369c2034f
Add a triagebot mention for library/Cargo.lock
Since [1], `Cargo.lock` was split into `Cargo.lock` and
`library/Cargo.lock`. Update Triagebot to give the same warning for both.

[1]: https://github.com/rust-lang/rust/pull/128534
2024-08-05 12:39:35 -05:00
Ralf Jung
014fdb56b4 bump dependencies 2024-08-05 19:29:37 +02:00
bors
d1ad05a43a Auto merge of #3790 - RalfJung:ui-test-folder, r=RalfJung
use a Miri-specific folder for ui tests
2024-08-05 17:28:37 +00:00
Ralf Jung
b113bbec4f use a Miri-specific folder for ui tests 2024-08-05 19:25:56 +02:00
bors
f7eefec4e0 Auto merge of #128689 - matthiaskrgr:rollup-ukyn8wq, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #128385 (rustdoc-json: discard non-local inherent impls for primitives)
 - #128559 (Don't re-elaborated already elaborated caller bounds in method probe)
 - #128631 (handle crates when they are not specified for std docs)
 - #128664 (Add `Debug` impls to API types in `rustc_codegen_ssa`)
 - #128686 (fix the invalid argument type)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-05 17:03:58 +00:00
Ralf Jung
9213c6c93f bump rustc-build-sysroot dependency 2024-08-05 19:00:29 +02:00
Matthias Krüger
86798401df
Rollup merge of #128686 - onur-ozkan:unnecessary-type-cast, r=Kobzol
fix the invalid argument type

It was obviously wrong..
2024-08-05 18:36:03 +02:00
Matthias Krüger
48e47a6889
Rollup merge of #128664 - fuzzypixelz:add-codegen-ssa-debug-impls, r=lcnr
Add `Debug` impls to API types in `rustc_codegen_ssa`

Some types used in `rustc_codegen_ssa`'s interface traits are missing `Debug` impls. Though I did not smear `#[derive(Debug)]` all over the crate (some structs are quite large).
2024-08-05 18:36:02 +02:00
Matthias Krüger
9d924d11c4
Rollup merge of #128631 - onur-ozkan:hotfix, r=Mark-Simulacrum
handle crates when they are not specified for std docs

Fixes a regression from https://github.com/rust-lang/rust/pull/128182.

Resolves #128610
2024-08-05 18:36:02 +02:00
Matthias Krüger
63482af982
Rollup merge of #128559 - compiler-errors:elaborate, r=lcnr
Don't re-elaborated already elaborated caller bounds in method probe

Caller bounds are already elaborated. Only elaborate object candidates' principals.

Also removes the only usage of `transitive_bounds`.
2024-08-05 18:36:01 +02:00
Matthias Krüger
376a6f9f43
Rollup merge of #128385 - its-the-shrimp:fix_114039, r=aDotInTheVoid
rustdoc-json: discard non-local inherent impls for primitives

Fixes #114039
at least it should
r? `@aDotInTheVoid`
2024-08-05 18:36:01 +02:00
Ralf Jung
212417b87f custom MIR: add support for tail calls 2024-08-05 18:23:14 +02:00
onur-ozkan
ab690d31ce fix the invalid argument type in helpers::get_closest_merge_base_commit
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2024-08-05 17:55:42 +03:00
Michael Goulet
34e087890c Don't re-elaborated already elaborated caller bounds in method probe 2024-08-05 10:48:20 -04:00
bjorn3
e4e1b9b805 Remove the root Cargo.lock from the rust-src component
The Cargo.lock in library/ should be used instead. Including the
Cargo.lock for the root workspace is both unnecessary and confusing.
2024-08-05 14:43:17 +00:00
bors
2b78d92096 Auto merge of #124336 - compiler-errors:super-outlives, r=lcnr
Enforce supertrait outlives obligations hold when confirming impl

**TL;DR:** We elaborate super-predicates and apply any outlives obligations when proving an impl holds to fix a mismatch between implied bounds.

Bugs in implied bounds (and implied well-formedness) occur whenever there is a mismatch between the assumptions that some code can assume to hold, and the obligations that a caller/user of that code must prove. If the former is stronger than the latter, then unsoundness occurs.

Take a look at the example unsoundness:

```rust
use std::fmt::Display;

trait Static: 'static {}
impl<T> Static for &'static T {}
fn foo<S: Display>(x: S) -> Box<dyn Display>
where
    &'static S: Static,
{
    Box::new(x)
}

fn main() {
    let s = foo(&String::from("blah blah blah"));
    println!("{}", s);
}
```

This specific example occurs because we elaborate obligations in `fn foo`:

* `&'static S: Static`
    * `&'static S: 'static` <- super predicate
        * `S: 'static` <- elaborating outlives bounds

However, when calling `foo`, we only need to prove the direct set of where clauses. So at the call site for some substitution `S = &'not_static str`, that means only proving `&'static &'not_static str: Static`. To prove this, we apply the impl, which itself holds trivially since it has no where clauses.

This is the mismatch -- `foo` is allowed to assume that `S: 'static` via elaborating supertraits, but callers of `foo` never need to prove that `S: 'static`.

There are several approaches to fixing this, all of which have problems due to current limitations in our type system:
1. proving the elaborated set of predicates always - This leads to issues since we don't have coinductive trait semantics, so we easily hit new cycles.
    * This would fix our issue, since callers of `foo` would have to both prove `&'static &'not_static str: Static` and its elaborated bounds, which would surface the problematic `'not_static: 'static` outlives obligation.
    * However, proving supertraits when proving impls leads to inductive cycles which can't be fixed until we get coinductive trait semantics.
2. Proving that an impl header is WF when applying that impl:
    * This would fix our issue, since when we try to prove `&'static &'not_static str: Static`, we'd need to prove `WF(&'static &'not_static str)`, which would surface the problematic `'not_static: 'static` outlives obligation.
    * However, this leads to issues since we don't have higher-ranked implied bounds. This breaks things when trying to apply impls to higher-ranked trait goals.

To get around these limitations, we apply a subset of (1.), which is to elaborate the supertrait obligations of the impl but filter only the (region/type) outlives out of that set, since those can never participate in an inductive cycle. This is likely not sufficient to fix a pathological example of this issue, but it does clearly fill in a major gap that we're currently overlooking.

This can also result in 'unintended' errors due to missing implied-bounds on binders. We did not encounter this in the crater run and don't expect people to rely on this code in practice:
```rust
trait Outlives<'b>: 'b {}
impl<'b, T> Outlives<'b> for &'b T {}
fn foo<'b>()
where
    // This bound will break due to this PR as we end up proving
    // `&'b &'!a (): 'b` without the implied `'!a: 'b`
    // bound.
    for<'a> &'b &'a (): Outlives<'b>,
{}
```

Fixes #98117

---

Crater: https://github.com/rust-lang/rust/pull/124336#issuecomment-2209165320
Triaged: https://github.com/rust-lang/rust/pull/124336#issuecomment-2236321325

All of the fallout is due to generic const exprs, and can be ignored.
2024-08-05 14:39:32 +00:00
Oneirical
20332dae2f rewrite cdylib-dylib-linkage to rmake 2024-08-05 10:39:17 -04:00
Oneirical
011727f14e rewrite redundant-libs to rmake 2024-08-05 10:11:53 -04:00
Oneirical
f31f8c488a rewrite raw-dylib-c to rmake 2024-08-05 10:11:45 -04:00
Oneirical
131d453248 rewrite raw-dylib-alt-calling-conventions to rmake 2024-08-05 10:11:35 -04:00
Michael Goulet
fa9ae7b9d3 Elaborate supertraits in dyn candidates 2024-08-05 10:03:17 -04:00
Michael Goulet
6a891ec4fe Enforce supertrait outlives obligations hold when confirming impl 2024-08-05 09:55:14 -04:00
bors
83e9b93c90 Auto merge of #127095 - Oneirical:testiary-education, r=jieyouxu
Migrate `reproducible-build-2` and `stable-symbol-names` `run-make` tests to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Needs try-jobs.

try-job: x86_64-msvc
try-job: armhf-gnu
try-job: test-various
try-job: aarch64-apple
try-job: i686-msvc
try-job: x86_64-mingw
2024-08-05 12:16:05 +00:00
schvv31n
7499e21a1e rustdoc-json: discard non-local inherent impls 2024-08-05 11:19:22 +01:00
bors
9179d9b334 Auto merge of #117468 - daxpedda:wasm-relaxed-simd, r=alexcrichton
Stabilize Wasm relaxed SIMD

This PR stabilizes [Wasm relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) which has already reached [phase 4](04fa8c810e (phase-4---standardize-the-feature-wg)).

Tracking issue: #111196
Implementation PR: https://github.com/rust-lang/stdarch/pull/1393
Documentation: https://github.com/rust-lang/reference/pull/1421
Stdarch: https://github.com/rust-lang/stdarch/pull/1494

Closes #111196.
2024-08-05 09:25:50 +00:00
bors
5e944bb19c Auto merge of #3786 - RalfJung:rustup, r=RalfJung
Rustup
2024-08-05 09:08:06 +00:00
Ralf Jung
61463fd042 fmt 2024-08-05 11:06:36 +02:00
Ralf Jung
34aa09aa53 Merge from rustc 2024-08-05 11:06:36 +02:00
Ralf Jung
d28083728d Preparing for merge from rustc 2024-08-05 10:49:01 +02:00