From 22ef04e22fc78ce0dcaaf8c8faa5944c983cdc1d Mon Sep 17 00:00:00 2001 From: jackh726 Date: Sun, 15 Aug 2021 04:17:36 -0400 Subject: A bit of cleanup to astconv --- src/librustdoc/clean/mod.rs | 9 +-- src/test/ui/error-codes/e0119/complex-impl.stderr | 2 +- src/test/ui/generics/wrong-number-of-args.stderr | 88 +++++++++++------------ 3 files changed, 46 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 71348b3eb65..a95300217ab 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -129,7 +129,6 @@ impl Clean for hir::GenericBound<'_> { fn clean(&self, cx: &mut DocContext<'_>) -> GenericBound { match *self { hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)), - hir::GenericBound::Unsized(_) => GenericBound::maybe_sized(cx), hir::GenericBound::LangItemTrait(lang_item, span, _, generic_args) => { let def_id = cx.tcx.require_lang_item(lang_item, Some(span)); @@ -557,19 +556,13 @@ impl Clean for hir::Generics<'_> { WherePredicate::BoundPredicate { ty: Generic(ref name), ref mut bounds, .. } => { - if let [] | [GenericBound::TraitBound(_, hir::TraitBoundModifier::Maybe)] = - &bounds[..] - { + if bounds.is_empty() { for param in &mut generics.params { match param.kind { GenericParamDefKind::Lifetime { .. } => {} GenericParamDefKind::Type { bounds: ref mut ty_bounds, .. } => { if ¶m.name == name { mem::swap(bounds, ty_bounds); - // We now keep track of `?Sized` obligations in the HIR. - // If we don't clear `ty_bounds` we end up with - // `fn foo(_: X) where X: ?Sized`. - ty_bounds.clear(); break; } } diff --git a/src/test/ui/error-codes/e0119/complex-impl.stderr b/src/test/ui/error-codes/e0119/complex-impl.stderr index 04babb06447..6a1a502749a 100644 --- a/src/test/ui/error-codes/e0119/complex-impl.stderr +++ b/src/test/ui/error-codes/e0119/complex-impl.stderr @@ -6,7 +6,7 @@ LL | impl External for (Q, R) {} | = note: conflicting implementation in crate `complex_impl_support`: - impl<'a, 'b, 'c, T, U, V, W> External for (T, M<'a, 'b, 'c, Box, V, W>) - where >::Output == V, ::Item == T, 'b: 'a, T: 'a, U: FnOnce<(T,)>, U: 'static, V: Iterator, V: Clone, W: Add, ::Output: Copy; + where >::Output == V, ::Item == T, 'b: 'a, T: 'a, U: 'static, U: FnOnce<(T,)>, V: Iterator, V: Clone, W: Add, ::Output: Copy; error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/complex-impl.rs:9:1 diff --git a/src/test/ui/generics/wrong-number-of-args.stderr b/src/test/ui/generics/wrong-number-of-args.stderr index 98e5cd6bab8..22da0dffbf2 100644 --- a/src/test/ui/generics/wrong-number-of-args.stderr +++ b/src/test/ui/generics/wrong-number-of-args.stderr @@ -440,17 +440,6 @@ note: trait defined here, with 1 lifetime parameter: `'a` LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- -error[E0106]: missing lifetime specifier - --> $DIR/wrong-number-of-args.rs:169:44 - | -LL | type C = Box>; - | ^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | type C<'a> = Box>; - | ++++ +++ - error[E0107]: this trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:169:26 | @@ -465,6 +454,17 @@ note: trait defined here, with 0 generic parameters LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ +error[E0106]: missing lifetime specifier + --> $DIR/wrong-number-of-args.rs:169:44 + | +LL | type C = Box>; + | ^ expected named lifetime parameter + | +help: consider introducing a named lifetime parameter + | +LL | type C<'a> = Box>; + | ++++ +++ + error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:181:26 | @@ -525,17 +525,6 @@ help: add missing generic argument LL | type C = Box>; | +++ -error[E0106]: missing lifetime specifier - --> $DIR/wrong-number-of-args.rs:201:48 - | -LL | type A = Box>; - | ^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | type A<'a> = Box>; - | ++++ +++ - error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:201:26 | @@ -552,6 +541,17 @@ help: add missing generic argument LL | type A = Box>; | ++ +error[E0106]: missing lifetime specifier + --> $DIR/wrong-number-of-args.rs:201:48 + | +LL | type A = Box>; + | ^ expected named lifetime parameter + | +help: consider introducing a named lifetime parameter + | +LL | type A<'a> = Box>; + | ++++ +++ + error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:207:26 | @@ -609,17 +609,6 @@ help: consider introducing a named lifetime parameter LL | type D<'a> = Box>; | ++++ +++ -error[E0106]: missing lifetime specifier - --> $DIR/wrong-number-of-args.rs:221:48 - | -LL | type E = Box>; - | ^ expected named lifetime parameter - | -help: consider introducing a named lifetime parameter - | -LL | type E<'a> = Box>; - | ++++ +++ - error[E0107]: this trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:221:26 | @@ -634,6 +623,17 @@ note: trait defined here, with 1 generic parameter: `A` LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +error[E0106]: missing lifetime specifier + --> $DIR/wrong-number-of-args.rs:221:48 + | +LL | type E = Box>; + | ^ expected named lifetime parameter + | +help: consider introducing a named lifetime parameter + | +LL | type E<'a> = Box>; + | ++++ +++ + error[E0107]: this trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:227:26 | @@ -767,17 +767,6 @@ help: add missing lifetime argument LL | type B = Box>; | ++++ -error[E0106]: missing lifetime specifiers - --> $DIR/wrong-number-of-args.rs:279:56 - | -LL | type A = Box>; - | ^ expected 2 lifetime parameters - | -help: consider introducing a named lifetime parameter - | -LL | type A<'a> = Box>; - | ++++ +++++++ - error[E0107]: this trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:279:26 | @@ -794,6 +783,17 @@ help: add missing generic argument LL | type A = Box>; | ++ +error[E0106]: missing lifetime specifiers + --> $DIR/wrong-number-of-args.rs:279:56 + | +LL | type A = Box>; + | ^ expected 2 lifetime parameters + | +help: consider introducing a named lifetime parameter + | +LL | type A<'a> = Box>; + | ++++ +++++++ + error[E0107]: this trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:285:26 | -- cgit 1.4.1-3-g733a5