Skip to content

Commit 3f2f695

Browse files
authored
Rollup merge of #135310 - estebank:issue-135289, r=Nadrieril
Always force non-trimming of path in `unreachable_patterns` lint Creating a "trimmed DefID path" when no error is being emitted is an ICE (on purpose). If we create a trimmed path for a lint that is then silenced before being emitted causes a known ICE. This side-steps the issue by always using `with_no_trimmed_path!`. This was verified to fix https://github.com/quinn-rs/quinn/, but couldn't write a repro case for the test suite. Fix #135289.
2 parents 1419f79 + 93a1950 commit 3f2f695

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

compiler/rustc_mir_build/src/thir/pattern/check_match.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1086,14 +1086,7 @@ fn find_fallback_pattern_typo<'tcx>(
10861086
let vis = cx.tcx.visibility(item.owner_id);
10871087
if vis.is_accessible_from(parent, cx.tcx) {
10881088
accessible.push(item_name);
1089-
let path = if item_name == name {
1090-
// We know that the const wasn't in scope because it has the exact
1091-
// same name, so we suggest the full path.
1092-
with_no_trimmed_paths!(cx.tcx.def_path_str(item.owner_id))
1093-
} else {
1094-
// The const is likely just typoed, and nothing else.
1095-
cx.tcx.def_path_str(item.owner_id)
1096-
};
1089+
let path = with_no_trimmed_paths!(cx.tcx.def_path_str(item.owner_id));
10971090
accessible_path.push(path);
10981091
} else if name == item_name {
10991092
// The const exists somewhere in this crate, but it can't be imported

0 commit comments

Comments
 (0)