Skip to content

Commit b0aa859

Browse files
committed
fix fmt and bless
1 parent f6725c0 commit b0aa859

File tree

21 files changed

+46
-10
lines changed

21 files changed

+46
-10
lines changed

compiler/rustc_const_eval/src/transform/check_consts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_attr as attr;
88
use rustc_hir as hir;
99
use rustc_hir::def_id::{DefId, LocalDefId};
1010
use rustc_middle::mir;
11-
use rustc_middle::ty::{self, TyCtxt, PolyFnSig};
11+
use rustc_middle::ty::{self, PolyFnSig, TyCtxt};
1212
use rustc_span::Symbol;
1313

1414
pub use self::qualifs::Qualif;

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ impl<'hir> Map<'hir> {
485485
BodyOwnerKind::Static(mt) => ConstContext::Static(mt),
486486

487487
BodyOwnerKind::Fn if self.tcx.is_constructor(def_id.to_def_id()) => return None,
488-
BodyOwnerKind::Fn | BodyOwnerKind::Closure if self.tcx.is_const_fn_raw(def_id.to_def_id()) => {
488+
BodyOwnerKind::Fn | BodyOwnerKind::Closure
489+
if self.tcx.is_const_fn_raw(def_id.to_def_id()) =>
490+
{
489491
ConstContext::ConstFn
490492
}
491493
BodyOwnerKind::Fn if self.tcx.is_const_default_method(def_id.to_def_id()) => {

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
261261
Some(closure_kind) => {
262262
debug!(?closure_kind, "assemble_unboxed_candidates");
263263
if closure_kind.extends(kind) {
264-
candidates.vec.push(ClosureCandidate {
265-
is_const,
266-
});
264+
candidates.vec.push(ClosureCandidate { is_const });
267265
}
268266
}
269267
None => {
270268
debug!("assemble_unboxed_candidates: closure_kind not yet known");
271-
candidates.vec.push(ClosureCandidate {
272-
is_const,
273-
});
269+
candidates.vec.push(ClosureCandidate { is_const });
274270
}
275271
}
276272
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0015]: cannot call non-const fn `<() as Foo>::foo` in constant functions
2+
--> $DIR/non-const-op-const-closure-non-const-outer.rs:13:22
3+
|
4+
LL | (const || { (()).foo() })();
5+
| ^^^^^
6+
|
7+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0015`.

tests/ui/check-static-values-constraints.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ LL | field2: SafeEnum::Variant4("str".to_string())
2222
| ^^^^^^^^^^^
2323
|
2424
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
25+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2526
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
2627

2728
error[E0010]: allocations are not allowed in statics

tests/ui/const-generics/issue-93647.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | (||1usize)()
66
|
77
= note: closures need an RFC before allowed to be called in constants
88
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
9+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
910

1011
error: aborting due to previous error
1112

tests/ui/consts/const-fn-error.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ LL | for i in 0..x {
2222
note: impl defined here, but it is not `const`
2323
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
2424
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
25+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2526

2627
error[E0658]: mutable references are not allowed in constant functions
2728
--> $DIR/const-fn-error.rs:5:14
@@ -39,6 +40,7 @@ LL | for i in 0..x {
3940
| ^^^^
4041
|
4142
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
43+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
4244

4345
error: aborting due to 4 previous errors
4446

tests/ui/consts/const-for.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LL | for _ in 0..5 {}
77
note: impl defined here, but it is not `const`
88
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
99
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
10+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
1011

1112
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
1213
--> $DIR/const-for.rs:5:14
@@ -15,6 +16,7 @@ LL | for _ in 0..5 {}
1516
| ^^^^
1617
|
1718
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
19+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
1820

1921
error: aborting due to 2 previous errors
2022

tests/ui/consts/invalid-inline-const-in-match-arm.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | const { (|| {})() } => {}
66
|
77
= note: closures need an RFC before allowed to be called in constants
88
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
9+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
910

1011
error: aborting due to previous error
1112

tests/ui/consts/issue-28113.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | || -> u8 { 5 }()
66
|
77
= note: closures need an RFC before allowed to be called in constants
88
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
9+
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
910

1011
error: aborting due to previous error
1112

0 commit comments

Comments
 (0)