Skip to content

Commit 31fcda1

Browse files
committed
Fix async-std at the price of breaking half the test suite
- Don't mark impl trait as an error
1 parent f042d74 commit 31fcda1

17 files changed

+29
-119
lines changed

src/librustc_privacy/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,8 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
778778
}
779779
// The interface is empty.
780780
hir::ItemKind::GlobalAsm(..) => {}
781-
hir::ItemKind::OpaqueTy(..) => {
782-
// FIXME: This is some serious pessimization intended to workaround deficiencies
783-
// in the reachability pass (`middle/reachable.rs`). Types are marked as link-time
784-
// reachable if they are returned via `impl Trait`, even from private functions.
785-
let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait));
786-
self.reach(item.hir_id, exist_level).generics().predicates().ty();
787-
}
781+
// assume the type is never reachable - since it's opaque, no one can use it from this interface
782+
hir::ItemKind::OpaqueTy(..) => {}
788783
// Visit everything.
789784
hir::ItemKind::Const(..)
790785
| hir::ItemKind::Static(..)

src/librustdoc/core.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,13 +449,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
449449
let mut global_ctxt = abort_on_err(queries.global_ctxt(), sess).take();
450450

451451
global_ctxt.enter(|tcx| {
452-
// Certain queries assume that some checks were run elsewhere
453-
// (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
454-
// so type-check everything other than function bodies in this crate before running lints.
455-
// NOTE: this does not call `tcx.analysis()` so that we won't
456-
// typeck function bodies or run the default rustc lints.
457-
// (see `override_queries` in the `config`)
458-
let _ = rustc_typeck::check_crate(tcx);
459452
tcx.sess.abort_if_errors();
460453
sess.time("missing_docs", || {
461454
rustc_lint::check_crate(tcx, rustc_lint::builtin::MissingDoc::new);
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// edition:2018
2+
// check-pass
23

3-
/// This used to work with ResolveBodyWithLoop.
4-
/// However now that we ignore type checking instead of modifying the function body,
5-
/// the return type is seen as `impl Future<Output = u32>`, not a `u32`.
6-
/// So it no longer allows errors in the function body.
4+
/// Should compile fine
75
pub async fn a() -> u32 {
86
error::_in::async_fn()
9-
//~^ ERROR failed to resolve
107
}

src/test/rustdoc-ui/error-in-impl-trait/async.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
// check-pass
12
// manually desugared version of an `async fn` (but with a closure instead of a generator)
23
pub fn a() -> impl Fn() -> u32 {
34
|| content::doesnt::matter()
4-
//~^ ERROR failed to resolve
55
}

src/test/rustdoc-ui/error-in-impl-trait/closure.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
// check-pass
12
trait ValidTrait {}
23

34
/// This has docs
45
pub fn f() -> impl ValidTrait {
56
Vec::<DoesNotExist>::new()
6-
//~^ ERROR failed to resolve
77
}

src/test/rustdoc-ui/error-in-impl-trait/generic-argument.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
// check-pass
12
pub trait ValidTrait {}
23
/// This returns impl trait
34
pub fn g() -> impl ValidTrait {
45
(|| error::_in::impl_trait::alias::nested::closure())()
5-
//~^ ERROR failed to resolve
66
}

src/test/rustdoc-ui/error-in-impl-trait/impl-keyword-closure.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)