Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fd82481
Only use dlltool.exe on MinGW if -Cdlltool is passed
bjorn3 Aug 13, 2026
299213f
PassWrapper: handle LLVM 24 change in function types
durin42 Aug 14, 2026
50b867f
PassWrapper: clang-format
durin42 Aug 14, 2026
af7623a
add crashtests
cyrgani Aug 18, 2026
afcb367
Don't treat slashes as path seps after drive letters in verbatim paths
maxdexh Aug 24, 2026
97967de
Add new `unescaped_pipe_in_table_cell` rustdoc lint
GuillaumeGomez Jul 19, 2026
dbe2c8e
Add ui regression test for new rustdoc `unescaped_pipe_in_table_cell`…
GuillaumeGomez Jul 19, 2026
f74d66c
Add documentation for rustdoc `unescaped_pipe_in_table_cell` lint
GuillaumeGomez Jul 19, 2026
fe90bb2
Rename lint `unescaped_pipe_in_table_cell` into `invalid_markdown_table`
GuillaumeGomez Jul 24, 2026
67bfe3a
Also warn in case there is content after the last table cell
GuillaumeGomez Jul 24, 2026
df734af
rustdoc: clean up some unneeded table lint code
notriddle Jul 24, 2026
aeb0d4a
Update lint to new rustdoc table lint
GuillaumeGomez Aug 24, 2026
1f7f241
Fix whitespace.
durin42 Aug 24, 2026
6656056
Set never type fallback to always be `!`
WaffleLapkin Aug 14, 2025
6ed4ce5
stabilize the never type (`!`)
WaffleLapkin Aug 15, 2025
977c3a7
fixup clippy::empty_enums
WaffleLapkin Aug 15, 2025
f34322b
remove `#![feature(never_type)]` from the compiler
WaffleLapkin Aug 15, 2025
046ebb7
remove `#![feature(never_type)]` from tests
WaffleLapkin Aug 15, 2025
3de37a2
remove `#![feature(never_type)]` from library
WaffleLapkin Aug 15, 2025
00745cc
remove `#![feature(never_type)]` from tools
WaffleLapkin Aug 15, 2025
2b466a3
bless tests
WaffleLapkin Aug 15, 2025
ab2a410
bless mir-opt tests
WaffleLapkin Apr 5, 2026
9b02a7e
update tests which depended on never fallback to `()`
WaffleLapkin Mar 9, 2026
11eebd5
remove `dependency_on_unit_never_type_fallback` lint
WaffleLapkin Apr 6, 2026
e9d08de
remove stray stderr files
WaffleLapkin Apr 6, 2026
39c6cac
make `never_type_fallback_flowing_into_unsafe` a non-FCW lint
WaffleLapkin Jun 24, 2026
cfc82eb
Make `Infallible = !`
WaffleLapkin Aug 15, 2025
3419a3c
remove unreachable code
WaffleLapkin Aug 14, 2026
748439c
fixup tests to account for `Infallible = !`
WaffleLapkin Aug 15, 2025
b74b72b
bless mir-opt tests
WaffleLapkin Apr 5, 2026
0a35c2a
Bump the stdlib semver check stamp
JonathanBrouwer Aug 24, 2026
b76a5ca
Rollup merge of #155499 - WaffleLapkin:stabilize-never-type, r=Jonath…
JonathanBrouwer Aug 24, 2026
fe36a49
Rollup merge of #161294 - cyrgani:tests-6, r=fmease
JonathanBrouwer Aug 24, 2026
58148d2
Rollup merge of #161050 - bjorn3:default_no_dlltool, r=mati865
JonathanBrouwer Aug 24, 2026
5cc00bc
Rollup merge of #159583 - GuillaumeGomez:unescaped_pipe_in_table_cell…
JonathanBrouwer Aug 24, 2026
92d1a39
Rollup merge of #161098 - durin42:llvm-24-llvm-any-change, r=cuviper
JonathanBrouwer Aug 24, 2026
aacd3a9
Rollup merge of #161661 - maxdexh:least-cursed-windows-feature, r=Chr…
JonathanBrouwer Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
// tidy-alphabetical-start
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]
#![feature(never_type)]
#![feature(rustc_attrs)]
#![feature(unwrap_infallible)]
// tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// tidy-alphabetical-start
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(never_type))]
#![cfg_attr(feature = "nightly", cfg_attr(bootstrap, feature(never_type)))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
// tidy-alphabetical-end

Expand Down
12 changes: 0 additions & 12 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
// Function pointers cannot be `const`
self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params);
}
ast::TyKind::Never => {
gate!(self, never_type, ty.span, "the `!` type is experimental");
}
ast::TyKind::Pat(..) => {
gate!(self, pattern_types, ty.span, "pattern types are unstable");
}
Expand Down Expand Up @@ -294,15 +291,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}

