Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #98442

Closed
wants to merge 23 commits into from
Closed

Conversation

JohnTitor
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

mkroening and others added 23 commits June 1, 2022 23:13
This moves us a step closer to removing the `PartialOrd/`Ord` impls
for `DefId`. See rust-lang#90317
When cross compiling LLVM on an arm64 machine to x86_64, CMake will
produce universal binaries by default, causing link errors. Explicitly
set CMAKE_OSX_ARCHITECTURES to the one single target architecture.
When cross compiling rustc with `llvm.clang = true`, CLANG_TABLEGEN
has to be set to the host clang-tblgen executable to build clang.
…=jsha

Add macro support in jump to definition feature

Fixes rust-lang#91174.

To do so, I check if the span comes from an expansion, and if so, I infer the original macro `DefId` or `Span` depending if it's a defined in the current crate or not.

There is one limitation due to macro expansion though:

```rust
macro_rules! yolo { () => {}}

fn foo() {
    yolo!();
}
```

In `foo`, `yolo!` won't be linked because after expansion, it is replaced by nothing (which seems logical). So I can't get an item from the `Visitor` from which I could tell if its `Span` comes from an expansion.

I added a test for this specific limitation alongside others.

Demo: https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html

As for the empty macro issue that cannot create a jump to definition, you can see it [here](https://rustdoc.crud.net/imperio/macro-jump-to-def/src/foo/check-source-code-urls-to-def-std.rs.html#35).

r? ``@jyn514``
…ochenkov

Remove (transitive) reliance on sorting by DefId in pretty-printer

This moves us a step closer to removing the `PartialOrd/`Ord` impls
for `DefId`. See rust-lang#90317
Fix `panic` message for `BTreeSet`'s `range` API and document `panic` cases

Currently, the `panic` cases for [`BTreeSet`'s `range` API](https://doc.rust-lang.org/std/collections/struct.BTreeSet.html#method.range) are undocumented and produce a slightly wrong `panic` message (says `BTreeMap` instead of `BTreeSet`).

Panic case 1 code:

```rust
use std::collections::BTreeSet;
use std::ops::Bound::Excluded;

fn main() {
    let mut set = BTreeSet::new();
    set.insert(3);
    set.insert(5);
    set.insert(8);

    for &elem in set.range((Excluded(&3), Excluded(&3))) {
        println!("{elem}");
    }
}
```

Panic case 1 message:

```
thread 'main' panicked at 'range start and end are equal and excluded in BTreeMap', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/collections/btree/search.rs:105:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Panic case 2 code:

```rust
use std::collections::BTreeSet;
use std::ops::Bound::Included;

fn main() {
    let mut set = BTreeSet::new();
    set.insert(3);
    set.insert(5);
    set.insert(8);

    for &elem in set.range((Included(&8), Included(&3))) {
        println!("{elem}");
    }
}
```

Panic case 2:

```
thread 'main' panicked at 'range start is greater than range end in BTreeMap', /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/alloc/src/collections/btree/search.rs:110:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

This PR fixes the output messages to say `BTreeSet`, adds the relevant unit tests, and updates the documentation for the API.
rustc_target: Remove some redundant target properties

`is_like_emscripten` is equivalent to `os == "emscripten"`, so it's removed.
`is_like_fuchsia` is equivalent to `os == "fuchsia"`, so it's removed.
`is_like_osx` also falls into the same category and is equivalent to `vendor == "apple"`, but it's commonly used so I kept it as is for now.

`is_like_(solaris,windows,wasm)` are combinations of different operating systems or architectures (see compiler/rustc_target/src/spec/tests/tests_impl.rs) so they are also kept as is.

I think `is_like_wasm` (and maybe `is_like_osx`) are sufficiently closed sets, so we can remove these fields as well and replace them with methods like `fn is_like_wasm() { arch == "wasm32" || arch == "wasm64" }`.
On other hand, `is_like_solaris` and `is_like_windows` are sufficiently open and I can imagine custom targets introducing other values for `os`.
This is kind of a gray area.
…-on-type-err, r=estebank

Improve suggestion for calling fn-like expr on type mismatch

1.) Suggest calling values of with RPIT types (and probably TAIT) when we expect `Ty` and have `impl Fn() -> Ty`
2.) Suggest calling closures even when they're not assigned to a local variable first
3.) Drive-by fix of a pretty-printing bug (`impl Fn()-> Ty` => `impl Fn() -> Ty`)

r? ``@estebank``
Fix several issues during cross compiling

- When cross compiling LLVM on an arm64 macOS machine to x86_64, CMake will produce universal binaries by default, causing link errors. Explicitly set `CMAKE_OSX_ARCHITECTURES` to the one single target architecture so that the executables and libraries will be single architecture.
- When cross compiling rustc with `llvm.clang = true`, `CLANG_TABLEGEN` has to be set to the host `clang-tblgen` executable to build clang.
…ompiler-errors

Remove excess rib while resolving closures

I've mentioned this on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60ClosureOrAsyncRibKind.60.20weirdness/near/286982959), in `rustc_resolve`, while resolving closures we add an excess `ClosureOrAsyncRibKind`. It's excess because we later add another one in `visit_fn`.

I couldn't find a way in which removing this will break anything, all test seem to pass, etc.

r? `@compiler-errors`
cc `@davidtwco`
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jun 24, 2022
@JohnTitor
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Contributor

bors commented Jun 24, 2022

