Stream: t-compiler/rust-analyzer

Topic: Multiline details assertion


Kirill Bulatov (Jan 15 2021 at 22:52, on Zulip):

I'm experimenting with trait autocompletions on something more or less real and stumbled on lots of assertion failures with itertools:

[ERROR rust_analyzer] assertion failed at crates/completion/src/item.rs:404:13: multiline detail: fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T>
where Self: Sized + Clone + Iterator<Item = T::Item> + ExactSizeIterator,
              T: tuple_impl::TupleCollect + Clone,
              T::Item: Clone

The assertion is assert_never!(detail.contains('\n'), "multiline detail: {}", detail); (here, disregard the line number in the assertion message, it's different due to my changes) and circular_tuple_windows is the itertools function

So, should we normalize such details or rather remove the assertion?

matklad (Jan 16 2021 at 13:37, on Zulip):

The detail is the thing shown in completion popup next to the item

matklad (Jan 16 2021 at 13:39, on Zulip):

Screenshot_20210116_163807.png

matklad (Jan 16 2021 at 13:40, on Zulip):

The editor shows a silgle line there, so its important that we put something reasonable there

matklad (Jan 16 2021 at 13:45, on Zulip):

Looking at the intellij, it makes sense to just put a return type there?

image.png

Kirill Bulatov (Jan 16 2021 at 15:24, on Zulip):

In this case, looks like we can discard anything that's after the first \n? Not like we want to display where block there anyway.

matklad (Jan 17 2021 at 08:02, on Zulip):

That'd would work as a quick patch, but I'd rather just manually assemble the string to not have \n in the first place

Kirill Bulatov (Jan 17 2021 at 08:58, on Zulip):

Sure, I'll look at it at some point after the trait imports are merged, thank you for guiding.

Laurențiu (Jan 17 2021 at 14:54, on Zulip):

Do we want to do this for tonight's release?

matklad (Jan 17 2021 at 15:02, on Zulip):

those are just logs assert_always, so this should be fine

Laurențiu (Jan 17 2021 at 15:02, on Zulip):

Yeah, but it's pretty spammy

matklad (Jan 17 2021 at 15:09, on Zulip):

yeah, we might as well us assert fully...

matklad (Jan 22 2021 at 16:06, on Zulip):

https://github.com/rust-analyzer/rust-analyzer/pull/7396

Last update: Jul 29 2021 at 08:45UTC