fn visit_generic_args(&mut self, args: &'a ast::GenericArgs) {
// This check needs to happen here because the never type can be returned from a function,
// but cannot be used in any other context. If this check was in `visit_fn_ret_ty`, it
// include both functions and generics like `impl Fn() -> !`.
if let ast::GenericArgs::Parenthesized(generic_args) = args
&& let ast::FnRetTy::Ty(ref ty) = generic_args.output
&& matches!(ty.kind, ast::TyKind::Never)
{
gate!(self, never_type, ty.span, "the `!` type is experimental");
}
visit::walk_generic_args(self, args);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(default_field_values)]
#![feature(deref_patterns)]
#![feature(file_buffered)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_ssa/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ pub trait ArchiveBuilderBuilder {
items: Vec<ImportLibraryItem>,
output_path: &Path,
) {
if common::is_mingw_gnu_toolchain(&sess.target) {
// The binutils linker used on -windows-gnu targets cannot read the import
// libraries generated by LLVM: in our attempts, the linker produced an .EXE
// that loaded but crashed with an AV upon calling one of the imported
// functions. Therefore, use binutils to create the import library instead,
// by writing a .DEF file to the temp dir and calling binutils's dlltool.
if common::is_mingw_gnu_toolchain(&sess.target) && sess.opts.cg.dlltool.is_some() {
// Previously we always used dlltool on -windows-gnu targets due to the binutils
// linker not entirely correctly handling import libraries generated by
// LLVM/ar_archive_writer. This has since been fixed. To ease the transition, will
// temporarily still use dlltool if explicitly specified, but use ar_archive_writer
// like on MSVC if not.
create_mingw_dll_import_lib(sess, lib_name, items, output_path);
} else {
trace!("creating import library");
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(array_try_map)]
#![feature(decl_macro)]
#![feature(deref_patterns)]
#![feature(never_type)]
#![feature(slice_ptr_get)]
#![feature(trait_alias)]
#![feature(unqualified_local_imports)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![allow(internal_features)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_api)]
Expand All @@ -24,7 +25,6 @@
#![feature(map_try_insert)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(nonzero_internals)]
#![feature(pattern_type_macro)]
#![feature(pattern_types)]
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0725.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ command line flags.
Erroneous code example:

```ignore (can't specify compiler flags from doctests)
#![feature(never_type)] // error: the feature `never_type` is not in
// the list of allowed features
#![feature(extern_item_impls)]
//~^ error: the feature `extern_item_impls`
// is not in the list of allowed features
```

Delete the offending feature attribute, or add it to the list of allowed
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
//! This module contains the code for creating and emitting diagnostics.

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(default_field_values)]
#![feature(macro_metavar_expr_concat)]
#![feature(negative_impls)]
#![feature(never_type)]
// tidy-alphabetical-end

extern crate self as rustc_errors;
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ declare_features! (
(accepted, native_link_modifiers_verbatim, "1.67.0", Some(81490)),
/// Allows specifying the whole-archive link modifier
(accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490)),
/// Allows the `!` type.
(accepted, never_type, "CURRENT_RUSTC_VERSION", Some(35121)),
/// Allows using non lexical lifetimes (RFC 2094).
(accepted, nll, "1.63.0", Some(43234)),
/// Allows using `#![no_std]`.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,6 @@ declare_features! (
(unstable, negative_impls, "1.44.0", Some(68318)),
/// Allows the `!` pattern.
(incomplete, never_patterns, "1.76.0", Some(118155)),
/// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
(unstable, never_type, "1.13.0", Some(35121)),
/// Switch `..` syntax to use the new (`Copy + IntoIterator`) range types.
(unstable, new_range, "1.86.0", Some(123741)),
/// Allows `#![no_core]`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(closure_track_caller)]
#![feature(const_default)]
#![feature(const_trait_impl)]
#![feature(default_field_values)]
#![feature(derive_const)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#![recursion_limit = "256"]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ This API is completely unstable and subject to change.
*/

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(default_field_values)]
#![feature(gen_blocks)]
#![feature(iter_intersperse)]
#![feature(never_type)]
#![feature(slice_partition_dedup)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]
Expand Down
13 changes: 1 addition & 12 deletions compiler/rustc_hir_typeck/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use rustc_errors::{
use rustc_hir as hir;
use rustc_hir::ExprKind;
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::{self, Ty};
use rustc_middle::ty::Ty;
use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
use rustc_span::{Ident, Span, Spanned, Symbol};

Expand Down Expand Up @@ -262,17 +262,6 @@ pub(crate) enum NeverTypeFallbackFlowingIntoUnsafe {
},
}

#[derive(Diagnostic)]
#[help("specify the types explicitly")]
#[diag("this function depends on never type fallback being `()`")]
pub(crate) struct DependencyOnUnitNeverTypeFallback<'tcx> {
#[note("in edition 2024, the requirement `{$obligation}` will fail")]
pub obligation_span: Span,
pub obligation: ty::Predicate<'tcx>,
#[subdiagnostic]
pub sugg: SuggestAnnotations,
}

