-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Assertion failed in erroneous recursive types with methods returning a impl Trait
type
#72554
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Error: The feature Please let |
Oh, we must have enabled this... Sorry for the noise! |
Enable `glacier` command via triagebot I noticed this was required by rust-lang#72554 (comment).
I think now we could... |
Making the following change: fn drain_fulfillment_cx_or_panic<T>(
infcx: &InferCtxt<'_, 'tcx>,
fulfill_cx: &mut FulfillmentContext<'tcx>,
result: &T,
) -> T
where
T: TypeFoldable<'tcx>,
{
debug!("drain_fulfillment_cx_or_panic()");
// In principle, we only need to do this so long as `result`
// contains unbound type parameters. It could be a slight
// optimization to stop iterating early.
if let Err(errors) = fulfill_cx.select_all_or_error(infcx) {
+ // `select_all_or_error` can return an empty `Vec<FulfillmentError>` when you have a bad
+ // interation of `impl Trait` in return position and a recursive ADT without indirection
+ // (#72554).
+ if !errors.is_empty() {
+ infcx.tcx.sess.delay_span_bug(
+ rustc_span::DUMMY_SP,
+ "`select_all_or_error` failed but no errors where present",
+ );
+ } else {
bug!("encountered errors `{:?}` resolving bounds after type-checking", errors);
+ }
}
let result = infcx.resolve_vars_if_possible(result);
infcx.tcx.erase_regions(&result)
}
makes the output look correct, but I am not sure of whether that should be the fix, making it always a |
Triage: Seems the ICE is fixed with the latest nightly, now |
…ure, r=matthewjasper Add regression test for rust-lang#72554 Fix rust-lang#72554.
Rollup of 6 pull requests Successful merges: - rust-lang#72718 (Add regression test for rust-lang#72554) - rust-lang#72782 (rustc_target: Remove `pre_link_args_crt`) - rust-lang#72923 (Improve E0433, so that it suggests missing imports) - rust-lang#72950 (fix `AdtDef` docs) - rust-lang#72951 (Add Camelid per request) - rust-lang#72964 (Bump libc dependency to latest version (0.2.71)) Failed merges: r? @ghost
Update src/librustc_resolve/diagnostics.rs Co-authored-by: David Wood <Q0KPU0H1YOEPHRY1R2SN5B5RL@david.davidtw.co> Minor refactoring rust-lang#72642 Fixed failing test-cases remove trivial `mk_predicate`s Make `SourceMap` available for early debug-printing of `Span`s Normally, we debug-print `Spans` using the `SourceMap` retrieved from the global `TyCtxt`. However, we fall back to printing out the `Span`'s raw fields (instead of a file and line number) when we try to print a `Span` before a `TyCtxt` is available. This makes debugging early phases of the compile, such as parsing, much more difficult. This commit stores a `SourceMap` in `rustc_span::GlOBALS` as a fallback. When a `TyCtxt` is not available, we try to retrieve one from `GLOBALS` - only if this is not available do we fall back to the raw field output. I'm not sure how to write a test for this - however, this can be verified locally by setting `RUSTC_LOG="rustc_parse=debug"`, and verifying that the output contains filenames and line numbers. Add test for rust-lang#72554. rustc_target: Remove `pre_link_args_crt` Improve E0433, so that it suggests missing imports Fix a typo in `late.rs` Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com> fix `AdtDef` docs Add Camelid Email from @camelid: > HI there, > > I’m a new contributor and I just looked at Rust Thanks and noticed that my contributions are listed under two different capitalizations of my name: “Camelid" and “camelid". Could you make them both “Camelid"? > > Thanks! > > Camelid save_analysis: work on HIR tree instead of AST Update `rls` submodule remove outdated fixme Hexagon libstd: fix typo for c_ulonglong Add more assert to Vec with_capacity docs Show assertion on len too to show them how adding new items will affect both the length and capacity, before and after. Add Kyle Strand to mailmap Fix missing word in RELEASES.md Update cargo Enable lld for Cargo tests on Windows. Fixed failing test-cases rust-lang#72642
Summary
Box<_>
) having methods whose return type isimpl Trait
causes the assertion failure.I tried this code:
I expected to see this happen:
ElemDerived
has infinite size."impl Trait
, we got the following normal error messages:Instead, this happened:
rustc
aborted with the following assertion failure.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: