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

TAIT feature is broken #126387

Closed
Sherlock-Holo opened this issue Jun 13, 2024 · 10 comments
Closed

TAIT feature is broken #126387

Sherlock-Holo opened this issue Jun 13, 2024 · 10 comments
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]`

Comments

@Sherlock-Holo
Copy link

Code

try to build my project with nightly rust

  • clone this project
  • checkout to commit 3081600eb64eb3ebf4432b85db58fea85072fc6e
  • cd server
  • cargo clippy or cargo build

I expected to see this happen: build success

Instead, this happened: build failed, with error message like

error: item does not constrain `server::TokioTcpAcceptor::{opaque#0}`, but has it in its signature
  --> server/src/server.rs:61:18
   |
61 |     pub async fn start(self) -> Result<(), Error> {
   |                  ^^^^^
   |
   = note: consider moving the opaque type's declaration and defining uses into a separate module
note: this opaque type is in the signature
  --> server/src/server.rs:19:25
   |
19 | type TokioTcpAcceptor = impl Stream<Item = io::Result<TokioTcp>> + Send + Unpin;

Version it worked on

It most recently worked on:

Version with regression

cargo bisect-rustc report

cking nightly-2024-06-13 from the currently installed default nightly toolchain as the last failure
checking the start range to find a passing nightly
installing nightly-2024-06-13
testing...
RESULT: nightly-2024-06-13, ===> Yes
uninstalling nightly-2024-06-13

checking the start range to find a passing nightly
installing nightly-2024-06-11
rust-std-nightly-x86_64-unknown-linux-gnu: 26.72 MB / 26.72 MB [================================================================================] 100.00 % 3.71 MB/s testing...
RESULT: nightly-2024-06-11, ===> No
uninstalling nightly-2024-06-11

checking the end range to verify it does not pass
installing nightly-2024-06-13
testing...
RESULT: nightly-2024-06-13, ===> Yes
uninstalling nightly-2024-06-13

1 versions remaining to test after this (roughly 1 steps)
installing nightly-2024-06-12
rust-std-nightly-x86_64-unknown-linux-gnu: 26.66 MB / 26.66 MB [================================================================================] 100.00 % 3.65 MB/s testing...
RESULT: nightly-2024-06-12, ===> No
uninstalling nightly-2024-06-12

searched toolchains nightly-2024-06-11 through nightly-2024-06-13
checking last toolchain to determine final result
installing nightly-2024-06-13
testing...
uninstalling nightly-2024-06-13


********************************************************************************
Regression in nightly-2024-06-13
********************************************************************************

fetching https://static.rust-lang.org/dist/2024-06-12/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-06-12: 40 B / 40 B [======================================================================================================] 100.00 % 1.36 MB/s converted 2024-06-12 to d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04
fetching https://static.rust-lang.org/dist/2024-06-13/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-06-13: 40 B / 40 B [====================================================================================================] 100.00 % 846.88 KB/s converted 2024-06-13 to 8337ba9189de188e2ed417018af2bf17a57d51ac
looking for regression commit between 2024-06-12 and 2024-06-13
fetching (via remote github) commits from max(d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04, 2024-06-10) to 8337ba9189de188e2ed417018af2bf17a57d51ac
ending github query because we found starting sha: d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04
get_commits_between returning commits, len: 11
  commit[0] 2024-06-11: Auto merge of #125174 - nnethercote:less-ast-pretty-printing, r=petrochenkov
  commit[1] 2024-06-11: Auto merge of #126284 - jieyouxu:rollup-nq7bf9k, r=jieyouxu
  commit[2] 2024-06-12: Auto merge of #123508 - WaffleLapkin:never-type-2024, r=compiler-errors
  commit[3] 2024-06-12: Auto merge of #126130 - compiler-errors:goal-relations, r=lcnr
  commit[4] 2024-06-12: Auto merge of #126290 - weihanglo:update-cargo, r=weihanglo
  commit[5] 2024-06-12: Auto merge of #113169 - oli-obk:tait_must_be_constrained_if_in_sig, r=lcnr
  commit[6] 2024-06-12: Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee
  commit[7] 2024-06-12: Auto merge of #125141 - SergioGasquez:feat/no_std-xtensa, r=davidtwco
  commit[8] 2024-06-12: Auto merge of #126332 - GuillaumeGomez:rollup-bu1q4pz, r=GuillaumeGomez
  commit[9] 2024-06-12: Auto merge of #126273 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
  commit[10] 2024-06-12: Auto merge of #126345 - compiler-errors:rollup-lue8u92, r=compiler-errors
validated commits found, specifying toolchains

checking the start range to verify it passes
installing d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04
rust-std-nightly-x86_64-unknown-linux-gnu: 27.56 MB / 27.56 MB [================================================================================] 100.00 % 3.99 MB/s testing...
RESULT: d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04, ===> No
uninstalling d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04

checking the end range to verify it does not pass
installing 8337ba9189de188e2ed417018af2bf17a57d51ac
rust-std-nightly-x86_64-unknown-linux-gnu: 27.60 MB / 27.60 MB [================================================================================] 100.00 % 3.59 MB/s testing...
RESULT: 8337ba9189de188e2ed417018af2bf17a57d51ac, ===> Yes
uninstalling 8337ba9189de188e2ed417018af2bf17a57d51ac

5 versions remaining to test after this (roughly 3 steps)
installing 02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1
rust-std-nightly-x86_64-unknown-linux-gnu: 27.60 MB / 27.60 MB [================================================================================] 100.00 % 4.01 MB/s testing...
RESULT: 02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1, ===> Yes
uninstalling 02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1

3 versions remaining to test after this (roughly 2 steps)
installing 9a7bf4ae947feddac27007cbe26d161f4ff5a910
rust-std-nightly-x86_64-unknown-linux-gnu: 27.59 MB / 27.59 MB [================================================================================] 100.00 % 3.84 MB/s testing...
RESULT: 9a7bf4ae947feddac27007cbe26d161f4ff5a910, ===> No
uninstalling 9a7bf4ae947feddac27007cbe26d161f4ff5a910

2 versions remaining to test after this (roughly 2 steps)
installing 76c73827dcd0b363e60b22c3cef64bde4171bf17
rust-std-nightly-x86_64-unknown-linux-gnu: 27.58 MB / 27.58 MB [================================================================================] 100.00 % 3.84 MB/s testing...
RESULT: 76c73827dcd0b363e60b22c3cef64bde4171bf17, ===> No
uninstalling 76c73827dcd0b363e60b22c3cef64bde4171bf17

1 versions remaining to test after this (roughly 1 steps)
installing bdb1b7f5d9715cc96cb437134eff93fa229defd1
rust-std-nightly-x86_64-unknown-linux-gnu: 27.60 MB / 27.60 MB [================================================================================] 100.00 % 4.18 MB/s testing...
RESULT: bdb1b7f5d9715cc96cb437134eff93fa229defd1, ===> No
uninstalling bdb1b7f5d9715cc96cb437134eff93fa229defd1

searched toolchains d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04 through 8337ba9189de188e2ed417018af2bf17a57d51ac


********************************************************************************
Regression in 02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1
********************************************************************************

Attempting to search unrolled perf builds
ERROR: error: url <https://api.github.com/repos/rust-lang/rust/issues/113169/comments> response 403 Forbidden: {"message":"API rate limit exceeded for <MY-IP> (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

==================================================================================
= Please file this regression report on the rust-lang/rust GitHub repository     =
=        New issue: https://github.com/rust-lang/rust/issues/new                 =
=     Known issues: https://github.com/rust-lang/rust/issues                     =
= Copy and paste the text below into the issue report thread.  Thanks!           =
==================================================================================

searched nightlies: from nightly-2024-06-11 to nightly-2024-06-13
regressed nightly: nightly-2024-06-13
searched commit range: https://github.com/rust-lang/rust/compare/d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04...8337ba9189de188e2ed417018af2bf17a57d51ac
regressed commit: https://github.com/rust-lang/rust/commit/02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1

<details>
<summary>bisected with <a href='https://github.com/rust-lang/cargo-bisect-rustc'>cargo-bisect-rustc</a> v0.6.8</summary>


Host triple: x86_64-unknown-linux-gnu
Reproduce with:
```bash
cargo bisect-rustc
```
@Sherlock-Holo Sherlock-Holo added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Jun 13, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 13, 2024
@lqd
Copy link
Member

lqd commented Jun 13, 2024

This looks intended by @oli-obk's #113169 🤔

@lcnr lcnr added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. regression-untriaged Untriaged performance or correctness regression. labels Jun 13, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Jun 13, 2024

Yes this is intentional.

You need to move the tait declaration and the method(s) that actually constrain its hidden type into its own submodule. When we get the #[defines] attribute, you will be able to just mark the methods that are supposed to be defining with the attribute instead of having to move your code around in awkward ways

@oli-obk oli-obk closed this as completed Jun 13, 2024
@lqd
Copy link
Member

lqd commented Jun 13, 2024

Though I'm not sure which defining use to move in that piece of code; I probably missed it somewhere else.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 13, 2024

most importantly you need to move the type alias definition into a module. Then the compiler will happily give you type mismatches for the actual defining uses

@lqd
Copy link
Member

lqd commented Jun 13, 2024

@Sherlock-Holo as an example for the procedure Oli suggested, and for others who may stumble upon the same issue in the future, the following simple code move should fix your error for now, until #[defines] helps with this limitation.

$ diff --git a/server/src/server.rs b/server/src/server.rs

index d6fd886..a55a401 100644
--- a/server/src/server.rs
+++ b/server/src/server.rs
@@ -1,22 +1,58 @@
 use std::future::Future;
-use std::io;

-use futures_rustls::rustls::ServerConfig;
-use futures_util::{Stream, StreamExt, TryStreamExt};
-use hyper_util::rt::TokioTimer;
+use futures_util::StreamExt;
 use protocol::accept::Executor;
-use protocol::auth::Auth;
 use protocol::HyperListener;
 use share::dns::HickoryDnsResolver;
 use share::proxy;
-use share::tcp_wrapper::{TcpListenerAddrStream, TokioTcp};
 use tap::TapFallible;
-use tokio::net::{TcpListener, TcpStream};
+use tokio::net::TcpStream;
 use tracing::{error, info};

 use crate::Error;

-type TokioTcpAcceptor = impl Stream<Item = io::Result<TokioTcp>> + Send + Unpin;
+mod inner {
+    use std::io;
+
+    use futures_rustls::rustls::ServerConfig;
+    use futures_util::{Stream, TryStreamExt};
+    use hyper_util::rt::TokioTimer;
+    use protocol::auth::Auth;
+    use protocol::HyperListener;
+    use share::dns::HickoryDnsResolver;
+    use share::tcp_wrapper::{TcpListenerAddrStream, TokioTcp};
+    use tokio::net::TcpListener;
+
+    use crate::Error;
+
+    pub type TokioTcpAcceptor = impl Stream<Item = io::Result<TokioTcp>> + Send + Unpin;
+
+    impl super::HyperServer {
+        pub fn new(
+            token_header: String,
+            auth: Auth,
+            tcp_listener: TcpListener,
+            server_tls_config: ServerConfig,
+        ) -> Result<Self, Error> {
+            let tcp_listener = TcpListenerAddrStream::from(tcp_listener)
+                .map_ok(|(stream, _)| TokioTcp::from(stream));
+
+            let protocol_listener = HyperListener::new(
+                tcp_listener,
+                super::TokioExecutorWrapper,
+                server_tls_config,
+                token_header,
+                auth,
+                HickoryDnsResolver::new()?,
+                TokioTimer::new(),
+            );
+
+            Ok(Self { protocol_listener })
+        }
+    }
+}
+
+use inner::TokioTcpAcceptor;

 pub struct HyperServer {
     protocol_listener: HyperListener<TokioTcpAcceptor, TokioExecutorWrapper, HickoryDnsResolver>,
@@ -36,28 +72,6 @@ impl Executor for TokioExecutorWrapper {
 }

 impl HyperServer {
-    pub fn new(
-        token_header: String,
-        auth: Auth,
-        tcp_listener: TcpListener,
-        server_tls_config: ServerConfig,
-    ) -> Result<Self, Error> {
-        let tcp_listener =
-            TcpListenerAddrStream::from(tcp_listener).map_ok(|(stream, _)| TokioTcp::from(stream));
-
-        let protocol_listener = HyperListener::new(
-            tcp_listener,
-            TokioExecutorWrapper,
-            server_tls_config,
-            token_header,
-            auth,
-            HickoryDnsResolver::new()?,
-            TokioTimer::new(),
-        );
-
-        Ok(Self { protocol_listener })
-    }
-
     pub async fn start(self) -> Result<(), Error> {
         let (task, mut acceptor) = self.protocol_listener.listen();
         tokio::spawn(task);

@Sherlock-Holo
Copy link
Author

@lqd thanks, I will try this to fix the error

@saethlin saethlin added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 13, 2024
@xxchan
Copy link
Contributor

xxchan commented Jun 20, 2024

@oli-obk Will #[defines] be available in the near future? We have quite a lot opaque types and it would be cumbersome to fix them all manually :(

@oli-obk
Copy link
Contributor

oli-obk commented Jun 20, 2024

I am attempting to get it done before August, but if that fails I won't be working on it this year. It is not something that particularly needs me to do it, anyone with HIR, parser and AST knowledge can work on this.

I recommend pinning your nightly until that attribute exists.

@xxchan
Copy link
Contributor

xxchan commented Jun 20, 2024

Thanks. Is there a tracking issue for this?

@oli-obk
Copy link
Contributor

oli-obk commented Jul 31, 2024

There is not, but there is now a PR that fixes that: #128440

I'm not going to work on it for the next 4 months, but if anyone wants to pick it up, that would be great! All the annoying "edit 200+ tests" changes are done, so I believe it "just needs cleanups and diagnostics work", but reviewers may find more things 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]`
Projects
Development

No branches or pull requests

7 participants