-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
ICE: "no MIR available for DefId(...)" #97708
Comments
I'll see if I can make a smaller repro case |
So, the minimal repro case is MUCH smaller: in [dependencies.maitake]
git = "https://github.com/hawkw/mycelium.git"
rev = "bde817203af5b21591cdca0d257173c1e57b20fe"
features = ["alloc"]
default-features = false In use maitake::scheduler::TaskStub;
static TASK_STUB: TaskStub = TaskStub::new();
fn main() { } Which points to these code chunks:
This seems to work in the tests for |
CC @hawkw |
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Yeah, this seems to occur specifically when trying to compile an external crate that calls this function. Lib tests inside the crate that call the function don't ICE, but adding an integration test (outside of the crate's compilation unit) does trigger the ICE: hawkw/mycelium@e1c5085 |
If the function is made |
@rustbot prioritize |
...and, if the functions are made |
this makes the nop fns #[doc(hidden)] pub`. the `Header` type is moved to a private module and made `pub`. @jamesmunns if you have a better solution, let's do that Signed-off-by: Eliza Weisman <eliza@buoyant.io>
See rust-lang/rust#97708 for more details
It also appears that if you move the functions out of the See this PR for addressing: hawkw/mycelium#190 |
See rust-lang/rust#97708 for more details
For folks joining now/as a TL;DR, the offending code is basically this: // in the "Header" type, which is a private type in maitake
pub(crate) const fn new_stub() -> Self {
unsafe fn nop(_ptr: TaskRef) -> Poll<()> {
#[cfg(debug_assertions)]
unreachable!("stub task ({_ptr:?}) should never be polled!");
#[cfg(not(debug_assertions))]
Poll::Pending
}
unsafe fn nop_deallocate(ptr: NonNull<Header>) {
unreachable!("stub task ({ptr:p}) should never be deallocated!");
}
Self {
run_queue: mpsc_queue::Links::new_stub(),
state: StateCell::new(),
vtable: &Vtable {
poll: nop,
deallocate: nop_deallocate,
},
}
} The // This is a public type in `maitake`
#[repr(transparent)]
#[cfg_attr(loom, allow(dead_code))]
pub struct TaskStub {
hdr: Header,
}
impl TaskStub {
/// Create a new unique stub [`Task`].
pub const fn new() -> Self {
Self {
hdr: Header::new_stub(),
}
}
} Which gets loaded into a static in user code: use maitake::scheduler::TaskStub;
static TASK_STUB: TaskStub = TaskStub::new();
fn main() { } It LOOKS like somehow the two original functions (declared inside a private, const fn; inside a private type), are getting culled, which means that when the static (in another compilation unit) goes to be created, the MIR for those functions are missing. |
This is likely a disagreement between Though I don't know much about codegen. |
Anyways I think I have a fix, though I am not certain it's the right one. In any case, I at least have a minimized UI test for rustc devs who know codegen better than me. PR incoming. |
…eywiser Fix reachability analysis for const methods Use `method_might_be_inlined` directly for `ImplItemKind::Fn` instead of duplicating the logic in `def_id_represents_local_inlined_item`. This is parallel to how we use `item_might_be_inlined` for `ItemKind::Fn` in that same body. Fixes rust-lang#97708
Code
Github: https://github.com/jamesmunns/pellegrino/tree/ice-2022-06-03/oaiu/melpomene
Repro:
Meta
Reproduces in:
Error output
Backtrace
The text was updated successfully, but these errors were encountered: