@@ -23,7 +23,6 @@ use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext};
23
23
24
24
use syntax:: ast;
25
25
use syntax:: symbol:: Symbol ;
26
- use syntax:: feature_gate:: { emit_feature_err, GateIssue } ;
27
26
28
27
use std:: ops:: Bound ;
29
28
@@ -97,7 +96,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
97
96
if let hir:: Unsafety :: Unsafe = sig. unsafety ( ) {
98
97
self . require_unsafe ( "call to unsafe function" ,
99
98
"consult the function's documentation for information on how to avoid \
100
- undefined behavior", UnsafetyViolationKind :: GatedConstFnCall )
99
+ undefined behavior", UnsafetyViolationKind :: GeneralAndConstFn )
101
100
}
102
101
}
103
102
}
@@ -325,11 +324,6 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
325
324
// compat lint
326
325
violation. kind = UnsafetyViolationKind :: General ;
327
326
} ,
328
- UnsafetyViolationKind :: GatedConstFnCall => {
329
- // safe code can't call unsafe const fns, this `UnsafetyViolationKind`
330
- // is only relevant for `Safety::ExplicitUnsafe` in `unsafe const fn`s
331
- violation. kind = UnsafetyViolationKind :: General ;
332
- }
333
327
}
334
328
if !self . violations . contains ( & violation) {
335
329
self . violations . push ( violation)
@@ -346,19 +340,8 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
346
340
}
347
341
// only some unsafety is allowed in const fn
348
342
if self . min_const_fn {
349
- let min_const_unsafe_fn = self . tcx . features ( ) . min_const_unsafe_fn ;
350
343
for violation in violations {
351
344
match violation. kind {
352
- UnsafetyViolationKind :: GatedConstFnCall if min_const_unsafe_fn => {
353
- // these function calls to unsafe functions are allowed
354
- // if `#![feature(min_const_unsafe_fn)]` is active
355
- } ,
356
- UnsafetyViolationKind :: GatedConstFnCall => {
357
- // without the feature gate, we report errors
358
- if !self . violations . contains ( & violation) {
359
- self . violations . push ( violation. clone ( ) )
360
- }
361
- }
362
345
// these unsafe things are stable in const fn
363
346
UnsafetyViolationKind :: GeneralAndConstFn => { } ,
364
347
// these things are forbidden in const fns
@@ -620,16 +603,6 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) {
620
603
. note ( & details. as_str ( ) [ ..] )
621
604
. emit ( ) ;
622
605
}
623
- UnsafetyViolationKind :: GatedConstFnCall => {
624
- emit_feature_err (
625
- & tcx. sess . parse_sess ,
626
- "min_const_unsafe_fn" ,
627
- source_info. span ,
628
- GateIssue :: Language ,
629
- "calls to `const unsafe fn` in const fns are unstable" ,
630
- ) ;
631
-
632
- }
633
606
UnsafetyViolationKind :: ExternStatic ( lint_node_id) => {
634
607
tcx. lint_node_note ( SAFE_EXTERN_STATICS ,
635
608
lint_node_id,
0 commit comments