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

Warn (or error) when Self ctor from outer item is referenced in inner nested item #124187

Merged
merged 2 commits into from
May 25, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 20, 2024

This implements a warning SELF_CONSTRUCTOR_FROM_OUTER_ITEM when a self constructor from an outer impl is referenced in an inner nested item. This is a proper fix mentioned #117246 (comment).

This warning is additionally bumped to a hard error when the self type references generic parameters, since it's almost always going to ICE, and is basically never correct to do.

This also reverts part of #117246, since I believe this is the proper fix and we shouldn't need the helper functions (opt_param_at/opt_type_param) any longer, since they shouldn't really ever be used in cases where we don't have this problem.

@rustbot
Copy link
Collaborator

rustbot commented Apr 20, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 Apr 20, 2024
@compiler-errors compiler-errors added the I-lang-nominated Nominated for discussion during a lang team meeting. label Apr 20, 2024
@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Copy link
Member

r? compiler

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

compiler-errors commented Apr 21, 2024

anyways ill fix ci but i guess it's worth testing for regressions

@bors try

@rust-timer

This comment was marked as off-topic.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2024
Warn (or error) when `Self` ctor from outer item is referenced in inner nested item

This implements a warning `SELF_CONSTRUCTOR_FROM_OUTER_ITEM` when a self constructor from an outer impl is referenced in an inner nested item. This is a proper fix mentioned rust-lang#117246 (comment).

This warning is additionally bumped to a hard error when the self type references generic parameters, since it's almost always going to ICE, and is basically *never* correct to do.

This also reverts part of rust-lang#117246, since I believe this is the proper fix and we shouldn't need the helper functions (`opt_param_at`/`opt_type_param`) any longer, since they shouldn't really ever be used in cases where we don't have this problem.
@bors
Copy link
Contributor

bors commented Apr 21, 2024

⌛ Trying commit e26ae7b with merge 773c42f...

@bors
Copy link
Contributor

bors commented Apr 21, 2024

☀️ Try build successful - checks-actions
Build commit: 773c42f (773c42f0166e62a538b8fa36161b0c6df69a9640)

@rust-timer

This comment has been minimized.

@compiler-errors
Copy link
Member Author

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-124187 created and queued.
🤖 Automatically detected try build 773c42f
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 21, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (773c42f): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -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
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 1
Improvements ✅
(primary)
-0.3% [-0.3%, -0.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.3% [-0.3%, -0.3%] 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)
8.5% [8.5%, 8.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 8.5% [8.5%, 8.5%] 1

Cycles

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

Binary size

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

Bootstrap: 671.572s -> 673.451s (0.28%)
Artifact size: 315.28 MiB -> 315.21 MiB (-0.02%)

@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 21, 2024

r? compiler

@rfcbot rfcbot added to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels May 18, 2024
@rfcbot
Copy link

rfcbot commented May 18, 2024

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@compiler-errors
Copy link
Member Author

@rustbot ready

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 18, 2024
…explain`"

This mostly reverts commit 7449478.
It also removes an `opt_param_at` that really is unnecessary given our
ICE policy for malformed intrinsics.
@petrochenkov petrochenkov removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label May 22, 2024
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 24, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 24, 2024

📌 Commit a25bb5f has been approved by petrochenkov

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 May 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 24, 2024
…enkov

Warn (or error) when `Self` ctor from outer item is referenced in inner nested item

This implements a warning `SELF_CONSTRUCTOR_FROM_OUTER_ITEM` when a self constructor from an outer impl is referenced in an inner nested item. This is a proper fix mentioned rust-lang#117246 (comment).

This warning is additionally bumped to a hard error when the self type references generic parameters, since it's almost always going to ICE, and is basically *never* correct to do.

This also reverts part of rust-lang#117246, since I believe this is the proper fix and we shouldn't need the helper functions (`opt_param_at`/`opt_type_param`) any longer, since they shouldn't really ever be used in cases where we don't have this problem.
@bors
Copy link
Contributor

bors commented May 24, 2024

⌛ Testing commit a25bb5f with merge 0958c05...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
 mingw-w64-x86_64-gcc-ada-13.2.0-3-any downloading...
 mingw-w64-x86_64-gcc-objc-13.2.0-3-any downloading...
error: failed retrieving file 'mingw-w64-x86_64-gdb-14.1-1-any.pkg.tar.zst' from mirror.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
warning: too many errors from mirror.msys2.org, skipping for the remainder of this transaction
error: failed retrieving file 'mingw-w64-x86_64-gcc-objc-13.2.0-3-any.pkg.tar.zst.sig' from mirror.umd.edu : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds
error: failed to commit transaction (unexpected error)
 mingw-w64-x86_64-gcc-fortran-13.2.0-3-any downloading...
 mingw-w64-x86_64-libgccjit-13.2.0-3-any downloading...
 mingw-w64-x86_64-openssl-3.2.0-1-any downloading...

@bors
Copy link
Contributor

bors commented May 24, 2024

💔 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 May 24, 2024
@petrochenkov
Copy link
Contributor

@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 May 25, 2024
@bors
Copy link
Contributor

bors commented May 25, 2024

⌛ Testing commit a25bb5f with merge 21e6de7...

@bors
Copy link
Contributor

bors commented May 25, 2024

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 21e6de7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 25, 2024
@bors bors merged commit 21e6de7 into rust-lang:master May 25, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 25, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (21e6de7): 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
Regressions ❌
(secondary)
0.9% [0.9%, 0.9%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

Cycles

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

Binary size

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

Bootstrap: 672.177s -> 672.624s (0.07%)
Artifact size: 315.55 MiB -> 315.72 MiB (0.05%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. 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. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.