Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 1.98.1 (2026-09-03)
===========================

<a id="1.98.1"></a>

* [rustc: fix miscompilation in generating vtables](https://github.com/rust-lang/rust/issues/161441)

Version 1.98.0 (2026-08-20)
==========================

Expand Down
225 changes: 225 additions & 0 deletions compiler/rustc_attr_ir/src/attribute_docs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
macro_rules! include_example {
($name:literal) => {
concat!(
"```rust,compile_fail\n",
include_str!(concat!("../../../tests/ui/attributes/doc_examples/", $name, ".rs")),
"```\n",
"produces:\n",
" ```text\n",
include_str!(concat!("../../../tests/ui/attributes/doc_examples/", $name, ".stderr")),
"```\n",
)
};
}

#[cfg_attr(not(bootstrap), doc(attribute = "rustc_dump_clauses"))]
/// Dumps the list of [`ty::Clause`]s as computed by the [`clauses_of`] query.
///
/// See [`AttributeKind::RustcDumpClauses`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_clauses")]
///
/// # Example: super trait bounds are not elaborated
///
#[doc = include_example!("rustc_dump_clauses_super_trait")]
///
/// [`clauses_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.clauses_of
/// [`ty::Clause`]: ../rustc_middle/ty/struct.Clause.html
const _: () = ();

#[doc(attribute = "rustc_dump_def_parents")]
/// Dumps the parents of the annotated item and of any anonymous constants contained within it.
///
/// See also [`opt_parent`](../rustc_middle/ty/struct.TyCtxt.html#method.opt_parent).
///
/// See [`AttributeKind::RustcDumpDefParents`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_def_parents")]
const _: () = ();

#[doc(attribute = "rustc_dump_def_path")]
/// Dumps the def path of the annotated item.
///
/// See also [`def_path_str`] and [`def_path_str_with_args`].
///
/// See [`AttributeKind::RustcDumpDefPath`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_def_path")]
///
/// [`def_path_str`]: ../rustc_middle/ty/struct.TyCtxt.html#method.def_path_str
/// [`def_path_str_with_args`]: ../rustc_middle/ty/struct.TyCtxt.html#method.def_path_str_with_args
const _: () = ();

#[doc(attribute = "rustc_dump_generics")]
/// Dumps the generics of the annotated item.
///
/// See [`generics_of`] and [`ty::Generics`] for what "generics" means here.
///
/// See [`AttributeKind::RustcDumpGenerics`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_generics")]
///
/// [`generics_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.generics_of
/// [`ty::Generics`]: ../rustc_middle/ty/struct.Generics.html
const _: () = ();

#[doc(attribute = "rustc_dump_hidden_type_of_opaques")]
/// Dumps the hidden types of the opaque items in this crate.
///
/// This ends up calling the [`type_of`] query, which, for opaque types, reveals their hidden types.
///
/// See [`AttributeKind::RustcDumpHiddenTypeOfOpaques`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_hidden_type_of_opaques")]
///
/// [`type_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.type_of
const _: () = ();

#[doc(attribute = "rustc_dump_inferred_outlives")]
/// Dumps the inferred outlives-clauses of the annotated item.
///
/// See also the [`inferred_outlives_of`] query.
///
/// See [`AttributeKind::RustcDumpInferredOutlives`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_inferred_outlives")]
///
/// [`inferred_outlives_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.inferred_outlives_of
const _: () = ();

#[doc(attribute = "rustc_dump_item_bounds")]
/// Dumps the item bounds of the annotated item.
///
/// This ends up calling the [`item_bounds`] query and prints the [`ty::Clause`] of the item.
///
/// See [`AttributeKind::RustcDumpItemBounds`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_item_bounds")]
///
/// [`item_bounds`]: ../rustc_middle/ty/struct.TyCtxt.html#method.item_bounds
/// [`ty::Clause`]: ../rustc_middle/ty/struct.Clause.html
const _: () = ();

#[doc(attribute = "rustc_dump_layout")]
/// Dumps the layout of the annotated item.
///
/// This ends up calling the [`layout_of`] query to get the [`Layout`] of the annotated item. If used
/// with the `debug` modifier, it will print the entirety of `Layout`. Other modifiers will print
/// only parts of it.
///
/// See [`AttributeKind::RustcDumpLayout`] for the internal representation of this attribute.
///
/// # Example: `debug`
///
#[doc = include_example!("rustc_dump_layout_debug")]
///
/// # Example: `largest_niche`
///
#[doc = include_example!("rustc_dump_layout_largest_niche")]
///
/// # Example: `size`
///
#[doc = include_example!("rustc_dump_layout_size")]
///
/// # Example: `align`
///
#[doc = include_example!("rustc_dump_layout_align")]
///
/// # Example: `backend_repr`
///
#[doc = include_example!("rustc_dump_layout_backend_repr")]
///
/// # Example: `homogeneous_aggregate`
///
#[doc = include_example!("rustc_dump_layout_homogeneous_aggregate")]
///
/// [`layout_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.layout_of
/// [`Layout`]: rustc_abi::Layout
const _: () = ();

#[doc(attribute = "rustc_dump_object_lifetime_defaults")]
/// Dumps the trait object lifetime defaults induced by the type parameters of the annotated item.
///
/// It will dump this information separately for each type parameter of the annotated item.
///
/// See also the [`object_lifetime_default`] query.
///
/// See [`AttributeKind::RustcDumpObjectLifetimeDefaults`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_object_lifetime_defaults")]
///
/// [`object_lifetime_default`]: ../rustc_middle/ty/struct.TyCtxt.html#method.object_lifetime_default
const _: () = ();

#[doc(attribute = "rustc_dump_symbol_name")]
/// Dumps the symbol name of the annotated item, also demangling it if necessary.
///
/// See also the [`symbol_name`] query.
///
/// See [`AttributeKind::RustcDumpSymbolName`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_symbol_name")]
///
/// [`symbol_name`]: ../rustc_middle/ty/struct.TyCtxt.html#method.symbol_name
const _: () = ();

#[doc(attribute = "rustc_dump_variances")]
/// Dumps the variances of the annotated item.
///
/// See also the [`variances_of`] query and [`ty::Variance`].
///
/// See [`AttributeKind::RustcDumpVariances`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_variances")]
///
/// [`variances_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.variances_of
/// [`ty::Variance`]: ../rustc_middle/ty/enum.Variance.html
const _: () = ();

#[doc(attribute = "rustc_dump_variances_of_opaques")]
/// Dumps the variances of opaque types in this crate.
///
/// See also the [`variances_of`] query.
///
/// See [`AttributeKind::RustcDumpVariancesOfOpaques`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_variances_of_opaques")]
///
/// [`variances_of`]: ../rustc_middle/ty/struct.TyCtxt.html#method.variances_of
const _: () = ();

#[doc(attribute = "rustc_dump_vtable")]
/// Dumps the virtual method table ("vtable") of the annotated item.
///
/// See also the [`vtable_entries`] query.
///
/// See [`AttributeKind::RustcDumpVtable`] for the internal representation of this attribute.
///
/// # Example
///
#[doc = include_example!("rustc_dump_vtable")]
///
/// [`vtable_entries`]: ../rustc_middle/ty/struct.TyCtxt.html#method.vtable_entries
const _: () = ();
26 changes: 13 additions & 13 deletions compiler/rustc_attr_ir/src/data_structures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,46 +1219,46 @@ pub enum AttributeKind {
/// Represents `#[rustc_dummy]`.
RustcDummy,

/// Represents `#[rustc_dump_clauses]`
/// Represents the [`rustc_dump_clauses`](./attribute.rustc_dump_clauses.html) attribute.
RustcDumpClauses,

/// Represents `#[rustc_dump_def_parents]`
/// Represents the [`rustc_dump_def_parents`](./attribute.rustc_dump_def_parents.html) attribute.
RustcDumpDefParents,

/// Represents `#[rustc_dump_def_path]`
/// Represents the [`rustc_dump_def_path`](./attribute.rustc_dump_def_path.html) attribute.
RustcDumpDefPath(Span),

/// Represents `#[rustc_dump_generics]`
/// Represents the [`rustc_dump_generics`](./attribute.rustc_dump_generics.html) attribute.
RustcDumpGenerics,

/// Represents `#[rustc_dump_hidden_type_of_opaques]`
/// Represents the [`rustc_dump_hidden_type_of_opaques`](./attribute.rustc_dump_hidden_type_of_opaques.html) attribute.
RustcDumpHiddenTypeOfOpaques,

/// Represents `#[rustc_dump_inferred_outlives]`
/// Represents the [`rustc_dump_inferred_outlives`](./attribute.rustc_dump_inferred_outlives.html) attribute.
RustcDumpInferredOutlives,

/// Represents `#[rustc_dump_item_bounds]`
/// Represents the [`rustc_dump_item_bounds`](./attribute.rustc_dump_item_bounds.html) attribute.
RustcDumpItemBounds,

/// Represents `#[rustc_dump_layout]`
/// Represents the [`rustc_dump_layout`](./attribute.rustc_dump_layout.html) attribute.
RustcDumpLayout(ThinVec<RustcDumpLayoutKind>),

/// Represents `#[rustc_dump_object_lifetime_defaults]`.
/// Represents the [`rustc_dump_object_lifetime_defaults`](./attribute.rustc_dump_object_lifetime_defaults.html) attribute.
RustcDumpObjectLifetimeDefaults,

/// Represents `#[rustc_dump_symbol_name]`
/// Represents the [`rustc_dump_symbol_name`](./attribute.rustc_dump_symbol_name.html) attribute.
RustcDumpSymbolName(Span),

/// Represents `#[rustc_dump_user_args]`
RustcDumpUserArgs,

/// Represents `#[rustc_dump_variances]`
/// Represents the [`rustc_dump_variances`](./attribute.rustc_dump_variances.html) attribute.
RustcDumpVariances,

/// Represents `#[rustc_dump_variances_of_opaques]`
/// Represents the [`rustc_dump_variances_of_opaques`](./attribute.rustc_dump_variances_of_opaques.html) attribute.
RustcDumpVariancesOfOpaques,

/// Represents `#[rustc_dump_vtable]`
/// Represents the [`rustc_dump_vtable`](./attribute.rustc_dump_vtable.html) attribute.
RustcDumpVtable(Span),

/// Represents `#[rustc_dyn_incompatible_trait]`.
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_attr_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
//! see [rustc_attr_parsing](../rustc_attr_parsing/index.html).

// tidy-alphabetical-start
#![expect(internal_features, reason = "rustdoc_internals, for documenting attributes")]
#![feature(const_default)]
#![feature(const_trait_impl)]
#![feature(default_field_values)]
#![feature(derive_const)]
#![feature(exhaustive_patterns)]
#![feature(rustdoc_internals)]
#![feature(variant_count)]
#![recursion_limit = "256"]
// tidy-alphabetical-end
Expand Down Expand Up @@ -143,3 +145,5 @@ macro_rules! find_attr {
}
}};
}