#[derive(Clone)]
pub(crate) enum SuggestAnnotation {
Unit(Span),
Expand Down
62 changes: 2 additions & 60 deletions compiler/rustc_hir_typeck/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ use rustc_hir::def_id::DefId;
use rustc_hir::intravisit::{InferKind, Visitor};
use rustc_hir::{self as hir, CRATE_HIR_ID, HirId};
use rustc_lint_defs::builtin::{
DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK, FLOAT_LITERAL_F32_FALLBACK,
NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE,
FLOAT_LITERAL_F32_FALLBACK, NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE,
};
use rustc_middle::ty::{self, FloatVid, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable};
use rustc_span::def_id::LocalDefId;
use rustc_span::{DUMMY_SP, Span};
use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt, TraitEngine};
use rustc_trait_selection::traits::TraitEngine;
use tracing::debug;

use crate::{FnCtxt, diagnostics};
Expand Down Expand Up @@ -237,11 +236,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
// a type variable is that is coerced
let coercion_graph = self.create_coercion_graph();

self.lint_obligations_broken_by_never_type_fallback_change(
&diverging_root_vids,
&coercion_graph,
);

if !diverging_root_vids.is_empty() {
let unsafe_infer_vars = compute_unsafe_infer_vars(self, self.body_def_id);

Expand Down Expand Up @@ -305,58 +299,6 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
}
}

fn lint_obligations_broken_by_never_type_fallback_change(
&self,
diverging_vids: &[ty::TyVid],
coercions: &VecGraph<ty::TyVid, true>,
) {
let DivergingFallbackBehavior::ToUnit = self.diverging_fallback_behavior else { return };

// Fallback happens if and only if there are diverging variables
if diverging_vids.is_empty() {
return;
}

// Returns errors which happen if fallback is set to `fallback`
let remaining_errors_if_fallback_to = |fallback| {
self.probe(|_| {
let obligations = self.fulfillment_cx.borrow().pending_obligations();
let ocx = ObligationCtxt::new_with_diagnostics(&self.infcx);
ocx.register_obligations(obligations.iter().cloned());

for &diverging_vid in diverging_vids {
let diverging_ty = Ty::new_var(self.tcx, diverging_vid);

ocx.eq(&ObligationCause::dummy(), self.param_env, diverging_ty, fallback)
.expect("expected diverging var to be unconstrained");
}

ocx.try_evaluate_obligations()
})
};

// If we have no errors with `fallback = ()`, but *do* have errors with `fallback = !`,
// then this code will be broken by the never type fallback change.
let unit_errors = remaining_errors_if_fallback_to(self.tcx.types.unit);
if unit_errors.no_errors()
&& let mut never_errors = remaining_errors_if_fallback_to(self.tcx.types.never)
&& let [never_error, ..] = never_errors.as_mut_slice()
{
self.adjust_fulfillment_error_for_expr_obligation(never_error);
let sugg = self.try_to_suggest_annotations(diverging_vids, coercions);
self.tcx.emit_node_span_lint(
DEPENDENCY_ON_UNIT_NEVER_TYPE_FALLBACK,
self.tcx.local_def_id_to_hir_id(self.body_def_id),
self.tcx.def_span(self.body_def_id),
diagnostics::DependencyOnUnitNeverTypeFallback {
obligation_span: never_error.obligation.cause.span,
obligation: never_error.obligation.predicate,
sugg,
},
)
}
}

/// Returns a graph whose nodes are (unresolved) inference variables and where
/// an edge `?A -> ?B` indicates that the variable `?A` is coerced to `?B`.
fn create_coercion_graph(&self) -> VecGraph<ty::TyVid, true> {
Expand Down
14 changes: 2 additions & 12 deletions compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,24 +493,14 @@ impl<'tcx> LoweredTy<'tcx> {
}

fn never_type_behavior(tcx: TyCtxt<'_>) -> (DivergingFallbackBehavior, DivergingBlockBehavior) {
// FIXME(waffle): rip out the whole system which allows you to choose never type fallback
let (fallback, block) = parse_never_type_options_attr(tcx);
let fallback = fallback.unwrap_or_else(|| default_fallback(tcx));
let fallback = fallback.unwrap_or_else(|| DivergingFallbackBehavior::ToNever);
let block = block.unwrap_or_default();

(fallback, block)
}

/// Returns the default fallback which is used when there is no explicit override via `#![never_type_options(...)]`.
fn default_fallback(tcx: TyCtxt<'_>) -> DivergingFallbackBehavior {
// Edition 2024: fallback to `!`
if tcx.sess.edition().at_least_rust_2024() {
return DivergingFallbackBehavior::ToNever;
}

// Otherwise: fallback to `()`
DivergingFallbackBehavior::ToUnit
}

fn parse_never_type_options_attr(
tcx: TyCtxt<'_>,
) -> (Option<DivergingFallbackBehavior>, Option<DivergingBlockBehavior>) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(deref_patterns)]
#![feature(iter_intersperse)]
#![feature(iter_order_by)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(option_reference_flattening)]
#![feature(trim_prefix_suffix)]
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,10 @@ fn register_builtins(store: &mut LintStore) {
"converted into hard error, \
generic items must always be mangled",
);
store.register_removed(
"dependency_on_unit_never_type_fallback",
"the code warned by this lint no longer compiles",
);
}

fn register_internals(store: &mut LintStore) {
Expand Down
Loading
Loading