Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal compiler error: ../src/librustc/middle/stability.rs:516: encountered unmarked API #38412

Closed
EpicatSupercell opened this issue Dec 16, 2016 · 9 comments
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@EpicatSupercell
Copy link

The following code causes the compiler to crash on nightly (stable and beta unaffected):
https://is.gd/RE6AiB

struct A {
    current: Option<Box<A>>,
}

impl A {
    fn next(&mut self) -> Option<u32> {
        match self.current {
            Some(Box(cur)) => {
                None
            }
            None => None,
        }
    }
}

fn main() {
    let a = A { current: None};
    a.next();
}

The error message says:

error: internal compiler error: ../src/librustc/middle/stability.rs:516: encountered unmarked API

Meta

rustc --version --verbose:

rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
binary: rustc
commit-hash: daf8c1dfce3b448fc581cc319f64632ec22bd0e1
commit-date: 2016-12-05
host: x86_64-unknown-linux-gnu
release: 1.15.0-nightly
LLVM version: 3.9

Backtrace:

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:382
stack backtrace:
   1:     0x7f58e6eef7ba - std::sys::imp::backtrace::tracing::imp::write::hbea47d9dd19b523c
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x7f58e6efe68f - std::panicking::default_hook::{{closure}}::h6875a2976258b020
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:247
   3:     0x7f58e6efe22d - std::panicking::default_hook::h88ffbc5922643264
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:257
   4:     0x7f58e6efeb37 - std::panicking::rust_panic_with_hook::hc790e47d4ecc86cd
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:451
   5:     0x7f58e40d841b - std::panicking::begin_panic::h264cdc75d51b518b
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:413
   6:     0x7f58e427da33 - rustc::session::opt_span_bug_fmt::{{closure}}::h4a9b70c3df8b4b3a
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/<panic macros>:3
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:782
   7:     0x7f58e427d88e - rustc::session::opt_span_bug_fmt::h7d83586c6e2c7ae6
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1062
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:779
   8:     0x7f58e427d722 - rustc::session::span_bug_fmt::h0c5d2225aa96fe42
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:772
   9:     0x7f58e425d018 - rustc::middle::stability::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::check_stability::hc9dc453e664bf8e0
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/middle/stability.rs:516
  10:     0x7f58e48d9de0 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat_tuple_struct::h8be84080877d1667
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:607
  11:     0x7f58e48d0de9 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat::h13080d8f3aa5a41c
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:146
  12:     0x7f58e48d9d6a - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat_tuple_struct::h8be84080877d1667
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:605
  13:     0x7f58e48d0de9 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_pat::h13080d8f3aa5a41c
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:146
  14:     0x7f58e48c9363 - <collections::vec::Vec<T> as collections::vec::SpecExtend<I>>::spec_extend::hcf31b9aed7bf0fac
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:394
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/ops.rs:2645
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/option.rs:383
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/iter/mod.rs:999
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1632
  15:     0x7f58e48d2dd0 - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::check_match::h54f69213176d4c8f
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1615
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcollections/vec.rs:1502
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/iter/iterator.rs:1218
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/_match.rs:390
  16:     0x7f58e49431fd - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3804
  17:     0x7f58e4942a32 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3460
  18:     0x7f58e49546ae - rustc_typeck::check::FnCtxt::check_block_with_expected::he90dd72b6855e5e4
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2801
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:4208
  19:     0x7f58e4942f02 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3810
  20:     0x7f58e4942a32 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3460
  21:     0x7f58e493a562 - rustc_typeck::check::FnCtxt::check_then_else::h7ffb8604d0f0925d
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2956
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/infer/mod.rs:887
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2955
  22:     0x7f58e4943254 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3753
  23:     0x7f58e4942a32 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3460
  24:     0x7f58e49546ae - rustc_typeck::check::FnCtxt::check_block_with_expected::he90dd72b6855e5e4
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2801
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:4208
  25:     0x7f58e4942f02 - rustc_typeck::check::FnCtxt::check_expr_kind::hfeeca7568cc99087
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3810
  26:     0x7f58e4942a32 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref::h5d7f5141d7386bb8
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:3460
  27:     0x7f58e4929c4d - rustc_typeck::check::check_fn::h96bd864b4d4fc711
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2801
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2795
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:2788
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:824
  28:     0x7f58e492887b - rustc_typeck::check::check_bare_fn::h87386ea43f4e272e
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:661
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:502
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/infer/mod.rs:441
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1033
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/local.rs:245
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1030
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:846
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/infer/mod.rs:441
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:502
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:651
  29:     0x7f58e492b5ec - rustc_typeck::check::check_item_body::h1e039ede2f960fb9
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:938
  30:     0x7f58e49260cd - rustc_typeck::check::check_item_bodies::hd22adb7703cc56d7
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:565
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/dep_graph/visit.rs:45
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/hir/mod.rs:456
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/dep_graph/visit.rs:67
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/mod.rs:2681
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:591
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/session/mod.rs:232
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/check/mod.rs:589
  31:     0x7f58e4991a92 - rustc_typeck::check_crate::h92f6bdfe03b6afba
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/lib.rs:350
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/util/common.rs:34
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_typeck/lib.rs:350
  32:     0x7f58e72a5a51 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::hd97ec26bf3a98036
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:896
  33:     0x7f58e728e628 - rustc_driver::driver::phase_3_run_analysis_passes::h6d446abb74c09795
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1033
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/local.rs:245
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1030
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1017
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/local.rs:245
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:1014
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc/ty/context.rs:782
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:866
  34:     0x7f58e727e3d2 - rustc_driver::driver::compile_input::h8e119234b60571d5
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/driver.rs:172
  35:     0x7f58e72c4418 - rustc_driver::run_compiler::h57c4f233cd1a0c04
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:221
  36:     0x7f58e71de938 - std::panicking::try::do_call::hf679f17bf3b43b0b
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:1117
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:137
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/librustc_driver/lib.rs:1051
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:295
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:356
  37:     0x7f58e6f0907a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libpanic_unwind/lib.rs:97
  38:     0x7f58e7201558 - <F as alloc::boxed::FnBox<A>>::call_box::h21b5b32059700da6
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panicking.rs:332
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/panic.rs:351
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/thread/mod.rs:287
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/liballoc/boxed.rs:595
  39:     0x7f58e6efd4f4 - std::sys::imp::thread::Thread::new::thread_start::h8084b1107992ae5b
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/liballoc/boxed.rs:605
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys_common/thread.rs:21
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libstd/sys/unix/thread.rs:84
  40:     0x7f58df0f66c9 - start_thread
  41:     0x7f58e6bbb0ae - __clone
  42:                0x0 - <unknown>