include!("attribute_docs.rs");
8 changes: 2 additions & 6 deletions compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
outlives_constraints,
scc_annotations,
type_tests,
mut liveness_constraints,
liveness_constraints,
universe_causes,
placeholder_indices,
} = lowered_constraints;
Expand Down Expand Up @@ -376,9 +376,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
match definition.origin {
// For each free, universally quantified region X:
NllRegionVariableOrigin::FreeRegion => {
// Add all nodes in the CFG to liveness constraints
liveness_constraints.add_all_points(region);

// Add `end(X)` into the set for X.
scc_values.add_free_region(scc, region);
}
Expand All @@ -396,8 +393,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
// has them, setting `scc_values[scc(region)] |= liveness_constraints[region]`.
//
// These values will later be propagated during [`Self::propagate_constraints()`].
// The values include any live-at-all-points constraints added above
// for free regions.
// The values include any live-at-all-points constraints added previously in `liveness::generate`.
if let Some(liveness) = liveness_constraints.point_liveness(region) {
scc_values.merge_liveness(scc, liveness)
}
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_borrowck/src/type_check/liveness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ pub(super) fn generate<'tcx>(
debug!("liveness::generate");
let _timer = typeck.tcx().prof.generic_activity("borrowck_liveness");

// Universal regions are live at every point.
for region in typeck.universal_regions.universal_regions_iter() {
typeck.constraints.liveness_constraints.add_all_points(region);
}

let mut free_regions = regions_that_outlive_free_regions(
typeck.infcx.num_region_vars(),
&typeck.universal_regions,
Expand Down
14 changes: 9 additions & 5 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ pub(crate) type UnificationTable<'a, 'tcx, T> = ut::UnificationTable<
ut::InPlace<T, &'a mut ut::UnificationStorage<T>, &'a mut InferCtxtUndoLogs<'tcx>>,
>;

/// This type contains all the things within `InferCtxt` that sit within a
/// `RefCell` and are involved with taking/rolling back snapshots. Snapshot
/// operations are hot enough that we want only one call to `borrow_mut` per
/// call to `start_snapshot` and `rollback_to`.
/// This type contains all the things within [`InferCtxt`] that sit within a
/// [`RefCell`] and are involved with taking/rolling back snapshots. Snapshot
/// operations are hot enough that we want only one call to
/// [`RefCell::borrow_mut`] per call to [`InferCtxt::start_snapshot`] and
/// [`InferCtxt::rollback_to`].
#[derive(Clone)]
pub struct InferCtxtInner<'tcx> {
undo_log: InferCtxtUndoLogs<'tcx>,
Expand All @@ -102,7 +103,10 @@ pub struct InferCtxtInner<'tcx> {
/// This cache is snapshotted along with the infcx.
projection_cache: traits::ProjectionCacheStorage<'tcx>,

/// We instantiate `UnificationTable` with `bounds<Ty>` because the types
/// Primary map of inference variables to the types that they currently
/// represent.
///
/// We instantiate [`UnificationTable`] with `bounds<Ty>` because the types
/// that might instantiate a general type variable have an order,
/// represented by its upper and lower bounds.
type_variable_storage: type_variable::TypeVariableStorage<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/thread/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Thread {
assert_eq!(
libc::pthread_attr_setstacksize(
attr.get(),
cmp::max(stack, min_stack_size(attr.as_ptr()))
cmp::max(stack, min_stack_size(attr.get()))
),
0
);
Expand Down
Loading
Loading