]> git.lizzy.rs Git - rust.git/commitdiff
Fix async-std at the price of breaking half the test suite
authorJoshua Nelson <jyn514@gmail.com>
Tue, 4 Aug 2020 01:13:13 +0000 (21:13 -0400)
committerJoshua Nelson <jyn514@gmail.com>
Tue, 4 Aug 2020 01:26:54 +0000 (21:26 -0400)
- Don't mark impl trait as an error

17 files changed:
src/librustc_privacy/lib.rs
src/librustdoc/core.rs
src/test/rustdoc-ui/error-in-impl-trait/async.rs
src/test/rustdoc-ui/error-in-impl-trait/async.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/closure.rs
src/test/rustdoc-ui/error-in-impl-trait/closure.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/generic-argument.rs
src/test/rustdoc-ui/error-in-impl-trait/generic-argument.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.rs
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword.rs
src/test/rustdoc-ui/error-in-impl-trait/impl-keyword.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/trait-alias-closure.rs
src/test/rustdoc-ui/error-in-impl-trait/trait-alias-closure.stderr [deleted file]
src/test/rustdoc-ui/error-in-impl-trait/trait-alias.rs
src/test/rustdoc-ui/error-in-impl-trait/trait-alias.stderr [deleted file]
src/test/rustdoc-ui/infinite-recursive-type.stderr

index fc00050f405182d1eddb93558a470572ed294e4b..797b2d35e9d5400537fd9fb009b9b7b7b5460642 100644 (file)
@@ -778,13 +778,8 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
             }
             // The interface is empty.
             hir::ItemKind::GlobalAsm(..) => {}
-            hir::ItemKind::OpaqueTy(..) => {
-                // FIXME: This is some serious pessimization intended to workaround deficiencies
-                // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time
-                // reachable if they are returned via `impl Trait`, even from private functions.
-                let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait));
-                self.reach(item.hir_id, exist_level).generics().predicates().ty();
-            }
+            // assume the type is never reachable - since it's opaque, no one can use it from this interface
+            hir::ItemKind::OpaqueTy(..) => {}
             // Visit everything.
             hir::ItemKind::Const(..)
             | hir::ItemKind::Static(..)
index cbd0ca0de64146ea9c1b4b72fee0b79e711f252b..eab310ddf892cb376e2217b5eebae8e242ecf3db 100644 (file)
@@ -449,13 +449,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
             let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
 
             global_ctxt.enter(|tcx| {
-                // Certain queries assume that some checks were run elsewhere
-                // (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
-                // so type-check everything other than function bodies in this crate before running lints.
-                // NOTE: this does not call `tcx.analysis()` so that we won't
-                // typeck function bodies or run the default rustc lints.
-                // (see `override_queries` in the `config`)
-                let _ = rustc_typeck::check_crate(tcx);
                 tcx.sess.abort_if_errors();
                 sess.time("missing_docs", || {
                     rustc_lint::check_crate(tcx, rustc_lint::builtin::MissingDoc::new);
index 112a2c494a5c2a090a7b7b8660509ccdbf15de55..cda53bff07a1b0fc8e5d226c989659283d4e6bf7 100644 (file)
@@ -1,10 +1,7 @@
 // edition:2018
+// check-pass
 
-/// This used to work with ResolveBodyWithLoop.
-/// However now that we ignore type checking instead of modifying the function body,
-/// the return type is seen as `impl Future<Output = u32>`, not a `u32`.
-/// So it no longer allows errors in the function body.
+/// Should compile fine
 pub async fn a() -> u32 {
     error::_in::async_fn()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/async.stderr b/src/test/rustdoc-ui/error-in-impl-trait/async.stderr
deleted file mode 100644 (file)
index 086db1b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `error::_in::async_fn`
-  --> $DIR/async.rs:8:5
-   |
-LL |     error::_in::async_fn()
-   |     ^^^^^^^^^^^^^^^^^^^^ could not resolve path `error::_in::async_fn`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index df40c121d579efeb0a8a591f2620845ea6f351d6..f1fd85bb23cb6cd8da4d9ca229ee6af5304122ba 100644 (file)
@@ -1,5 +1,5 @@
+// check-pass
 // manually desugared version of an `async fn` (but with a closure instead of a generator)
 pub fn a() -> impl Fn() -> u32 {
     || content::doesnt::matter()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/closure.stderr b/src/test/rustdoc-ui/error-in-impl-trait/closure.stderr
deleted file mode 100644 (file)
index 4ee9c4d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `content::doesnt::matter`
-  --> $DIR/closure.rs:3:8
-   |
-LL |     || content::doesnt::matter()
-   |        ^^^^^^^^^^^^^^^^^^^^^^^ could not resolve path `content::doesnt::matter`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index 0ccf2e3866fc910a864e5bd010331631a3b5154d..dcec379d47e946c0b91fc2fae68a3d50b806a94f 100644 (file)
@@ -1,7 +1,7 @@
+// check-pass
 trait ValidTrait {}
 
 /// This has docs
 pub fn f() -> impl ValidTrait {
     Vec::<DoesNotExist>::new()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/generic-argument.stderr b/src/test/rustdoc-ui/error-in-impl-trait/generic-argument.stderr
deleted file mode 100644 (file)
index 72716c2..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `DoesNotExist`
-  --> $DIR/generic-argument.rs:5:11
-   |
-LL |     Vec::<DoesNotExist>::new()
-   |           ^^^^^^^^^^^^ could not resolve path `DoesNotExist`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index 399fb827517fac2354525ac41fb4c8b60f03cb89..b935b0832f065ac9a06fc3677f7d2453772bab8f 100644 (file)
@@ -1,6 +1,6 @@
+// check-pass
 pub trait ValidTrait {}
 /// This returns impl trait
 pub fn g() -> impl ValidTrait {
     (|| error::_in::impl_trait::alias::nested::closure())()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.stderr b/src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.stderr
deleted file mode 100644 (file)
index 55f9b60..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `error::_in::impl_trait::alias::nested::closure`
-  --> $DIR/impl-keyword-closure.rs:4:9
-   |
-LL |     (|| error::_in::impl_trait::alias::nested::closure())()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not resolve path `error::_in::impl_trait::alias::nested::closure`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index 24b5734dbd0bf5eca19ef6f8375a238c9a70501f..701126f87a1f0fc091845f623bcd66248354a1d1 100644 (file)
@@ -1,6 +1,6 @@
+// check-pass
 pub trait ValidTrait {}
 /// This returns impl trait
 pub fn g() -> impl ValidTrait {
     error::_in::impl_trait()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/impl-keyword.stderr b/src/test/rustdoc-ui/error-in-impl-trait/impl-keyword.stderr
deleted file mode 100644 (file)
index 3257079..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `error::_in::impl_trait`
-  --> $DIR/impl-keyword.rs:4:5
-   |
-LL |     error::_in::impl_trait()
-   |     ^^^^^^^^^^^^^^^^^^^^^^ could not resolve path `error::_in::impl_trait`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index 1498fa4f890d0d8b8e4ce9393bee74dccc7baed0..31dd786cbbf8974bdea235940088b5a8ede648ad 100644 (file)
@@ -1,3 +1,4 @@
+// check-pass
 #![feature(type_alias_impl_trait)]
 
 pub trait ValidTrait {}
@@ -6,5 +7,4 @@ pub trait ValidTrait {}
 /// This returns impl trait, but using a type alias
 pub fn h() -> ImplTrait {
     (|| error::_in::impl_trait::alias::nested::closure())()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/trait-alias-closure.stderr b/src/test/rustdoc-ui/error-in-impl-trait/trait-alias-closure.stderr
deleted file mode 100644 (file)
index 84b2813..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `error::_in::impl_trait::alias::nested::closure`
-  --> $DIR/trait-alias-closure.rs:8:9
-   |
-LL |     (|| error::_in::impl_trait::alias::nested::closure())()
-   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not resolve path `error::_in::impl_trait::alias::nested::closure`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index cf9bc48c7f8727cde28cc6c4fa82a19353300130..c18a024af4bbc88eca84a20d221af858989b75a5 100644 (file)
@@ -1,3 +1,4 @@
+// check-pass
 #![feature(type_alias_impl_trait)]
 
 pub trait ValidTrait {}
@@ -6,5 +7,4 @@ pub trait ValidTrait {}
 /// This returns impl trait, but using a type alias
 pub fn h() -> ImplTrait {
     error::_in::impl_trait::alias()
-    //~^ ERROR failed to resolve
 }
diff --git a/src/test/rustdoc-ui/error-in-impl-trait/trait-alias.stderr b/src/test/rustdoc-ui/error-in-impl-trait/trait-alias.stderr
deleted file mode 100644 (file)
index 9be6a3d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0433]: failed to resolve: could not resolve path `error::_in::impl_trait::alias`
-  --> $DIR/trait-alias.rs:8:5
-   |
-LL |     error::_in::impl_trait::alias()
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not resolve path `error::_in::impl_trait::alias`
-   |
-   = note: this error was originally ignored because you are running `rustdoc`
-   = note: try running again with `rustc` or `cargo check` and you may get a more detailed error
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0433`.
index 897445f200cb701d57d6a70e45454e1aa09179b8..8d12392c5674ea0de8bc6903b416e36e09612c3d 100644 (file)
@@ -1,17 +1,26 @@
-error[E0072]: recursive type `E` has infinite size
+error: internal compiler error[E0391]: cycle detected when computing `Sized` constraints for `E`
   --> $DIR/infinite-recursive-type.rs:1:1
    |
 LL | enum E {
-   | ^^^^^^ recursive type has infinite size
-LL |
-LL |     V(E),
-   |       - recursive without indirection
+   | ^^^^^^
    |
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `E` representable
+   = note: ...which again requires computing `Sized` constraints for `E`, completing the cycle
+   = note: cycle used when evaluating trait selection obligation `E: std::convert::From<E>`
+
+error: internal compiler error: TyKind::Error constructed but no error reported
    |
-LL |     V(Box<E>),
-   |       ^^^^ ^
+   = note: delayed at /home/joshua/rustc/src/librustc_session/session.rs:436:27
+
+thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:366:17
+note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
+
+error: internal compiler error: unexpected panic
+
+note: the compiler unexpectedly panicked. this is a bug.
+
+note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
+
+note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu
 
-error: aborting due to previous error
+note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z unstable-options -C debuginfo=0
 
-For more information about this error, try `rustc --explain E0072`.