@petrochenkov
Copy link
Contributor

Probably a consequence of #37676, that was the only PR that touched stability for long time.
cc @eddyb

@arielb1 arielb1 added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 16, 2016
@durka
Copy link
Contributor

durka commented Dec 16, 2016

cc #38087 @jseyfried

@petrochenkov
Copy link
Contributor

@durka
All that is green is not @jseyfried 😄
#38087 only turns the error into ICE (correctly), but some other commit introduced this error in the first place, it doesn't appear on stable or beta.
Minimized reproduction:

fn main() {
    let Box(a);
}

@arielb1
Copy link
Contributor

arielb1 commented Dec 22, 2016

Now a regression to beta.

@arielb1 arielb1 added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Dec 22, 2016
@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Dec 22, 2016
@pnkfelix
Copy link
Member

pnkfelix commented Dec 28, 2016

(for anyone else who like me is looking to applying bisection here: note that the build system changed during the same time span that one might start with for the bisection, and so you need to invoke the correct build system depending on where you are in the history. Furthermore, the build products go into different places depending on which build system you use, so if you're like me and not paying attention, you'll end up repeatedly invoking a build that came from the more recent build system even as you keep working your way back through the history via git bisect bad...)

update: if you're curious as to how I could possibly have been doing builds with different build systems and not noticed, the answer is that I have a wrapper script that attempts to infer which build system to use.

@petrochenkov
Copy link
Contributor

petrochenkov commented Dec 29, 2016

I think I know what is the reason.
After #37676 stability checks on fields/methods are performed during type checking, i.e. before the privacy checking pass.
Private fields/methods are obviously lacking stability attributes, i.e. they are "unmarked API".
Privacy checking pass aborted compilation on errors end prevented pre-#37676 stability pass from checking private stuff, now this doesn't happen.

@pnkfelix
Copy link
Member

pnkfelix commented Dec 29, 2016

a hypothesis: Did we start running the stability checking pass (which as I understand it is the thing emitting the "unmarked api" errors) before we check for privacy violations?

update: heh, I clearly added this comment without refreshing the page, so I missed @petrochenkov coming to the same conclusion.

@brson
Copy link
Contributor

brson commented Dec 29, 2016

This'll need a backport to 1.15, and we've got about 3 weeks to get it in.

pnkfelix added a commit to pnkfelix/rust that referenced this issue Jan 3, 2017
Includes special case handling for trait methods.

Fix rust-lang#38412.
@eddyb eddyb removed their assignment Jan 5, 2017
bors added a commit that referenced this issue Jan 5, 2017
…, r=nikomatsakis

Dont check stability for items that are not pub to universe.

Dont check stability for items that are not pub to universe.

In other words, skip it for private and even `pub(restricted)` items, because stability checks are only relevant to things visible in other crates.

Fix #38412.
nikomatsakis pushed a commit to nikomatsakis/rust that referenced this issue Jan 6, 2017
Includes special case handling for trait methods.

Fix rust-lang#38412.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants