Update cargo
3 commits in fa646583675d7c140482bd906145c71b7fb4fc2b..94977cb1fab003d45eb5bb108cb5e2fa0149672a
2024-08-02 16:08:06 +0000 to 2024-08-06 21:42:10 +0000
- Don't specify the depedency name in the `cargo add` inferred name test (rust-lang/cargo#14357)
- Fix renamed disallowed cfg lint name (rust-lang/cargo#14352)
- fix(build-std): remove hack on creating virtual std workspace (rust-lang/cargo#14358)
r? ghost
Trivial grammar fix in const keyword docs
This PR makes a trivial fix to the wording of a sentence in the `const` keyword docs.
> `const` items looks remarkably similar to `static` items, [...]
Either this should be written as
> A `const` items looks remarkably similar to a `static` item, [...]
or "looks" should be changed to "look".
I have selected the smaller diff.
run-make: Enable msvc for `no-duplicate-libs` and `zero-extend-abi-param-passing`
The common thing between these two tests is to use `#[link(..., kind="static")]` so that it doesn't try to do a DLL import.
`zero-extend-abi-param-passing` also needs to have an optimized static library but there's only helper function for a non-optimized version. Rather than copy/pasting the code (and adding the optimization flag) I reused the same code so that it more easily be kept in sync.
try-job: i686-msvc
try-job: x86_64-msvc
Enable msvc for link-args-order
I could not see any reason in #70665 why this test needs to specifically use `ld`. Maybe to provide a consistent linker input line? In any case, the test does work for the MSVC linker.
try-job: i686-msvc
try-job: x86_64-msvc
run-make: enable msvc for `link-dedup`
This is just a case of differing style of linker arguments.
I also cleaned up a bit where we were running the same command three times in a row. Instead I reused the output.
One thing that confused me is why we were testing for the same lib three times in a row but not two. After figuring that out I added a note to hopefully save future readers some confusion.
try-job: x86_64-msvc
try-job: i686-msvc
Add `f16` and `f128` math functions
This adds intrinsics and math functions for `f16` and `f128` floating point types. Support is quite limited and some things are broken so tests don't run on many platforms, but this provides a starting point.
add test for symbol visibility of `#[naked]` functions
tracking issue: #90957
This test is extracted from https://github.com/rust-lang/rust/pull/128004
That PR attempts to generated naked functions as an extern function declaration, combined with a global asm block that provides the implementation for that declaration.
In order to link declaration and definition together, some flavor of external linking must be used: LLVM will error for other linkage types. Specifically the allowed options are `#[linkage = "external"]` and `#[linkage = "extern_weak"]`. That is kind of an implementation detail though: to the user, a naked function should just behave like a normal function.
Hence it should be visible to the linker under the same circumstances as a normal, vanilla function and have the same attributes (Weak, External). Getting this behavior right will require some care, so I think it's a good idea to lock it in now, before making any changes, to make sure we don't regress.
Are there any interesting cases that I missed here? E.g. is checking on different architectures worth it? I don't think the other binary types (rlib etc) are relevant here, but may be missing something.
r? ``@bjorn3``
Migrate `raw-dylib-alt-calling-convention`, `raw-dylib-c` and `redundant-libs` `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).
Please try:
// try-job: x86_64-msvc
// try-job: x86_64-mingw
// try-job: i686-msvc
try-job: x86_64-gnu-llvm-17
try-job: aarch64-apple
> `const` items looks remarkably similar to `static` items, [...]
Either this should be written as
> A `const` items looks remarkably similar to a `static` item,
or "looks" should be changed to "look".
I have selected the smaller diff.
Don't ICE when getting an input file name's stem fails
Fixes#128681
The file stem is only used as a user-friendly prefix on intermediary files. While nice to have, it's not the end of the world if it fails so there's no real reason to emit an error here. We can continue with a fixed name as we do when an anonymous string is used.
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
interpret: refactor function call handling to be better-abstracted
Add a new function `init_stack_frame` that pushes a stack frame and passes the arguments, and use that basically everywhere that the raw underlying `push_stack_frame` used to be called. This splits the previous monster function `eval_fn_call` into two parts: figuring out the MIR to call and the arguments to pass, and then actually setting up the stack frame.
Also re-organize the files a bit:
- The previous `terminator.rs` is split into a new `call.rs` with all the argument-passing logic, and the rest goes into `step.rs` where the other main dispatcher functions already live (in particular, `eval_statement`).
- All the stack frame handling from `eval_context.rs` is moved to a new `stack.rs`.
Forbid unused unsafe in vxworks-specific std modules
Tracking issue #127747
Adding deny(unsafe_op_in_unsafe_fn) in VxWorks specific files did not cause any error.
Most of VxWorks falls back on Unix libraries. So we'll have to wait for Unix changes.
r? ```@workingjubilee```
On trait bound mismatch, detect multiple crate versions in dep tree
When encountering an E0277, if the type and the trait both come from a crate with the same name but different crate number, we explain that there are multiple crate versions in the dependency tree.
If there's a type that fulfills the bound, and it has the same name as the passed in type and has the same crate name, we explain that the same type in two different versions of the same crate *are different*.
```
error[E0277]: the trait bound `Type: dependency::Trait` is not satisfied
--> src/main.rs:4:18
|
4 | do_something(Type);
| ------------ ^^^^ the trait `dependency::Trait` is not implemented for `Type`
| |
| required by a bound introduced by this call
|
help: you have multiple different versions of crate `dependency` in your dependency graph
--> src/main.rs:1:5
|
1 | use bar::do_something;
| ^^^ one version of crate `dependency` is used here, as a dependency of crate `bar`
2 | use dependency::Type;
| ^^^^^^^^^^ one version of crate `dependency` is used here, as a direct dependency of the current crate
note: two types coming from two different versions of the same crate are different types even if they look the same
--> /home/gh-estebank/crate_versions/baz-2/src/lib.rs:1:1
|
1 | pub struct Type;
| ^^^^^^^^^^^^^^^ this type doesn't implement the required trait
|
::: /home/gh-estebank/crate_versions/baz/src/lib.rs:1:1
|
1 | pub struct Type;
| ^^^^^^^^^^^^^^^ this type implements the required trait
2 | pub trait Trait {}
| --------------- this is the required trait
note: required by a bound in `bar::do_something`
--> /home/gh-estebank/crate_versions/baz/src/lib.rs:4:24
|
4 | pub fn do_something<X: Trait>(_: X) {}
| ^^^^^ required by this bound in `do_something`
```
Address #22750.
Rollup of 7 pull requests
Successful merges:
- #128369 (rustc_lint: make `let-underscore-lock` translatable)
- #128377 (Fix ICE Caused by Incorrectly Delaying E0107)
- #128517 (Fallback to string formatting if source is not available for lint)
- #128685 (Remove the root Cargo.lock from the rust-src component)
- #128693 (rustdoc-search: account for numeric disambiguators on impls)
- #128720 (Pass the right `ParamEnv` to `might_permit_raw_init_strict`)
- #128736 (Fix rustdoc missing handling of remap-path-prefix option)
r? `@ghost`
`@rustbot` modify labels: rollup
Pass the right `ParamEnv` to `might_permit_raw_init_strict`
Fixes#119620
`might_permit_raw_init_strict` currently passes an empty `ParamEnv` to the `InterpCx`, instead of the actual `ParamEnv` that was passed in to `check_validity_requirement` at callsite.
This leads to ICEs such as the linked issue where for `UnsafeCell<*mut T>` we initially get the layout with the right `ParamEnv` (which suceeds because it can prove that `T: Sized` and therefore `UnsafeCell<*mut T>` has a known layout) but then do the rest with an empty `ParamEnv` where `T: Sized` is not known to hold so getting the layout for `*mut T` later fails.
This runs into an assertion in other layout code where it's making the (valid) assumption that, when we already have a layout for a struct (`UnsafeCell<*mut T>`), getting the layout of one of its fields (`*mut T`) should also succeed, which wasn't the case here due to using the wrong `ParamEnv`.
So, this PR changes it to just use the same `ParamEnv` all the way throughout.
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.
Missed in https://github.com/rust-lang/rust/pull/128534
Fix ICE Caused by Incorrectly Delaying E0107
Fixes #128249
For the following code:
```rust
trait Foo<T> {}
impl Foo<T: Default> for u8 {}
```
#126054 added some logic to delay emitting E0107 as the names of associated type `T` in the impl header and generic parameter `T` in `trait Foo` match.
But it failed to ensure whether such unexpected associated type bounds are coming from a impl block header. This caused an ICE as the compiler was delaying E0107 for code like:
```rust
trait Trait<Type> {
type Type;
fn method(&self) -> impl Trait<Type: '_>;
}
```
because it assumed the associated type bound `Type: '_` is for the generic parameter `Type` in `trait Trait` since the names are same.
This PR adds a check to ensure that E0107 is delayed only in the context of impl block header.
When encountering an E0277, if the type and the trait both come from a crate with the same name but different crate number, we explain that there are multiple crate versions in the dependency tree.
If there's a type that fulfills the bound, and it has the same name as the passed in type and has the same crate name, we explain that the same type in two different versions of the same crate *are different*.
```
error[E0277]: the trait bound `Type: dependency::Trait` is not satisfied
--> src/main.rs:4:18
|
4 | do_something(Type);
| ------------ ^^^^ the trait `dependency::Trait` is not implemented for `Type`
| |
| required by a bound introduced by this call
|
help: you have multiple different versions of crate `dependency` in your dependency graph
--> src/main.rs:1:5
|
1 | use bar::do_something;
| ^^^ one version of crate `dependency` is used here, as a dependency of crate `bar`
2 | use dependency::Type;
| ^^^^^^^^^^ one version of crate `dependency` is used here, as a direct dependency of the current crate
note: two types coming from two different versions of the same crate are different types even if they look the same
--> /home/gh-estebank/crate_versions/baz-2/src/lib.rs:1:1
|
1 | pub struct Type;
| ^^^^^^^^^^^^^^^ this type doesn't implement the required trait
|
::: /home/gh-estebank/crate_versions/baz/src/lib.rs:1:1
|
1 | pub struct Type;
| ^^^^^^^^^^^^^^^ this type implements the required trait
2 | pub trait Trait {}
| --------------- this is the required trait
note: required by a bound in `bar::do_something`
--> /home/gh-estebank/crate_versions/baz/src/lib.rs:4:24
|
4 | pub fn do_something<X: Trait>(_: X) {}
| ^^^^^ required by this bound in `do_something`
```
Address #22750.
Migrate `cdylib-dylib-linkage` `run-make` test 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).
~~Those sysroot tests are always fun. I'm getting local errors that don't make a lot of sense about my own sysroot not existing, so I am trying this in CI to see what happens.~~
~~EDIT: I am getting the same error here. The strange thing is, when I try to navigate to `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib` on my personal computer, the directory does exist, but the error message is that the directory does not.~~
EDIT 2: The sysroot path just needed to be trimmed!
Please try:
// try-job: x86_64-msvc // passed previously
try-job: x86_64-mingw
try-job: x86_64-gnu-llvm-18
try-job: i686-msvc
try-job: aarch64-apple
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.