Skip to content

Commit 4fcee62

Browse files
committed
Rollup merge of rust-lang#58509 - phansch:add_myself_to_clippy_toolstate_maintainers, r=oli-obk
Notify myself when Clippy toolstate changes
2 parents 98f1865 + d6a98f4 commit 4fcee62

File tree

20 files changed

+219
-180
lines changed

20 files changed

+219
-180
lines changed

src/ci/docker/dist-various-1/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ ENV TARGETS=$TARGETS,thumbv7em-none-eabihf
112112
ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi
113113
ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
114114
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
115+
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
116+
ENV TARGETS=$TARGETS,riscv64gc-unknown-none-elf
115117
ENV TARGETS=$TARGETS,armebv7r-none-eabi
116118
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
117119
ENV TARGETS=$TARGETS,armv7r-none-eabi

src/librustc/ich/impls_ty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::adjustment::AutoBorrow
206206
}
207207
}
208208

209+
impl_stable_hash_for!(tuple_struct ty::util::NeedsDrop { value });
210+
211+
impl_stable_hash_for!(tuple_struct ty::AdtSizedConstraint<'tcx> { list });
212+
209213
impl_stable_hash_for!(struct ty::UpvarPath { hir_id });
210214

211215
impl_stable_hash_for!(struct ty::UpvarId { var_path, closure_expr_id });

src/librustc/ty/mod.rs

+7-17
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use syntax::ast::{self, Name, Ident, NodeId};
4343
use syntax::attr;
4444
use syntax::ext::hygiene::Mark;
4545
use syntax::symbol::{keywords, Symbol, LocalInternedString, InternedString};
46-
use syntax_pos::{DUMMY_SP, Span};
46+
use syntax_pos::Span;
4747

4848
use smallvec;
4949
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
@@ -2379,20 +2379,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
23792379
/// Due to normalization being eager, this applies even if
23802380
/// the associated type is behind a pointer (e.g., issue #31299).
23812381
pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] {
2382-
match tcx.try_adt_sized_constraint(DUMMY_SP, self.did) {
2383-
Ok(tys) => tys,
2384-
Err(mut bug) => {
2385-
debug!("adt_sized_constraint: {:?} is recursive", self);
2386-
// This should be reported as an error by `check_representable`.
2387-
//
2388-
// Consider the type as Sized in the meanwhile to avoid
2389-
// further errors. Delay our `bug` diagnostic here to get
2390-
// emitted later as well in case we accidentally otherwise don't
2391-
// emit an error.
2392-
bug.delay_as_bug();
2393-
tcx.intern_type_list(&[tcx.types.err])
2394-
}
2395-
}
2382+
tcx.adt_sized_constraint(self.did).0
23962383
}
23972384

23982385
fn sized_constraint_for_ty(&self,
@@ -3083,6 +3070,9 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso
30833070
parent_item.node)
30843071
}
30853072

3073+
#[derive(Clone)]
3074+
pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]);
3075+
30863076
/// Calculates the `Sized` constraint.
30873077
///
30883078
/// In fact, there are only a few options for the types in the constraint:
@@ -3094,7 +3084,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso
30943084
/// check should catch this case.
30953085
fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
30963086
def_id: DefId)
3097-
-> &'tcx [Ty<'tcx>] {
3087+
-> AdtSizedConstraint<'tcx> {
30983088
let def = tcx.adt_def(def_id);
30993089

31003090
let result = tcx.mk_type_list(def.variants.iter().flat_map(|v| {
@@ -3105,7 +3095,7 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
31053095

31063096
debug!("adt_sized_constraint: {:?} => {:?}", def, result);
31073097

3108-
result
3098+
AdtSizedConstraint(result)
31093099
}
31103100

31113101
fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,

src/librustc/ty/query/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use crate::ty::subst::Substs;
1313
use crate::ty::query::queries;
1414
use crate::ty::query::Query;
1515
use crate::ty::query::QueryCache;
16+
use crate::ty::query::plumbing::CycleError;
1617
use crate::util::profiling::ProfileCategory;
1718

1819
use std::borrow::Cow;
@@ -49,7 +50,7 @@ pub(super) trait QueryAccessors<'tcx>: QueryConfig<'tcx> {
4950
result: &Self::Value
5051
) -> Option<Fingerprint>;
5152

52-
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>) -> Self::Value;
53+
fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>, error: CycleError<'tcx>) -> Self::Value;
5354
}
5455

5556
pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> {

src/librustc/ty/query/job.rs

+3-21
Original file line numberDiff line numberDiff line change
@@ -73,30 +73,12 @@ impl<'tcx> QueryJob<'tcx> {
7373
}
7474

7575
/// Awaits for the query job to complete.
76-
///
77-
/// For single threaded rustc there's no concurrent jobs running, so if we are waiting for any
78-
/// query that means that there is a query cycle, thus this always running a cycle error.
79-
#[cfg(not(parallel_compiler))]
80-
#[inline(never)]
81-
#[cold]
82-
pub(super) fn cycle_error<'lcx, 'a, D: QueryDescription<'tcx>>(
83-
&self,
84-
tcx: TyCtxt<'_, 'tcx, 'lcx>,
85-
span: Span,
86-
) -> TryGetJob<'a, 'tcx, D> {
87-
TryGetJob::JobCompleted(Err(Box::new(self.find_cycle_in_stack(tcx, span))))
88-
}
89-
90-
/// Awaits for the query job to complete.
91-
///
92-
/// For single threaded rustc there's no concurrent jobs running, so if we are waiting for any
93-
/// query that means that there is a query cycle, thus this always running a cycle error.
9476
#[cfg(parallel_compiler)]
9577
pub(super) fn r#await<'lcx>(
9678
&self,
9779
tcx: TyCtxt<'_, 'tcx, 'lcx>,
9880
span: Span,
99-
) -> Result<(), Box<CycleError<'tcx>>> {
81+
) -> Result<(), CycleError<'tcx>> {
10082
tls::with_related_context(tcx, move |icx| {
10183
let mut waiter = Lrc::new(QueryWaiter {
10284
query: icx.query.clone(),
@@ -111,13 +93,13 @@ impl<'tcx> QueryJob<'tcx> {
11193
let mut cycle = waiter.cycle.lock();
11294
match cycle.take() {
11395
None => Ok(()),
114-
Some(cycle) => Err(Box::new(cycle))
96+
Some(cycle) => Err(cycle)
11597
}
11698
})
11799
}
118100

119101
#[cfg(not(parallel_compiler))]
120-
fn find_cycle_in_stack<'lcx>(
102+
pub(super) fn find_cycle_in_stack<'lcx>(
121103
&self,
122104
tcx: TyCtxt<'_, 'tcx, 'lcx>,
123105
span: Span,

src/librustc/ty/query/mod.rs

+22-30
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ use crate::traits::query::normalize::NormalizationResult;
3434
use crate::traits::query::outlives_bounds::OutlivesBound;
3535
use crate::traits::specialization_graph;
3636
use crate::traits::Clauses;
37-
use crate::ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt};
37+
use crate::ty::{self, CrateInherentImpls, ParamEnvAnd, Ty, TyCtxt, AdtSizedConstraint};
3838
use crate::ty::steal::Steal;
3939
use crate::ty::subst::Substs;
40+
use crate::ty::util::NeedsDrop;
4041
use crate::util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet};
4142
use crate::util::common::{ErrorReported};
4243
use crate::util::profiling::ProfileCategory::*;
4344
use crate::session::Session;
4445

45-
use errors::DiagnosticBuilder;
4646
use rustc_data_structures::svh::Svh;
4747
use rustc_data_structures::bit_set::BitSet;
4848
use rustc_data_structures::indexed_vec::IndexVec;
@@ -154,7 +154,16 @@ define_queries! { <'tcx>
154154
[] fn trait_def: TraitDefOfItem(DefId) -> &'tcx ty::TraitDef,
155155
[] fn adt_def: AdtDefOfItem(DefId) -> &'tcx ty::AdtDef,
156156
[] fn adt_destructor: AdtDestructor(DefId) -> Option<ty::Destructor>,
157-
[] fn adt_sized_constraint: SizedConstraint(DefId) -> &'tcx [Ty<'tcx>],
157+
158+
// The cycle error here should be reported as an error by `check_representable`.
159+
// We consider the type as Sized in the meanwhile to avoid
160+
// further errors (done in impl Value for AdtSizedConstraint).
161+
// Use `cycle_delay_bug` to delay the cycle error here to be emitted later
162+
// in case we accidentally otherwise don't emit an error.
163+
[cycle_delay_bug] fn adt_sized_constraint: SizedConstraint(
164+
DefId
165+
) -> AdtSizedConstraint<'tcx>,
166+
158167
[] fn adt_dtorck_constraint: DtorckConstraint(
159168
DefId
160169
) -> Result<DtorckConstraint<'tcx>, NoSolution>,
@@ -411,7 +420,16 @@ define_queries! { <'tcx>
411420
[] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
412421
[] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
413422
[] fn is_freeze_raw: is_freeze_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
414-
[] fn needs_drop_raw: needs_drop_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool,
423+
424+
// The cycle error here should be reported as an error by `check_representable`.
425+
// We consider the type as not needing drop in the meanwhile to avoid
426+
// further errors (done in impl Value for NeedsDrop).
427+
// Use `cycle_delay_bug` to delay the cycle error here to be emitted later
428+
// in case we accidentally otherwise don't emit an error.
429+
[cycle_delay_bug] fn needs_drop_raw: needs_drop_dep_node(
430+
ty::ParamEnvAnd<'tcx, Ty<'tcx>>
431+
) -> NeedsDrop,
432+
415433
[] fn layout_raw: layout_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>)
416434
-> Result<&'tcx ty::layout::LayoutDetails,
417435
ty::layout::LayoutError<'tcx>>,
@@ -731,32 +749,6 @@ define_queries! { <'tcx>
731749
},
732750
}
733751

734-
// `try_get_query` can't be public because it uses the private query
735-
// implementation traits, so we provide access to it selectively.
736-
impl<'a, 'tcx, 'lcx> TyCtxt<'a, 'tcx, 'lcx> {
737-
pub fn try_adt_sized_constraint(
738-
self,
739-
span: Span,
740-
key: DefId,
741-
) -> Result<&'tcx [Ty<'tcx>], Box<DiagnosticBuilder<'a>>> {
742-
self.try_get_query::<queries::adt_sized_constraint<'_>>(span, key)
743-
}
744-
pub fn try_needs_drop_raw(
745-
self,
746-
span: Span,
747-
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>,
748-
) -> Result<bool, Box<DiagnosticBuilder<'a>>> {
749-
self.try_get_query::<queries::needs_drop_raw<'_>>(span, key)
750-
}
751-
pub fn try_optimized_mir(
752-
self,
753-
span: Span,
754-
key: DefId,
755-
) -> Result<&'tcx mir::Mir<'tcx>, Box<DiagnosticBuilder<'a>>> {
756-
self.try_get_query::<queries::optimized_mir<'_>>(span, key)
757-
}
758-
}
759-
760752
//////////////////////////////////////////////////////////////////////
761753
// These functions are little shims used to find the dep-node for a
762754
// given query when there is not a *direct* mapping:

0 commit comments

Comments
 (0)