Skip to content

Commit

Permalink
Auto merge of #118126 - Nilstrieb:rollup-5ogh896, r=Nilstrieb
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #117790 (CFI: Add missing use core::ffi::c_int)
 - #118059 (Explicitly unset $CARGO for compiletest)
 - #118081 (`rustc_ty_utils` cleanups)
 - #118094 (feat: specialize `SpecFromElem` for `()`)
 - #118097 (Update books)
 - #118115 (Fix occurrences of old fn names in comment and tracing)
 - #118121 (`rustc_hir` cleanups)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Nov 21, 2023
2 parents 85c42b7 + f13f980 commit c5af061
Show file tree
Hide file tree
Showing 25 changed files with 177 additions and 510 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_hir/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ macro_rules! arena_types {
($macro:path) => (
$macro!([
// HIR types
[] hir_krate: rustc_hir::Crate<'tcx>,
[] asm_template: rustc_ast::InlineAsmTemplatePiece,
[] attribute: rustc_ast::Attribute,
[] owner_info: rustc_hir::OwnerInfo<'tcx>,
Expand Down
17 changes: 7 additions & 10 deletions compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use std::array::IntoIter;
use std::fmt::Debug;

/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
pub enum CtorOf {
/// This `DefKind::Ctor` is a synthesized constructor of a tuple or unit struct.
Struct,
Expand All @@ -23,8 +22,7 @@ pub enum CtorOf {
}

/// What kind of constructor something is.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
pub enum CtorKind {
/// Constructor function automatically created by a tuple struct/variant.
Fn,
Expand All @@ -33,8 +31,7 @@ pub enum CtorKind {
}

/// An attribute that is not a macro; e.g., `#[inline]` or `#[rustfmt::skip]`.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
pub enum NonMacroAttrKind {
/// Single-segment attribute defined by the language (`#[inline]`)
Builtin(Symbol),
Expand All @@ -48,8 +45,7 @@ pub enum NonMacroAttrKind {
}

/// What kind of definition something is; e.g., `mod` vs `struct`.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
pub enum DefKind {
// Type namespace
Mod,
Expand Down Expand Up @@ -299,8 +295,7 @@ impl DefKind {
/// - the call to `str_to_string` will resolve to [`Res::Def`], with the [`DefId`]
/// pointing to the definition of `str_to_string` in the current crate.
//
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug)]
#[derive(HashStable_Generic)]
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]
pub enum Res<Id = hir::HirId> {
/// Definition having a unique ID (`DefId`), corresponds to something defined in user code.
///
Expand Down Expand Up @@ -591,6 +586,8 @@ impl NonMacroAttrKind {
}
}

// Currently trivial, but exists in case a new kind is added in the future whose name starts
// with a vowel.
pub fn article(self) -> &'static str {
"a"
}
Expand Down
Loading

0 comments on commit c5af061

Please sign in to comment.