Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7e79dcd
Drive-by fix string fmt
estebank Mar 9, 2024
2d3435b
Detect calls to `.clone()` on `T: !Clone` types on borrowck errors
estebank Mar 9, 2024
b367c25
Tweak wording
estebank Mar 9, 2024
0953608
Account for UnOps in borrowck message
estebank Mar 12, 2024
8da2621
print ghosts
Manishearth Mar 14, 2024
343c77c
Refactor visibility_print_with_space to directly take an item
Manishearth Mar 14, 2024
1020156
print doc(hidden)
Manishearth Mar 14, 2024
bd03fad
Make compact
Manishearth Mar 14, 2024
2602820
tests
Manishearth Mar 14, 2024
580e5b8
inline
Manishearth Mar 14, 2024
9718144
fix polarity
Manishearth Mar 14, 2024
dc35339
Safe Transmute: Use 'not yet supported', not 'unspecified' in errors
jswrenn Mar 15, 2024
19bc337
Add `rustc_never_type_mode` crate-level attribute to allow experimenting
WaffleLapkin Mar 15, 2024
adfdd27
Add `rustc_never_type_mode = "no_fallback"`
WaffleLapkin Mar 15, 2024
e1e719e
Mention labelled blocks in `break` docs
Wilfred Mar 15, 2024
107807d
Safe Transmute: lowercase diagnostics
jswrenn Mar 15, 2024
0754595
CI: cache PR CI Docker builds
Kobzol Mar 15, 2024
9e153cc
Rollup merge of #122254 - estebank:issue-48677, r=oli-obk
matthiaskrgr Mar 15, 2024
57f2104
Rollup merge of #122495 - Manishearth:rustdoc-👻👻👻, r=GuillaumeGomez
matthiaskrgr Mar 15, 2024
82d5b56
Rollup merge of #122543 - WaffleLapkin:never-flags, r=compiler-errors
matthiaskrgr Mar 15, 2024
b482523
Rollup merge of #122560 - jswrenn:not-yet-supported, r=compiler-errors
matthiaskrgr Mar 15, 2024
1745f3d
Rollup merge of #122562 - Wilfred:break_keyword_docs, r=workingjubilee
matthiaskrgr Mar 15, 2024
948e031
Rollup merge of #122563 - Kobzol:ci-pr-caching, r=Mark-Simulacrum
matthiaskrgr Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add rustc_never_type_mode = "no_fallback"
  • Loading branch information
WaffleLapkin committed Mar 15, 2024
commit adfdd273ae2bf79aa3bb1f7b453e4df9c188a781
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
),

rustc_attr!(
rustc_never_type_mode, Normal, template!(NameValueStr: "fallback_to_unit|fallback_to_niko|no_fallback"), ErrorFollowing,
rustc_never_type_mode, Normal, template!(NameValueStr: "fallback_to_unit|fallback_to_niko|fallback_to_never|no_fallback"), ErrorFollowing,
@only_local: true,
"`rustc_never_type_fallback` is used to experiment with never type fallback and work on \
never type stabilization, and will never be stable"
Expand Down
18 changes: 16 additions & 2 deletions compiler/rustc_hir_typeck/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ enum DivergingFallbackBehavior {
FallbackToUnit,
/// Sometimes fallback to `!`, but mainly fallback to `()` so that most of the crates are not broken.
FallbackToNiko,
/// Always fallback to `!` (which should be equivalent to never falling back + not making
/// never-to-any coercions unless necessary)
FallbackToNever,
/// Don't fallback at all
NoFallback,
}
Expand Down Expand Up @@ -107,9 +110,10 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
match mode {
sym::fallback_to_unit => DivergingFallbackBehavior::FallbackToUnit,
sym::fallback_to_niko => DivergingFallbackBehavior::FallbackToNiko,
sym::fallback_to_never => DivergingFallbackBehavior::FallbackToNever,
sym::no_fallback => DivergingFallbackBehavior::NoFallback,
_ => {
self.tcx.dcx().span_err(span, format!("unknown never type mode: `{mode}` (supported: `fallback_to_unit`, `fallback_to_niko`, and `no_fallback`)"));
self.tcx.dcx().span_err(span, format!("unknown never type mode: `{mode}` (supported: `fallback_to_unit`, `fallback_to_niko`, `fallback_to_never` and `no_fallback`)"));

DivergingFallbackBehavior::FallbackToUnit
}
Expand Down Expand Up @@ -426,8 +430,18 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
diverging_fallback.insert(diverging_ty, self.tcx.types.never);
}
}
FallbackToNever => {
debug!(
"fallback to ! - `rustc_never_type_mode = \"fallback_to_never\")`: {:?}",
diverging_vid
);
diverging_fallback.insert(diverging_ty, self.tcx.types.never);
}
NoFallback => {
debug!("no fallback - `rustc_never_type_mode = "no_fallback"`: {:?}", diverging_vid);
debug!(
"no fallback - `rustc_never_type_mode = \"no_fallback\"`: {:?}",
diverging_vid
);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ symbols! {
fadd_algebraic,
fadd_fast,
fake_variadic,
fallback_to_never,
fallback_to_niko,
fallback_to_unit,
fdiv_algebraic,
Expand Down