1
Fork 0

Auto merge of #138310 - matthiaskrgr:rollup-zvbpuei, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #137931 (Add remark for missing `llvm-tools` component re. `rustc_private` linker failures related to not finding LLVM libraries)
 - #138138 (Pass `InferCtxt` to `InlineAsmCtxt` to properly taint on error)
 - #138223 (Fix post-merge workflow)
 - #138268 (Handle empty test suites in GitHub job summary report)
 - #138278 (Delegation: fix ICE with invalid `MethodCall` generation)
 - #138281 (Fix O(tests) stack usage in edition 2024 mergeable doctests)
 - #138305 (Subtree update of `rust-analyzer`)
 - #138306 (Revert "Use workspace lints for crates in `compiler/` #138084")

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-03-10 18:38:06 +00:00
commit 9fb94b32df
347 changed files with 4990 additions and 2302 deletions

View file

@ -16,15 +16,21 @@ jobs:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
# Make sure that we have enough commits to find the parent merge commit.
# Since all merges should be through merge commits, fetching two commits
# should be enough to get the parent bors merge commit.
fetch-depth: 2
- name: Perform analysis and send PR
env:
GH_TOKEN: ${{ github.token }}
run: |
# Get closest bors merge commit
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
echo "Parent: ${PARENT_COMMIT}"
# Find PR for the current commit
HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'`
echo "Parent: ${PARENT_COMMIT}"
echo "HEAD: ${{ github.sha }} (#${HEAD_PR})"
cd src/ci/citool

View file

@ -63,20 +63,6 @@ exclude = [
"src/tools/x",
]
# These lints are applied to many crates in the workspace. In practice, this is
# all crates under `compiler/`.
#
# NOTE: rustc-specific lints (e.g. `rustc::internal`) aren't supported by
# Cargo. (Support for them is possibly blocked by #44690 (attributes for
# tools).) Those lints are instead specified for `compiler/` crates in
# `src/bootstrap/src/core/builder/cargo.rs`.
[workspace.lints.rust]
# FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all of the
# individual lints are satisfied.
keyword_idents_2024 = "warn"
unreachable_pub = "warn"
unsafe_op_in_unsafe_fn = "warn"
[profile.release.package.rustc-rayon-core]
# The rustc fork of Rayon has deadlock detection code which intermittently
# causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227)

View file

