Skip to content

Commit 75d940f

Browse files
committed
Use do yeet () and do yeet _ instead of None? and Err(_)? in compiler
This prevents breakage when `?` no longer skews inference.
1 parent defcc44 commit 75d940f

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

compiler/rustc_expand/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#![feature(proc_macro_internals)]
1313
#![feature(proc_macro_span)]
1414
#![feature(try_blocks)]
15+
#![feature(yeet_expr)]
1516
#![allow(rustc::diagnostic_outside_of_impl)]
1617
#![allow(internal_features)]
1718

compiler/rustc_expand/src/module.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(crate) fn parse_external_mod(
6262

6363
// Ensure file paths are acyclic.
6464
if let Some(pos) = module.file_path_stack.iter().position(|p| p == &mp.file_path) {
65-
Err(ModError::CircularInclusion(module.file_path_stack[pos..].to_vec()))?;
65+
do yeet ModError::CircularInclusion(module.file_path_stack[pos..].to_vec());
6666
}
6767

6868
// Actually parse the external file as a module.

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
990990
let generics_def_id = tcx.res_generics_def_id(path.res)?;
991991
let generics = tcx.generics_of(generics_def_id);
992992
if generics.has_impl_trait() {
993-
None?;
993+
do yeet ();
994994
}
995995
let insert_span =
996996
path.segments.last().unwrap().ident.span.shrink_to_hi().with_hi(path.span.hi());
@@ -1044,7 +1044,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
10441044
let generics = tcx.generics_of(def_id);
10451045
let segment: Option<_> = try {
10461046
if !segment.infer_args || generics.has_impl_trait() {
1047-
None?;
1047+
do yeet ();
10481048
}
10491049
let span = tcx.hir().span(segment.hir_id);
10501050
let insert_span = segment.ident.span.shrink_to_hi().with_hi(span.hi());

compiler/rustc_infer/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#![feature(iterator_try_collect)]
2828
#![cfg_attr(bootstrap, feature(min_specialization))]
2929
#![feature(try_blocks)]
30+
#![feature(yeet_expr)]
3031
#![recursion_limit = "512"] // For rustdoc
3132

3233
#[macro_use]

0 commit comments

Comments
 (0)