/// Emits an error at the given `span` if an expression cannot be evaluated in the current
/// context.
Emits an error at the given `span` if an expression cannot be evaluated in the current
context.
Emits an error at the given ` span ` if an expression cannot be evaluated in the current context .
pub fn check_op_spanned<O: NonConstOp<'tcx>>(&mut self, op: O, span: Span) {
        let gate = match op.status_in_item(self.ccx) {
            Status::Allowed => return,
            Status::Unstable(gate) if self.tcx.features().enabled(gate) => {
                let unstable_in_stable = self.ccx.is_const_stable_const_fn()
                    && !super::rustc_allow_const_fn_unstable(
                        self.tcx,
                        self.def_id().to_def_id(),
                        gate,
                    );
                if unstable_in_stable {
                    emit_unstable_in_stable_error(self.ccx, span, gate);
                }
                return;
            }
            Status::Unstable(gate) => Some(gate),
            Status::Forbidden => None,
        };
        if self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
            self.tcx.sess.miri_unleashed_feature(span, gate);
            return;
        }
        let mut err = op.build_error(self.ccx, span);
        assert!(err.is_error());
        match op.importance() {
            ops::DiagnosticImportance::Primary => {
                self.error_emitted = Some(ErrorReported);
                err.emit();
            }
            ops::DiagnosticImportance::Secondary => err.buffer(&mut self.secondary_errors),
        }
    }
pub fn check_op_spanned < O : NonConstOp < ' tcx > > ( & mut self , op : O , span : Span ) { let gate = match op . status_in_item ( self . ccx ) { Status :: Allowed => return , Status :: Unstable ( gate ) if self . tcx . features ( ) . enabled ( gate ) => { let unstable_in_stable = self . ccx . is_const_stable_const_fn ( ) && ! super :: rustc_allow_const_fn_unstable ( self . tcx , self . def_id ( ) . to_def_id ( ) , gate , ) ; if unstable_in_stable { emit_unstable_in_stable_error ( self . ccx , span , gate ) ; } return ; } Status :: Unstable ( gate ) => Some ( gate ) , Status :: Forbidden => None , } ; if self . tcx . sess . opts . debugging_opts . unleash_the_miri_inside_of_you { self . tcx . sess . miri_unleashed_feature ( span , gate ) ; return ; } let mut err = op . build_error ( self . ccx , span ) ; assert ! ( err is_error ( ) ) ; match op . importance ( ) { ops :: DiagnosticImportance :: Primary => { self . error_emitted = Some ( ErrorReported ) ; err . emit ( ) ; } ops :: DiagnosticImportance :: Secondary => err . buffer ( & mut self . secondary_errors ) , } }
Emits an error at the given `span` if an expression cannot be evaluated in the current
context.
Emits an error at the given ` span ` if an expression cannot be evaluated in the current context .
&mut self
op
O
span
Span