@ -32,6 +32,3 @@ llvm = ['rustc_driver_impl/llvm']
max_level_info = ['rustc_driver_impl/max_level_info']
rustc_randomized_layouts = ['rustc_driver_impl/rustc_randomized_layouts']
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -31,6 +31,3 @@ nightly = [
]
randomize = ["dep:rand", "dep:rand_xoshiro", "nightly"]
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -5,6 +5,7 @@
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
#![cfg_attr(feature = "nightly", feature(step_trait))]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
/*! ABI handling for rustc

View file

@ -7,6 +7,3 @@ edition = "2024"
# tidy-alphabetical-start
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -23,6 +23,7 @@
#![feature(maybe_uninit_slice)]
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::alloc::Layout;

View file

@ -18,6 +18,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -19,6 +19,7 @@
#![feature(never_type)]
#![feature(rustdoc_internals)]
#![feature(stmt_expr_attributes)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod util {

View file

@ -19,6 +19,3 @@ nightly = [
"dep:rustc_macros",
"dep:rustc_span",
]
[lints]
workspace = true

View file

@ -9,6 +9,7 @@
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(never_type))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
#[cfg(feature = "nightly")]

View file

@ -28,6 +28,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -60,25 +60,27 @@ pub(crate) struct DelegationResults<'hir> {
}
impl<'hir> LoweringContext<'_, 'hir> {
pub(crate) fn delegation_has_self(&self, item_id: NodeId, path_id: NodeId, span: Span) -> bool {
/// Defines whether the delegatee is an associated function whose first parameter is `self`.
pub(crate) fn delegatee_is_method(&self, item_id: NodeId, path_id: NodeId, span: Span) -> bool {
let sig_id = self.get_delegation_sig_id(item_id, path_id, span);
let Ok(sig_id) = sig_id else {
return false;
};
self.has_self(sig_id, span)
self.is_method(sig_id, span)
}
fn has_self(&self, def_id: DefId, span: Span) -> bool {
if let Some(local_sig_id) = def_id.as_local() {
// The value may be missing due to recursive delegation.
// Error will be emitted later during HIR ty lowering.
self.resolver.delegation_fn_sigs.get(&local_sig_id).is_some_and(|sig| sig.has_self)
} else {
match self.tcx.def_kind(def_id) {
DefKind::Fn => false,
DefKind::AssocFn => self.tcx.associated_item(def_id).fn_has_self_parameter,
_ => span_bug!(span, "unexpected DefKind for delegation item"),
}
fn is_method(&self, def_id: DefId, span: Span) -> bool {
match self.tcx.def_kind(def_id) {
DefKind::Fn => false,
DefKind::AssocFn => match def_id.as_local() {
Some(local_def_id) => self
.resolver
.delegation_fn_sigs
.get(&local_def_id)
.is_some_and(|sig| sig.has_self),
None => self.tcx.associated_item(def_id).fn_has_self_parameter,
},
_ => span_bug!(span, "unexpected DefKind for delegation item"),
}
}
@ -324,7 +326,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let call = if self
.get_resolution_id(delegation.id, span)
.and_then(|def_id| Ok(self.has_self(def_id, span)))
.and_then(|def_id| Ok(self.is_method(def_id, span)))
.unwrap_or_default()
&& delegation.qself.is_none()
&& !has_generic_args

View file

@ -871,7 +871,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
}
AssocItemKind::Delegation(box delegation) => hir::AssocItemKind::Fn {
has_self: self.delegation_has_self(i.id, delegation.id, i.span),
has_self: self.delegatee_is_method(i.id, delegation.id, i.span),
},
AssocItemKind::MacCall(..) | AssocItemKind::DelegationMac(..) => {
panic!("macros should have been expanded by now")
@ -1000,7 +1000,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::AssocItemKind::Fn { has_self: sig.decl.has_self() }
}
AssocItemKind::Delegation(box delegation) => hir::AssocItemKind::Fn {
has_self: self.delegation_has_self(i.id, delegation.id, i.span),
has_self: self.delegatee_is_method(i.id, delegation.id, i.span),
},
AssocItemKind::MacCall(..) | AssocItemKind::DelegationMac(..) => {
panic!("macros should have been expanded by now")

View file

@ -38,6 +38,7 @@
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::sync::Arc;

View file

@ -20,6 +20,3 @@ rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
thin-vec = "0.2.12"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -10,6 +10,7 @@
#![feature(iter_is_partitioned)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod ast_validation;

View file

@ -12,6 +12,3 @@ rustc_lexer = { path = "../rustc_lexer" }
rustc_span = { path = "../rustc_span" }
thin-vec = "0.2.12"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -3,6 +3,7 @@
#![doc(rust_logo)]
#![feature(box_patterns)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod helpers;

View file

@ -14,6 +14,3 @@ rustc_serialize = {path = "../rustc_serialize"}
rustc_span = {path = "../rustc_span"}
thin-vec = "0.2.12"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -3,6 +3,7 @@
#![doc(rust_logo)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod attributes;

View file

@ -22,6 +22,3 @@ rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" }
thin-vec = "0.2.12"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -80,6 +80,7 @@
#![doc(rust_logo)]
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
#[macro_use]

View file

@ -11,6 +11,3 @@ icu_locid_transform = "1.3.2"
icu_provider = { version = "1.2", features = ["sync"] }
zerovec = "0.10.0"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -23,9 +23,9 @@
// tidy-alphabetical-start
#![allow(elided_lifetimes_in_paths)]
#![allow(internal_features)]
#![allow(unreachable_pub)] // because this crate is mostly generated code
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
// #![warn(unreachable_pub)] // don't use because this crate is mostly generated code
// tidy-alphabetical-end
mod data {

View file

@ -27,6 +27,3 @@ rustc_traits = { path = "../rustc_traits" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -13,6 +13,7 @@
#![feature(rustdoc_internals)]
#![feature(stmt_expr_attributes)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::borrow::Cow;

View file

@ -3,6 +3,10 @@ name = "rustc_builtin_macros"
version = "0.0.0"
edition = "2024"
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(llvm_enzyme)'] }
[lib]
doctest = false
@ -30,6 +34,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -18,6 +18,7 @@
#![feature(rustdoc_internals)]
#![feature(string_from_utf8_lossy_owned)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate proc_macro;

View file

@ -43,6 +43,3 @@ serde_json = "1"
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -19,6 +19,7 @@
#![feature(rustdoc_internals)]
#![feature(slice_as_array)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::any::Any;

View file

@ -63,6 +63,3 @@ features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive",
[target.'cfg(windows)'.dependencies.windows]
version = "0.59.0"
features = ["Win32_Globalization"]
[lints]
workspace = true

View file

@ -14,6 +14,7 @@
#![feature(rustdoc_internals)]
#![feature(trait_alias)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
//! This crate contains codegen code that is used by all codegen backends (LLVM and others).

View file

@ -26,6 +26,3 @@ rustc_trait_selection = { path = "../rustc_trait_selection" }
rustc_type_ir = { path = "../rustc_type_ir" }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -16,6 +16,7 @@
#![feature(unqualified_local_imports)]
#![feature(yeet_expr)]
#![warn(unqualified_local_imports)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod check_consts;

View file

@ -54,6 +54,3 @@ memmap2 = "0.2.1"
[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
portable-atomic = "1.5.1"
[lints]
workspace = true

View file

@ -3,7 +3,7 @@ use std::cmp::max;
use super::*;
use crate::fx::FxHashMap;
pub(super) struct TestGraph {
pub struct TestGraph {
num_nodes: usize,
start_node: usize,
successors: FxHashMap<usize, Vec<usize>>,
@ -11,7 +11,7 @@ pub(super) struct TestGraph {
}
impl TestGraph {
pub(super) fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self {
let mut graph = TestGraph {
num_nodes: start_node + 1,
start_node,

View file

@ -313,7 +313,7 @@ pub struct Error<O, E> {
mod helper {
use super::*;
pub(super) type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
pub type ObligationTreeIdGenerator = impl Iterator<Item = ObligationTreeId>;
impl<O: ForestObligation> ObligationForest<O> {
pub fn new() -> ObligationForest<O> {
ObligationForest {

View file

@ -88,7 +88,7 @@ mod mode {
// Whether thread safety might be enabled.
#[inline]
pub(super) fn might_be_dyn_thread_safe() -> bool {
pub fn might_be_dyn_thread_safe() -> bool {
DYN_THREAD_SAFE_MODE.load(Ordering::Relaxed) != DYN_NOT_THREAD_SAFE
}

View file

@ -46,7 +46,7 @@ pub fn parallel_guard<R>(f: impl FnOnce(&ParallelGuard) -> R) -> R {
ret
}
fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
pub fn serial_join<A, B, RA, RB>(oper_a: A, oper_b: B) -> (RA, RB)
where
A: FnOnce() -> RA,
B: FnOnce() -> RB,

View file

@ -7,7 +7,7 @@ use crate::stable_hasher::{HashStable, StableHasher};
/// A tag type used in [`TaggedRef`] tests.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum Tag2 {
pub enum Tag2 {
B00 = 0b00,
B01 = 0b01,
B10 = 0b10,

View file

@ -10,6 +10,3 @@ crate-type = ["dylib"]
# tidy-alphabetical-start
rustc_driver_impl = { path = "../rustc_driver_impl" }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -79,6 +79,3 @@ rustc_randomized_layouts = [
'rustc_middle/rustc_randomized_layouts'
]
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -16,6 +16,7 @@
#![feature(result_flattening)]
#![feature(rustdoc_internals)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::cmp::max;

View file

@ -6,6 +6,3 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -6,6 +6,7 @@
#![deny(rustdoc::invalid_codeblock_attributes)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
// This higher-order macro defines the error codes that are in use. It is used

View file

@ -19,6 +19,3 @@ rustc_span = { path = "../rustc_span" }
tracing = "0.1"
unic-langid = { version = "0.9.0", features = ["macros"] }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -4,6 +4,7 @@
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
#![feature(type_alias_impl_trait)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::borrow::Cow;

View file

@ -39,6 +39,3 @@ features = [
"Win32_Security",
"Win32_System_Threading",
]
[lints]
workspace = true

View file

@ -25,6 +25,7 @@
#![feature(trait_alias)]
#![feature(try_blocks)]
#![feature(yeet_expr)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate self as rustc_errors;

View file

@ -29,6 +29,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -13,6 +13,7 @@
#![feature(rustdoc_internals)]
#![feature(try_blocks)]
#![feature(yeet_expr)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate proc_macro as pm;

View file

@ -10,6 +10,3 @@ rustc_span = { path = "../rustc_span" }
serde = { version = "1.0.125", features = [ "derive" ] }
serde_json = "1.0.59"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -15,6 +15,7 @@
#![allow(internal_features)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod accepted;

View file

@ -16,6 +16,3 @@ quote = "1"
syn = { version = "2", features = ["full"] }
unic-langid = { version = "0.9.0", features = ["macros"] }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -7,6 +7,7 @@
#![feature(proc_macro_span)]
#![feature(rustdoc_internals)]
#![feature(track_path)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use proc_macro::TokenStream;

View file

@ -6,6 +6,3 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -6,6 +6,3 @@ edition = "2024"
[dependencies]
# tidy-alphabetical-start
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -277,6 +277,7 @@
)]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::borrow::Cow;

View file

@ -7,6 +7,3 @@ edition = "2024"
# tidy-alphabetical-start
rustc-stable-hash = { version = "0.1.0" }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -21,6 +21,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -13,6 +13,7 @@
#![feature(never_type)]
#![feature(rustc_attrs)]
#![feature(variant_count)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate self as rustc_hir;

View file

@ -32,6 +32,3 @@ rustc_type_ir = { path = "../rustc_type_ir" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -3,8 +3,11 @@ use rustc_ast::InlineAsmTemplatePiece;
use rustc_data_structures::fx::FxIndexSet;
use rustc_hir::def_id::DefId;
use rustc_hir::{self as hir, LangItem};
use rustc_infer::infer::InferCtxt;
use rustc_middle::bug;
use rustc_middle::ty::{self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, UintTy};
use rustc_middle::ty::{
self, Article, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, TypeckResults, UintTy,
};
use rustc_session::lint;
use rustc_span::def_id::LocalDefId;
use rustc_span::{Symbol, sym};
@ -14,12 +17,11 @@ use rustc_target::asm::{
use crate::errors::RegisterTypeUnstable;
pub struct InlineAsmCtxt<'a, 'tcx: 'a> {
tcx: TyCtxt<'tcx>,
pub struct InlineAsmCtxt<'a, 'tcx> {
typing_env: ty::TypingEnv<'tcx>,
target_features: &'tcx FxIndexSet<Symbol>,
expr_ty: Box<dyn Fn(&hir::Expr<'tcx>) -> Ty<'tcx> + 'a>,
node_ty: Box<dyn Fn(hir::HirId) -> Ty<'tcx> + 'a>,
infcx: &'a InferCtxt<'tcx>,
typeck_results: &'a TypeckResults<'tcx>,
}
enum NonAsmTypeReason<'tcx> {
@ -31,34 +33,38 @@ enum NonAsmTypeReason<'tcx> {
impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
pub fn new(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
infcx: &'a InferCtxt<'tcx>,
typing_env: ty::TypingEnv<'tcx>,
expr_ty: impl Fn(&hir::Expr<'tcx>) -> Ty<'tcx> + 'a,
node_ty: impl Fn(hir::HirId) -> Ty<'tcx> + 'a,
typeck_results: &'a TypeckResults<'tcx>,
) -> Self {
InlineAsmCtxt {
tcx,
typing_env,
target_features: tcx.asm_target_features(def_id),
expr_ty: Box::new(expr_ty),
node_ty: Box::new(node_ty),
target_features: infcx.tcx.asm_target_features(def_id),
infcx,
typeck_results,
}
}
fn expr_ty(&self, expr: &hir::Expr<'tcx>) -> Ty<'tcx> {
(self.expr_ty)(expr)
fn tcx(&self) -> TyCtxt<'tcx> {
self.infcx.tcx
}
fn node_ty(&self, hir_id: hir::HirId) -> Ty<'tcx> {
(self.node_ty)(hir_id)
fn expr_ty(&self, expr: &hir::Expr<'tcx>) -> Ty<'tcx> {
let ty = self.typeck_results.expr_ty_adjusted(expr);
let ty = self.infcx.resolve_vars_if_possible(ty);
if ty.has_non_region_infer() {
Ty::new_misc_error(self.tcx())
} else {
self.tcx().erase_regions(ty)
}
}
// FIXME(compiler-errors): This could use `<$ty as Pointee>::Metadata == ()`
fn is_thin_ptr_ty(&self, ty: Ty<'tcx>) -> bool {
// Type still may have region variables, but `Sized` does not depend
// on those, so just erase them before querying.
if ty.is_sized(self.tcx, self.typing_env) {
if ty.is_sized(self.tcx(), self.typing_env) {
return true;
}
if let ty::Foreign(..) = ty.kind() {
@ -68,7 +74,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
fn get_asm_ty(&self, ty: Ty<'tcx>) -> Result<InlineAsmType, NonAsmTypeReason<'tcx>> {
let asm_ty_isize = match self.tcx.sess.target.pointer_width {
let asm_ty_isize = match self.tcx().sess.target.pointer_width {
16 => InlineAsmType::I16,
32 => InlineAsmType::I32,
64 => InlineAsmType::I64,
@ -97,12 +103,12 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
ty::Adt(adt, args) if adt.repr().simd() => {
let fields = &adt.non_enum_variant().fields;
let field = &fields[FieldIdx::ZERO];
let elem_ty = field.ty(self.tcx, args);
let elem_ty = field.ty(self.tcx(), args);
let (size, ty) = match elem_ty.kind() {
ty::Array(ty, len) => {
let len = self.tcx.normalize_erasing_regions(self.typing_env, *len);
if let Some(len) = len.try_to_target_usize(self.tcx) {
let len = self.tcx().normalize_erasing_regions(self.typing_env, *len);
if let Some(len) = len.try_to_target_usize(self.tcx()) {
(len, *ty)
} else {
return Err(NonAsmTypeReason::UnevaluatedSIMDArrayLength(
@ -122,7 +128,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
Ok(InlineAsmType::VecI128(size))
}
ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => {
Ok(match self.tcx.sess.target.pointer_width {
Ok(match self.tcx().sess.target.pointer_width {
16 => InlineAsmType::VecI16(size),
32 => InlineAsmType::VecI32(size),
64 => InlineAsmType::VecI64(size),
@ -159,9 +165,9 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
// `!` is allowed for input but not for output (issue #87802)
ty::Never if is_input => return None,
_ if ty.references_error() => return None,
ty::Adt(adt, args) if self.tcx.is_lang_item(adt.did(), LangItem::MaybeUninit) => {
ty::Adt(adt, args) if self.tcx().is_lang_item(adt.did(), LangItem::MaybeUninit) => {
let fields = &adt.non_enum_variant().fields;
let ty = fields[FieldIdx::from_u32(1)].ty(self.tcx, args);
let ty = fields[FieldIdx::from_u32(1)].ty(self.tcx(), args);
// FIXME: Are we just trying to map to the `T` in `MaybeUninit<T>`?
// If so, just get it from the args.
let ty::Adt(ty, args) = ty.kind() else {
@ -172,7 +178,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
"expected first field of `MaybeUninit` to be `ManuallyDrop`"
);
let fields = &ty.non_enum_variant().fields;
let ty = fields[FieldIdx::ZERO].ty(self.tcx, args);
let ty = fields[FieldIdx::ZERO].ty(self.tcx(), args);
self.get_asm_ty(ty)
}
_ => self.get_asm_ty(ty),
@ -183,9 +189,9 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
match reason {
NonAsmTypeReason::UnevaluatedSIMDArrayLength(did, len) => {
let msg = format!("cannot evaluate SIMD vector length `{len}`");
self.tcx
self.infcx
.dcx()
.struct_span_err(self.tcx.def_span(did), msg)
.struct_span_err(self.tcx().def_span(did), msg)
.with_span_note(
expr.span,
"SIMD vector length needs to be known statically for use in `asm!`",
@ -194,7 +200,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
NonAsmTypeReason::Invalid(ty) => {
let msg = format!("cannot use value of type `{ty}` for inline assembly");
self.tcx.dcx().struct_span_err(expr.span, msg).with_note(
self.infcx.dcx().struct_span_err(expr.span, msg).with_note(
"only integers, floats, SIMD vectors, pointers and function pointers \
can be used as arguments for inline assembly",
).emit();
@ -203,7 +209,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
let msg = format!(
"cannot use value of unsized pointer type `{ty}` for inline assembly"
);
self.tcx
self.infcx
.dcx()
.struct_span_err(expr.span, msg)
.with_note("only sized pointers can be used in inline assembly")
@ -213,8 +219,8 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
let msg = format!(
"cannot use SIMD vector with element type `{ty}` for inline assembly"
);
self.tcx.dcx()
.struct_span_err(self.tcx.def_span(did), msg).with_span_note(
self.infcx.dcx()
.struct_span_err(self.tcx().def_span(did), msg).with_span_note(
expr.span,
"only integers, floats, SIMD vectors, pointers and function pointers \
can be used as arguments for inline assembly",
@ -227,9 +233,9 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
// Check that the type implements Copy. The only case where this can
// possibly fail is for SIMD types which don't #[derive(Copy)].
if !self.tcx.type_is_copy_modulo_regions(self.typing_env, ty) {
if !self.tcx().type_is_copy_modulo_regions(self.typing_env, ty) {
let msg = "arguments for inline assembly must be copyable";
self.tcx
self.infcx
.dcx()
.struct_span_err(expr.span, msg)
.with_note(format!("`{ty}` does not implement the Copy trait"))
@ -249,7 +255,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
if in_asm_ty != asm_ty {
let msg = "incompatible types for asm inout argument";
let in_expr_ty = self.expr_ty(in_expr);
self.tcx
self.infcx
.dcx()
.struct_span_err(vec![in_expr.span, expr.span], msg)
.with_span_label(in_expr.span, format!("type `{in_expr_ty}`"))
@ -268,21 +274,21 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
// Check the type against the list of types supported by the selected
// register class.
let asm_arch = self.tcx.sess.asm_arch.unwrap();
let allow_experimental_reg = self.tcx.features().asm_experimental_reg();
let asm_arch = self.tcx().sess.asm_arch.unwrap();
let allow_experimental_reg = self.tcx().features().asm_experimental_reg();
let reg_class = reg.reg_class();
let supported_tys = reg_class.supported_types(asm_arch, allow_experimental_reg);
let Some((_, feature)) = supported_tys.iter().find(|&&(t, _)| t == asm_ty) else {
let mut err = if !allow_experimental_reg
&& reg_class.supported_types(asm_arch, true).iter().any(|&(t, _)| t == asm_ty)
{
self.tcx.sess.create_feature_err(
self.tcx().sess.create_feature_err(
RegisterTypeUnstable { span: expr.span, ty },
sym::asm_experimental_reg,
)
} else {
let msg = format!("type `{ty}` cannot be used with this register class");
let mut err = self.tcx.dcx().struct_span_err(expr.span, msg);
let mut err = self.infcx.dcx().struct_span_err(expr.span, msg);
let supported_tys: Vec<_> =
supported_tys.iter().map(|(t, _)| t.to_string()).collect();
err.note(format!(
@ -312,7 +318,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
if let Some(feature) = feature {
if !self.target_features.contains(feature) {
let msg = format!("`{feature}` target feature is not enabled");
self.tcx
self.infcx
.dcx()
.struct_span_err(expr.span, msg)
.with_note(format!(
@ -349,7 +355,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
result: default_result,
size: default_size,
} = reg_class.default_modifier(asm_arch).unwrap();
self.tcx.node_span_lint(
self.tcx().node_span_lint(
lint::builtin::ASM_SUB_REGISTER,
expr.hir_id,
spans,
@ -371,11 +377,11 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
pub fn check_asm(&self, asm: &hir::InlineAsm<'tcx>) {
let Some(asm_arch) = self.tcx.sess.asm_arch else {
self.tcx.dcx().delayed_bug("target architecture does not support asm");
let Some(asm_arch) = self.tcx().sess.asm_arch else {
self.infcx.dcx().delayed_bug("target architecture does not support asm");
return;
};
let allow_experimental_reg = self.tcx.features().asm_experimental_reg();
let allow_experimental_reg = self.tcx().features().asm_experimental_reg();
for (idx, &(op, op_sp)) in asm.operands.iter().enumerate() {
// Validate register classes against currently enabled target
// features. We check that at least one type is available for
@ -398,13 +404,13 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
if let Err(msg) = reg.validate(
asm_arch,
self.tcx.sess.relocation_model(),
self.tcx().sess.relocation_model(),
self.target_features,
&self.tcx.sess.target,
&self.tcx().sess.target,
op.is_clobber(),
) {
let msg = format!("cannot use register `{}`: {}", reg.name(), msg);
self.tcx.dcx().span_err(op_sp, msg);
self.infcx.dcx().span_err(op_sp, msg);
continue;
}
}
@ -444,7 +450,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
reg_class.name(),
feature
);
self.tcx.dcx().span_err(op_sp, msg);
self.infcx.dcx().span_err(op_sp, msg);
// register isn't enabled, don't do more checks
continue;
}
@ -458,7 +464,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
.intersperse(", ")
.collect::<String>(),
);
self.tcx.dcx().span_err(op_sp, msg);
self.infcx.dcx().span_err(op_sp, msg);
// register isn't enabled, don't do more checks
continue;
}
@ -493,16 +499,16 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
}
}
hir::InlineAsmOperand::Const { anon_const } => {
let ty = self.node_ty(anon_const.hir_id);
let ty = self.expr_ty(self.tcx().hir_body(anon_const.body).value);
match ty.kind() {
ty::Error(_) => {}
_ if ty.is_integral() => {}
_ => {
self.tcx
self.infcx
.dcx()
.struct_span_err(op_sp, "invalid type for `const` operand")
.with_span_label(
self.tcx.def_span(anon_const.def_id),
self.tcx().def_span(anon_const.def_id),
format!("is {} `{}`", ty.kind().article(), ty),
)
.with_help("`const` operands must be of an integer type")
@ -517,7 +523,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
ty::FnDef(..) => {}
ty::Error(_) => {}
_ => {
self.tcx
self.infcx
.dcx()
.struct_span_err(op_sp, "invalid `sym` operand")
.with_span_label(

View file

@ -73,6 +73,7 @@ This API is completely unstable and subject to change.
#![feature(slice_partition_dedup)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
// These are used by Clippy.

View file

@ -12,6 +12,3 @@ rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
rustc_hir = { path = "../rustc_hir" }
rustc_span = { path = "../rustc_span" }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -3,6 +3,7 @@
// tidy-alphabetical-start
#![recursion_limit = "256"]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::cell::Cell;

View file

@ -27,6 +27,3 @@ rustc_type_ir = { path = "../rustc_type_ir" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -99,22 +99,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
debug!("FnCtxt::check_asm: {} deferred checks", deferred_asm_checks.len());
for (asm, hir_id) in deferred_asm_checks.drain(..) {
let enclosing_id = self.tcx.hir_enclosing_body_owner(hir_id);
let expr_ty = |expr: &hir::Expr<'tcx>| {
let ty = self.typeck_results.borrow().expr_ty_adjusted(expr);
let ty = self.resolve_vars_if_possible(ty);
if ty.has_non_region_infer() {
Ty::new_misc_error(self.tcx)
} else {
self.tcx.erase_regions(ty)
}
};
let node_ty = |hir_id: HirId| self.typeck_results.borrow().node_type(hir_id);
InlineAsmCtxt::new(
self.tcx,
enclosing_id,
&self.infcx,
self.typing_env(self.param_env),
expr_ty,
node_ty,
&*self.typeck_results.borrow(),
)
.check_asm(asm);
}

View file

@ -8,6 +8,7 @@
#![feature(let_chains)]
#![feature(never_type)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod _match;

View file

@ -22,6 +22,3 @@ rustc_span = { path = "../rustc_span" }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -7,6 +7,7 @@
#![doc(rust_logo)]
#![feature(file_buffered)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod assert_dep_graph;

View file

@ -21,6 +21,3 @@ nightly = [
]
rustc_randomized_layouts = []
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -4,6 +4,7 @@
#![cfg_attr(feature = "nightly", feature(extend_one, step_trait, test))]
#![cfg_attr(feature = "nightly", feature(new_range_api))]
#![cfg_attr(feature = "nightly", feature(new_zeroed_alloc))]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
pub mod bit_set;

View file

@ -13,6 +13,3 @@ quote = "1"
[features]
nightly = []
[lints]
workspace = true

View file

@ -305,7 +305,7 @@ impl Parse for Newtype {
}
}
pub(crate) fn newtype(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
pub fn newtype(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input as Newtype);
input.0.into()
}

View file

@ -21,6 +21,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
thin-vec = "0.2.12"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -24,6 +24,7 @@
#![feature(let_chains)]
#![feature(rustdoc_internals)]
#![recursion_limit = "512"] // For rustdoc
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod errors;

View file

@ -56,6 +56,3 @@ tracing = "0.1"
# tidy-alphabetical-start
llvm = ['dep:rustc_codegen_llvm']
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -4,6 +4,7 @@
#![feature(iter_intersperse)]
#![feature(let_chains)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod callbacks;

View file

@ -24,6 +24,3 @@ features = ["emoji"]
[dev-dependencies]
expect-test = "1.4.0"
[lints]
workspace = true

View file

@ -23,6 +23,7 @@
// We want to be able to build this crate with a stable compiler,
// so no `#![feature]` attributes should be added.
#![deny(unstable_features)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod cursor;

View file

@ -28,6 +28,3 @@ smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
unicode-security = "0.1.0"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -32,6 +32,7 @@
#![feature(rustc_attrs)]
#![feature(rustdoc_internals)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod async_closures;

View file

@ -15,6 +15,3 @@ rustc_serialize = { path = "../rustc_serialize" }
rustc_span = { path = "../rustc_span" }
serde = { version = "1.0.125", features = ["derive"] }
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -1,3 +1,7 @@
// tidy-alphabetical-start
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use rustc_abi::ExternAbi;
use rustc_ast::AttrId;
use rustc_ast::attr::AttributeExt;

View file

@ -14,6 +14,3 @@ libc = "0.2.73"
# pinned `cc` in `rustc_codegen_ssa` if you update `cc` here.
cc = "=1.2.16"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -4,6 +4,7 @@
#![doc(rust_logo)]
#![feature(extern_types)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use std::cell::RefCell;

View file

@ -20,6 +20,3 @@ rustc_span = { path = "../rustc_span" }
# tidy-alphabetical-start
max_level_info = ['tracing/max_level_info']
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -13,6 +13,3 @@ quote = "1"
syn = { version = "2.0.9", features = ["full"] }
synstructure = "0.13.0"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -6,6 +6,7 @@
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_span)]
#![feature(proc_macro_tracked_env)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use proc_macro::TokenStream;

View file

@ -31,6 +31,3 @@ rustc_type_ir = { path = "../rustc_type_ir" }
tempfile = "3.2"
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -15,6 +15,7 @@
#![feature(proc_macro_internals)]
#![feature(rustdoc_internals)]
#![feature(trusted_len)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
extern crate proc_macro;

View file

@ -43,6 +43,3 @@ tracing = "0.1"
# tidy-alphabetical-start
rustc_randomized_layouts = []
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -61,6 +61,7 @@
#![feature(try_trait_v2_yeet)]
#![feature(type_alias_impl_trait)]
#![feature(yeet_expr)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
#[cfg(test)]

View file

@ -28,6 +28,3 @@ rustc_span = { path = "../rustc_span" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -8,6 +8,7 @@
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
// The `builder` module used to be named `build`, but that was causing GitHub's

View file

@ -21,6 +21,3 @@ rustc_span = { path = "../rustc_span" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

View file

@ -7,6 +7,7 @@
#![feature(let_chains)]
#![feature(never_type)]
#![feature(try_blocks)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
use rustc_middle::ty;

View file

@ -30,6 +30,3 @@ rustc_type_ir = { path = "../rustc_type_ir" }
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
tracing = "0.1"
# tidy-alphabetical-end
[lints]
workspace = true

Some files were not shown because too many files have changed in this diff Show more