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

Add an is_effect flag to GenericArgKind #118785

Closed
wants to merge 3 commits into from

Conversation

fee1-dead
Copy link
Member

@fee1-dead fee1-dead commented Dec 9, 2023

Which should help us prevent printing <false> (effects desugaring) in diagnostics.

r? @compiler-errors
cc @oli-obk

@fee1-dead fee1-dead marked this pull request as ready for review December 9, 2023 16:33
@rustbot
Copy link
Collaborator

rustbot commented Dec 9, 2023

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in need_type_info.rs

cc @lcnr

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Dec 9, 2023
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach is pretty invasive, and would rather we don't change every usage site of GenericArg::Const just to handle a printing bug.

I would much rather see the call to path_generic_args take an additional &[ty::GenericParamDef] so it can detect host-ness via that param instead. I think this is possible -- if you don't want to attempt this, please let me know, since I may be able to try it myself.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 9, 2023
@fee1-dead
Copy link
Member Author

I would much rather see the call to path_generic_args take an additional &[ty::GenericParamDef] so it can detect host-ness via that param instead. I think this is possible -- if you don't want to attempt this, please let me know, since I may be able to try it myself.

Sounds like a good approach. I probably won't have more time to work on this this weekend, so feel free to pick it up if you want.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 9, 2023

Could we add a lang item struct Effect(bool) that we'd use for the type of all effect consts and detect it that way without needing to change a lot?

@fee1-dead
Copy link
Member Author

Could we add a lang item struct Effect(bool) that we'd use for the type of all effect consts and detect it that way without needing to change a lot?

hmmm, so we can just see if the defid of the type of the const matches? sounds like a good idea too.

@fee1-dead fee1-dead marked this pull request as draft December 9, 2023 17:01
Comment on lines 127 to 131
if let ty::GenericParamDefKind::Const { is_host_effect: true, .. } = params[index].kind
{
return None;
}

This comment was marked as outdated.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-16 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Built container sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Looks like docker image is the same as before, not uploading
https://ci-caches.rust-lang.org/docker/7ebc15c01a233894034d277c8cce4e949f4e7791f66b4727c8fb6e058a0b8171d6152e1441d677cef0653843ceeee469c097b8699b2bb74249e674f6aa1a8813
sha256:9c3c93a371e5aed5c18185b24f130d95d5140dbd72a9b325e7b6b49e521a4faa
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-16]
##[group]Clock drift check
  local time: Sat Dec  9 17:00:21 UTC 2023
  network time: Sat, 09 Dec 2023 17:00:21 GMT
  network time: Sat, 09 Dec 2023 17:00:21 GMT
##[endgroup]
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-16', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-missing-tools', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-16/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: rust.codegen-units-std := 1
---
stdout: none
--- stderr -------------------------------
thread 'rustc' panicked at /checkout/tests/ui-fulldeps/stable-mir/check_defs.rs:50:5:
assertion `left == right` failed
  left: "from_u32::<true>"
 right: "from_u32"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
------------------------------------------

@oli-obk
Copy link
Contributor

oli-obk commented Dec 9, 2023

hmmm, so we can just see if the defid of the type of the const matches? sounds like a good idea too.

kind of, yea. we already have the adtflags that we can check for Box and UnsafeCell, adding another entry there should not be an issue if we have the bits left to do it

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 10, 2023
…-dead

Don't print host effect param in pretty `path_generic_args`

Make `own_args_no_defaults` pass back the `GenericParamDef`, so that we can pass both the args *and* param definitions into `path_generic_args`. That allows us to use the `GenericParamDef` to filter out effect params.

This allows us to filter out the host param regardless of whether it's `sym::host` or `true`/`false`.

This also renames a couple of `const_effect_param` -> `host_effect_param`, and restores `~const` pretty printing to `TraitPredPrintModifiersAndPath`.

cc rust-lang#118785
r? `@fee1-dead` cc `@oli-obk`
@bors
Copy link
Contributor

bors commented Dec 10, 2023

☔ The latest upstream changes (presumably #118788) made this pull request unmergeable. Please resolve the merge conflicts.

@fee1-dead fee1-dead closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants