Skip to content

Move Fn* traits malformedness protections to typeck #108138

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

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Feb 16, 2023

I found it strange that we were doing a custom well-formedness check just for the Fn* traits' call_* fn items. My understanding from the git history is that this is just to avoid ICEs later on in typeck.

Well, that well-formedness check isn't even implemented correctly for FnOnce::call_once, or FnMut::call_mut for that matter. Instead, this PR just makes the typeck checks more robust, and leaves it up to the call-site to report errors when lang items are implemented in funny ways.

This coincidentally fixes another ICE where a the Add lang item is implemented with a add item that's a const instead of a method.

@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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. labels Feb 16, 2023
@TaKO8Ki
Copy link
Member

TaKO8Ki commented Feb 19, 2023

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Feb 19, 2023

📌 Commit 2a700d4 has been approved by TaKO8Ki

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 19, 2023
@compiler-errors
Copy link
Member Author

@bors rollup- not convinced this needs to be rolled up always

@bors
Copy link
Collaborator

bors commented Feb 20, 2023

⌛ Testing commit 2a700d4 with merge a8db02805ba30bf2063281d42930c63b75622890...

@bors
Copy link
Collaborator

bors commented Feb 20, 2023

💔 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 Feb 20, 2023
@compiler-errors
Copy link
Member Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 20, 2023
@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
[2561/3021] Building CXX object utils/UnicodeData/CMakeFiles/UnicodeNameMappingGenerator.dir/UnicodeNameMappingGenerator.cpp.obj
[2562/3021] Linking CXX static library lib\libLLVMInstrumentation.a
[2563/3021] Linking CXX static library lib\libLLVMAggressiveInstCombine.a
[2564/3021] Linking CXX static library lib\libLLVMVectorize.a
FAILED: lib/libLLVMVectorize.a 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E rm -f lib\libLLVMVectorize.a && D:\a\rust\rust\mingw32\bin\ar.exe qc lib\libLLVMVectorize.a  lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/LoadStoreVectorizer.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/LoopVectorizationLegality.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/LoopVectorize.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/SLPVectorizer.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/Vectorize.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VectorCombine.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlan.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanHCFGBuilder.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanRecipes.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanSLP.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanTransforms.cpp.obj lib/Transforms/Vectorize/CMakeFiles/LLVMVectorize.dir/VPlanVerifier.cpp.obj && D:\a\rust\rust\mingw32\bin\ranlib.exe lib\libLLVMVectorize.a && cd ."
D:\a\rust\rust\mingw32\bin\ar.exe: could not create temporary file whilst writing archive: no more archived files
[2565/3021] Linking CXX static library lib\libLLVMObjCARCOpts.a
[2566/3021] Building CXX object utils/yaml-bench/CMakeFiles/yaml-bench.dir/YAMLBench.cpp.obj
[2567/3021] Linking CXX static library lib\libLLVMInstCombine.a
[2568/3021] Linking CXX executable bin\llvm-PerfectShuffle.exe
[2568/3021] Linking CXX executable bin\llvm-PerfectShuffle.exe
[2569/3021] Linking CXX executable bin\FileCheck.exe
[2570/3021] Building CXX object utils/not/CMakeFiles/not.dir/not.cpp.obj
[2571/3021] Building CXX object tools/lto/CMakeFiles/LTO.dir/lto.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\index.crates.io-1cd66030c949c28d\cmake-0.1.48\src\lib.rs:975:5
 finished in 230.533 seconds
Build completed unsuccessfully in 0:06:35

@bors
Copy link
Collaborator

bors commented Feb 21, 2023

⌛ Testing commit 2a700d4 with merge 3200982...

@bors
Copy link
Collaborator

bors commented Feb 21, 2023

☀️ Test successful - checks-actions
Approved by: TaKO8Ki
Pushing 3200982 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 21, 2023
@bors bors merged commit 3200982 into rust-lang:master Feb 21, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 21, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3200982): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 1
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

@compiler-errors compiler-errors deleted the malformed-fn-trait branch August 11, 2023 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants