You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using impl Trait with closure local functions across crates results in ICE #43135
Having an impl Trait type, containing a closure, where the closure has a locally defined function inside it, being passed across crate boundaries, results in an ICE.
The following function, defined in one crate, then used in another:
Actually, it looks like defining the function inside the closure is not needed, even just a private helper function in the crate that is only called from the closure will trigger this, e.g.
Thanks. Using #[inline] seem to fix some occurances but not all. I still get the error for this method:
#[inline]fnlogin<'a>(&'aself) -> implFuture<Item = String,Error = Error> + 'a{let req = self.prepare_login_request();result(req).and_then(move |resp| check_http_status_parse_body(resp, hyper::Ok)).and_then(move |api_resp| {// check if the authentication was successfulif&api_resp.status.reqStatus[..] == "SUCCESS"{if api_resp.status.credentials.is_some(){// save a copy of the token to be returned laterlet to_return = api_resp.status.credentials.as_ref().unwrap().clone();// add the data to cachedebug!("Login successful! Caching the response");let to_store = Arc::new(api_resp);// add the data to the cacheself.cache.insert_new(self.auth_url.clone(), to_store);// return the tokenok(to_return)}else{err(Error::Auth)}}else{err(Error::Auth)}})}
The error I get:
error: internal compiler error: /checkout/src/librustc_trans/collector.rs:735: Cannot create local trans-item for DefId { krate: CrateNum(12), node: DefIndex(744) => ecmclient/ef9542a::{{impl}}[1]::login[0]::{{closure}}[1]::_LOC[0] }
Activity
Nemo157 commentedon Jul 9, 2017
Actually, it looks like defining the function inside the closure is not needed, even just a private helper function in the crate that is only called from the closure will trigger this, e.g.
ishitatsuyuki commentedon Aug 7, 2017
Stack trace:
Workaround rust-lang/rust#43135
mhristache commentedon Aug 12, 2017
I am also hitting this ICE. Is there a workaround?
ishitatsuyuki commentedon Aug 12, 2017
@maximih Yes. Marking #[inline] as you encounter the error.
mhristache commentedon Aug 13, 2017
Thanks. Using #[inline] seem to fix some occurances but not all. I still get the error for this method:
The error I get:
Auto merge of #43857 - michaelwoerister:fix-impl-trait-closure-vis, r…
plietar commentedon Aug 30, 2017
I can't reproduce the original ICE, which was presumably fixed by #43857. This issue can probably be closed.
I'm however running into this ICE with generators, and have opened #44181 for that.
ishitatsuyuki commentedon Nov 1, 2017
Triage: close? @Mark-Simulacrum