1
Fork 0

s/Generator/Coroutine/

This commit is contained in:
Oli Scherer 2023-10-19 16:06:43 +00:00
parent 96027d945b
commit 60956837cf
310 changed files with 1271 additions and 1271 deletions

View file

@ -369,8 +369,8 @@ fn structurally_same_type_impl<'tcx>(
(Dynamic(..), Dynamic(..))
| (Error(..), Error(..))
| (Closure(..), Closure(..))
| (Generator(..), Generator(..))
| (GeneratorWitness(..), GeneratorWitness(..))
| (Coroutine(..), Coroutine(..))
| (CoroutineWitness(..), CoroutineWitness(..))
| (Alias(ty::Projection, ..), Alias(ty::Projection, ..))
| (Alias(ty::Inherent, ..), Alias(ty::Inherent, ..))
| (Alias(ty::Opaque, ..), Alias(ty::Opaque, ..)) => false,

View file

@ -1702,7 +1702,7 @@ pub struct UnusedClosure<'a> {
#[derive(LintDiagnostic)]
#[diag(lint_unused_generator)]
#[note]
pub struct UnusedGenerator<'a> {
pub struct UnusedCoroutine<'a> {
pub count: usize,
pub pre: &'a str,
pub post: &'a str,

View file

@ -1272,8 +1272,8 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
| ty::Bound(..)
| ty::Error(_)
| ty::Closure(..)
| ty::Generator(..)
| ty::GeneratorWitness(..)
| ty::Coroutine(..)
| ty::CoroutineWitness(..)
| ty::Placeholder(..)
| ty::FnDef(..) => bug!("unexpected type in foreign function: {:?}", ty),
}

View file

@ -1,7 +1,7 @@
use crate::lints::{
PathStatementDrop, PathStatementDropSub, PathStatementNoEffect, UnusedAllocationDiag,
UnusedAllocationMutDiag, UnusedClosure, UnusedDef, UnusedDefSuggestion, UnusedDelim,
UnusedDelimSuggestion, UnusedGenerator, UnusedImportBracesDiag, UnusedOp, UnusedOpSuggestion,
UnusedAllocationMutDiag, UnusedClosure, UnusedCoroutine, UnusedDef, UnusedDefSuggestion,
UnusedDelim, UnusedDelimSuggestion, UnusedImportBracesDiag, UnusedOp, UnusedOpSuggestion,
UnusedResult,
};
use crate::Lint;
@ -258,7 +258,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
/// The root of the unused_closures lint.
Closure(Span),
/// The root of the unused_generators lint.
Generator(Span),
Coroutine(Span),
}
#[instrument(skip(cx, expr), level = "debug", ret)]
@ -350,7 +350,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
.map(|inner| MustUsePath::Array(Box::new(inner), len)),
},
ty::Closure(..) => Some(MustUsePath::Closure(span)),
ty::Generator(def_id, ..) => {
ty::Coroutine(def_id, ..) => {
// async fn should be treated as "implementor of `Future`"
let must_use = if cx.tcx.generator_is_async(def_id) {
let def_id = cx.tcx.lang_items().future_trait()?;
@ -359,7 +359,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
} else {
None
};
must_use.or(Some(MustUsePath::Generator(span)))
must_use.or(Some(MustUsePath::Coroutine(span)))
}
_ => None,
}
@ -482,11 +482,11 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
UnusedClosure { count: plural_len, pre: descr_pre, post: descr_post },
);
}
MustUsePath::Generator(span) => {
MustUsePath::Coroutine(span) => {
cx.emit_spanned_lint(
UNUSED_MUST_USE,
*span,
UnusedGenerator { count: plural_len, pre: descr_pre, post: descr_post },
UnusedCoroutine { count: plural_len, pre: descr_pre, post: descr_post },
);
}
MustUsePath::Def(span, def_id, reason) => {