Expand fixme comments

This commit is contained in:
Dawer 2021-06-01 01:44:51 +05:00
parent 31b6a750f8
commit e7c49666be
4 changed files with 9 additions and 3 deletions

View file

@ -166,7 +166,10 @@ impl Path {
}
/// Converts a known mod path to `Path`.
pub fn from_known_path(path: ModPath, generic_args: Vec<Option<Interned<GenericArgs>>>) -> Path {
pub fn from_known_path(
path: ModPath,
generic_args: Vec<Option<Interned<GenericArgs>>>,
) -> Path {
Path { type_anchor: None, mod_path: Interned::new(path), generic_args }
}

View file

@ -376,6 +376,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
// https://github.com/rust-lang/rust/blob/25c15cdbe/compiler/rustc_mir_build/src/thir/pattern/check_match.rs#L200-L201
let witnesses = report.non_exhaustiveness_witnesses;
// FIXME Report witnesses
// eprintln!("compute_match_usefulness(..) -> {:?}", &witnesses);
if !witnesses.is_empty() {
if let Ok(source_ptr) = source_map.expr_syntax(id) {

View file

@ -864,7 +864,8 @@ impl Fields {
pat: PatId,
cx: &MatchCheckCtx<'_>,
) -> Self {
// FIXME(iDawer): these alocations and clones are so unfortunate (+1 for switching to references)
// FIXME(iDawer): Factor out pattern deep cloning. See discussion:
// https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640
let mut arena = cx.pattern_arena.borrow_mut();
match arena[pat].kind.as_ref() {
PatKind::Deref { subpattern } => {

View file

@ -376,9 +376,10 @@ impl PatIdExt for PatId {
fn expand_or_pat(self, cx: &MatchCheckCtx<'_>) -> Vec<Self> {
fn expand(pat: PatId, vec: &mut Vec<PatId>, pat_arena: &mut PatternArena) {
if let PatKind::Or { pats } = pat_arena[pat].kind.as_ref() {
// FIXME(iDawer): Factor out pattern deep cloning. See discussion:
// https://github.com/rust-analyzer/rust-analyzer/pull/8717#discussion_r633086640
let pats = pats.clone();
for pat in pats {
// FIXME(iDawer): Ugh, I want to go back to references (PatId -> &Pat)
let pat = pat_arena.alloc(pat.clone());
expand(pat, vec, pat_arena);
}