Skip to content

Commit 33107d1

Browse files
committed
fmt
1 parent 72c5810 commit 33107d1

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,10 +2370,10 @@ impl<'tcx> WfCheckingCtxt<'_, 'tcx> {
23702370
// We lower empty bounds like `Vec<dyn Copy>:` as
23712371
// `WellFormed(Vec<dyn Copy>)`, which will later get checked by
23722372
// regular WF checking
2373-
2373+
23742374
match pred.kind().skip_binder() {
23752375
ty::ClauseKind::WellFormed(..) | ty::ClauseKind::UnstableFeature(..) => continue,
2376-
_ => {},
2376+
_ => {}
23772377
}
23782378

23792379
// Match the existing behavior.

compiler/rustc_hir_analysis/src/collect/predicates_of.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::assert_matches::assert_matches;
22

33
use hir::Node;
4+
use rustc_attr_data_structures::{AttributeKind, find_attr};
45
use rustc_data_structures::fx::FxIndexSet;
56
use rustc_hir as hir;
67
use rustc_hir::def::DefKind;
@@ -18,9 +19,6 @@ use crate::constrained_generic_params as cgp;
1819
use crate::delegation::inherit_predicates_for_delegation_item;
1920
use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter, RegionInferReason};
2021

21-
22-
use rustc_attr_data_structures::{AttributeKind, find_attr};
23-
2422
/// Returns a list of all type predicates (explicit and implicit) for the definition with
2523
/// ID `def_id`. This includes all predicates returned by `explicit_predicates_of`, plus
2624
/// inferred constraints concerning which regions outlive other regions.
@@ -328,11 +326,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
328326
.unwrap_or_default();
329327

330328
for (feat_name, span) in allow_unstable_feature_attr {
331-
predicates.insert((
332-
ty::ClauseKind::UnstableFeature(*feat_name).upcast(tcx),
333-
*span
334-
));
335-
}
329+
predicates.insert((ty::ClauseKind::UnstableFeature(*feat_name).upcast(tcx), *span));
330+
}
336331

337332
let mut predicates: Vec<_> = predicates.into_iter().collect();
338333

compiler/rustc_passes/src/stability.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -801,28 +801,28 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
801801
// FIXME(jdonszelmann): make it impossible to miss the or_else in the typesystem
802802
let const_stab = attrs::find_attr!(attrs, AttributeKind::ConstStability{stability, ..} => *stability);
803803

804-
let unstable_feature_stab =
804+
let unstable_feature_stab =
805805
find_attr!(attrs, AttributeKind::AllowUnstableFeature(i) => i)
806-
.map(|i| i.as_slice())
807-
.unwrap_or_default();
806+
.map(|i| i.as_slice())
807+
.unwrap_or_default();
808808

809809
// If this impl block has an #[unstable] attribute, give an
810810
// error if all involved types and traits are stable, because
811811
// it will have no effect.
812812
// See: https://github.com/rust-lang/rust/issues/55436
813813
//
814814
// The exception is when there is both #[unstable_feature_bound(..)] and
815-
// #![unstable(feature = "..", issue = "..")] that have the same symbol because
815+
// #![unstable(feature = "..", issue = "..")] that have the same symbol because
816816
// that can effectively mark an impl as unstable.
817817
//
818818
// For example:
819819
// ```
820-
// #[unstable_feature_bound(feat_foo)]
820+
// #[unstable_feature_bound(feat_foo)]
821821
// #![unstable(feature = "feat_foo", issue = "none")]
822822
// impl Foo for Bar {}
823823
// ```
824824
if let Some((
825-
Stability { level: attrs::StabilityLevel::Unstable { ..}, feature},
825+
Stability { level: attrs::StabilityLevel::Unstable { .. }, feature },
826826
span,
827827
)) = stab
828828
{
@@ -831,7 +831,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
831831
c.visit_trait_ref(t);
832832

833833
// Skip the lint if the impl is marked as unstable using
834-
// #[unstable_feature_bound(..)]
834+
// #[unstable_feature_bound(..)]
835835
let mut unstable_feature_bound_in_effect = false;
836836
for (unstable_bound_feat_name, _) in unstable_feature_stab {
837837
if *unstable_bound_feat_name == feature {
@@ -841,7 +841,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
841841

842842
// do not lint when the trait isn't resolved, since resolution error should
843843
// be fixed first
844-
if t.path.res != Res::Err && c.fully_stable && !unstable_feature_bound_in_effect {
844+
if t.path.res != Res::Err
845+
&& c.fully_stable
846+
&& !unstable_feature_bound_in_effect
847+
{
845848
self.tcx.emit_node_span_lint(
846849
INEFFECTIVE_UNSTABLE_TRAIT_IMPL,
847850
item.hir_id(),

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
778778
// If we are in std/core, and the feature is not enabled through #[unstable_feature_bound(..)].
779779
return ProcessResult::Unchanged;
780780
} else {
781-
// Outside of std/core, check if feature is enabled at crate level with #[feature(..)]
781+
// Outside of std/core, check if feature is enabled at crate level with #[feature(..)]
782782
// or if we are currently in codegen.
783783
if self.selcx.tcx().features().enabled(symbol)
784784
|| (self.selcx.infcx.typing_mode() == TypingMode::PostAnalysis)
@@ -787,7 +787,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
787787
} else {
788788
return ProcessResult::Unchanged;
789789
}
790-
791790
}
792791
}
793792
},

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
851851
// If we are in std/core, and the feature is not enabled through #[unstable_feature_bound(..)].
852852
return Ok(EvaluatedToAmbig);
853853
} else {
854-
// Outside of std/core, check if feature is enabled at crate level with #[feature(..)]
854+
// Outside of std/core, check if feature is enabled at crate level with #[feature(..)]
855855
// or if we are currently in codegen.
856856
if self.tcx().features().enabled(symbol)
857857
|| (self.infcx.typing_mode() == TypingMode::PostAnalysis)

0 commit comments

Comments
 (0)