Change:
Hi there, I'm updating rust-sgx-sdk (solving rust-sgx-sdk ) to use latest rust nightly compiler to help the error info more ergonomic by the help of . However, the compiler always panics. Your help would be very much helpful. The current code is at . To reproduce this bug, please checkout branch and build sgxtstd as follows: And the reproducible failure info is: : rustc 1.40.0-nightly ( 2019-10-03) binary: rustc commit-hash: commit-date: 2019-10-03 host: x8664-unknown-linux-gnu release: 1.40.0-nightly LLVM version: 9.0 Backtrace:
It'd be helpful to have a more minimal example here I suspect -- for example, at least reducing to a single crate. cc since this deals with diagnostic machinery
It seems like this was introduced a month ago in , CC
I think I find the solution on my side: the removal of .
A working branch is baidu/rust-sgx-sdk : test-2019-10. Failing branch is librustc-bug-report. After I enable , the compiler starts to fail.
The minimum sample is as follows: and compile by
Fixed in
Cool!

Discussion:
} pub fn report_unstable( <del> sess: &Session, feature: Symbol, reason: Option<Symbol>, issue: u32, is_soft: bool, span: Span </del> <ins> sess: &Session, feature: Symbol, reason: Option<Symbol>, issue: u32, is_soft: bool, span: Span, soft_handler: impl FnOnce(&'static lint::Lint, Span, &str), </ins> ) { let msg = match reason { Some(r) => format!("use of unstable library feature '{}': {}", feature, r),

let fresh = sess.one_time_diagnostics.borrow_mut().insert(error_id); if fresh { if is_soft { <del> sess.buffer_lint(lint::builtin::SOFT_UNSTABLE, CRATE_NODE_ID, span, &msg); </del> <ins> soft_handler(lint::builtin::SOFT_UNSTABLE, span, &msg) </ins> } else { emit_feature_err( &sess.parse_sess, feature, span, GateIssue::Library(Some(issue)), &msg

/// Additionally, this function will also check if the item is deprecated. If so, and `id` is /// not `None`, a deprecated lint attached to `id` will be emitted. pub fn check_stability(self, def_id: DefId, id: Option<HirId>, span: Span) { <ins> let soft_handler = |lint, span, msg: &_| self.lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, msg); </ins> match self.eval_stability(def_id, id, span) { EvalResult::Allow => {} EvalResult::Deny { feature, reason, issue, is_soft } => <del> report_unstable(self.sess, feature, reason, issue, is_soft, span), </del> <ins> report_unstable(self.sess, feature, reason, issue, is_soft, span, soft_handler), </ins> EvalResult::Unmarked => { // The API could be uncallable for other reasons, for example when a private module // was referenced.

if let StabilityLevel::Unstable { reason, issue, is_soft } = stability.level { let feature = stability.feature; if !self.active_features.contains(&feature) && !span.allows_unstable(feature) { <del> stability::report_unstable(self.session, feature, reason, issue, is_soft, span); </del> <ins> let node_id = ast::CRATE_NODE_ID; let soft_handler = |lint, span, msg: &_| self.session.buffer_lint(lint, node_id, span, msg); stability::report_unstable( self.session, feature, reason, issue, is_soft, span, soft_handler ); </ins> } } if let Some(depr) = &stability.rustc_depr {

<ins> // edition:2018 </ins> #[bench] //~ ERROR use of unstable library feature 'test' //~| WARN this was previously accepted fn bench() {} <ins> use bench as _; //~ ERROR use of unstable library feature 'test' //~| WARN this was previously accepted </ins> fn main() {}

error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable <del> --> $DIR/bench.rs:1:3 </del> <ins> --> $DIR/bench.rs:3:3 </ins> | LL | #[bench] |   ^^^^^

= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> <del> error: aborting due to previous error </del> <ins> error: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable --> $DIR/bench.rs:7:5 | LL | use bench as _; |     ^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266> error: aborting due to 2 previous errors </ins>