📌 Commit 3c62245 has been approved by JohnTitor

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 24, 2022
@bors
Copy link
Contributor

bors commented Jun 24, 2022

⌛ Testing commit 3c62245 with merge 7ec3cf17b3759ffca8186d1b1d75f25e857532a1...

@bors
Copy link
Contributor

bors commented Jun 24, 2022

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 24, 2022
@JohnTitor JohnTitor closed this Jun 24, 2022
@JohnTitor JohnTitor deleted the rollup-9g6t582 branch June 24, 2022 07:43
@rust-log-analyzer
Copy link
Collaborator

The job dist-aarch64-msvc failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[128/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Constants.cpp.obj
[129/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Core.cpp.obj
[130/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\IRPrintingPasses.cpp.obj
[131/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\GCStrategy.cpp.obj
[132/3009] Configuring NATIVE LLVM...
FAILED: NATIVE/CMakeCache.txt D:/a/rust/rust/build/aarch64-pc-windows-msvc/llvm/build/NATIVE/CMakeCache.txt 
cmd.exe /C "cd /D D:\a\rust\rust\build\aarch64-pc-windows-msvc\llvm\build\NATIVE && "C:\Program Files\CMake\bin\cmake.exe" -G Ninja -DCMAKE_MAKE_PROGRAM="D:/a/rust/rust/ninja/ninja.exe" -DCMAKE_C_COMPILER_LAUNCHER="" -DCMAKE_CXX_COMPILER_LAUNCHER="" -DCMAKE_C_COMPILER=D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe -DCMAKE_CXX_COMPILER=D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe D:/a/rust/rust/src/llvm-project/llvm -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE -DLLVM_TARGETS_TO_BUILD="AArch64;ARM;BPF;Hexagon;MSP430;Mips;NVPTX;PowerPC;RISCV;Sparc;SystemZ;WebAssembly;X86;AVR;M68k" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR;M68k" -DLLVM_DEFAULT_TARGET_TRIPLE="aarch64-pc-windows-msvc" -DLLVM_TARGET_ARCH="aarch64" -DLLVM_ENABLE_PROJECTS="" -DLLVM_EXTERNAL_PROJECTS="" -DLLVM_ENABLE_RUNTIMES="" -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="OFF" -DCMAKE_BUILD_TYPE=Release"
-- The CXX compiler identification is Clang 14.0.1 with MSVC-like command-line
-- The ASM compiler identification is Clang with MSVC-like command-line
-- Found assembler: D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe
-- Check for working C compiler: D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):

    "D:/a/rust/rust/build/bootstrap/debug/sccache-plus-cl.exe"

  is not able to compile a simple test program.
  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/a/rust/rust/build/aarch64-pc-windows-msvc/llvm/build/NATIVE/CMakeFiles/CMakeTmp
    
    Run Build Command(s):D:/a/rust/rust/ninja/ninja.exe cmTC_51d30 && [1/2] Building C object CMakeFiles\cmTC_51d30.dir\testCCompiler.c.obj

    [2/2] Linking C executable cmTC_51d30.exe

    FAILED: cmTC_51d30.exe 

    cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_51d30.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100220~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\arm64\link.exe /nologo CMakeFiles\cmTC_51d30.dir\testCCompiler.c.obj  /out:cmTC_51d30.exe /implib:cmTC_51d30.lib /pdb:cmTC_51d30.pdb /version:0.0 /machine:x64  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."

    LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2019\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\Hostx64\arm64\link.exe /nologo CMakeFiles\cmTC_51d30.dir\testCCompiler.c.obj /out:cmTC_51d30.exe /implib:cmTC_51d30.lib /pdb:cmTC_51d30.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\cmTC_51d30.dir/intermediate.manifest CMakeFiles\cmTC_51d30.dir/manifest.res" failed (exit code 1120) with the following output:

    LINK : error LNK2001: unresolved external symbol mainCRTStartup


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\kernel32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\user32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\gdi32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\winspool.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\shell32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\ole32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\oleaut32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\uuid.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\comdlg32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Windows Kits\10\lib\10.0.22000.0\um\arm64\advapi32.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\lib\arm64\msvcrtd.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\lib\arm64\oldnames.lib : warning LNK4272: library machine type 'ARM64' conflicts with target machine type 'x64'


    cmTC_51d30.exe : fatal error LNK1120: 1 unresolved externals


    ninja: build stopped: subcommand failed.
    
    

  
  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:49 (project)


-- Configuring incomplete, errors occurred!
See also "D:/a/rust/rust/build/aarch64-pc-windows-msvc/llvm/build/NATIVE/CMakeFiles/CMakeOutput.log".
See also "D:/a/rust/rust/build/aarch64-pc-windows-msvc/llvm/build/NATIVE/CMakeFiles/CMakeError.log".
[134/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\InlineAsm.cpp.obj
[135/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Globals.cpp.obj
[136/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Instruction.cpp.obj
[137/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Instructions.cpp.obj
[137/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Instructions.cpp.obj
[138/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\Dominators.cpp.obj
[139/3009] Building CXX object lib\IR\CMakeFiles\LLVMCore.dir\IntrinsicInst.cpp.obj
ninja: build stopped: subcommand failed.
command did not execute successfully, got: exit code: 1


build script failed, must exit now', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.44\src\lib.rs:885:5
 finished in 53.971 seconds
Build completed unsuccessfully in 0:29:32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.