Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #129879

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
315a16f
doc: Fold inline methods from Deref
tesuji Jul 8, 2024
fbc794f
Fix style
GuillaumeGomez Jul 15, 2024
a868b3f
Create new CSS class for "big toggles"
GuillaumeGomez Jul 15, 2024
9855a38
Add tests for new toggle on deref blocks
GuillaumeGomez Jul 15, 2024
016a2e3
Remove unused features.
nnethercote Aug 27, 2024
016a709
Condense `use rustc_*` declarations.
nnethercote Aug 27, 2024
fda52b8
Simplify a provider definition.
nnethercote Aug 27, 2024
2932e09
Simplify creation of a set.
nnethercote Aug 27, 2024
66b3585
Simplify a pattern.
nnethercote Aug 27, 2024
3b6af9a
Use a local variable.
nnethercote Aug 28, 2024
5331280
Merge some `if`s.
nnethercote Aug 28, 2024
d7cb118
Merge `DerefArgVisitor` and `PinArgVisitor`.
nnethercote Aug 28, 2024
408481f
Remove some unnecessary constants.
nnethercote Aug 28, 2024
590a021
Factor out some repetitive code.
nnethercote Aug 28, 2024
243109e
Remove an unnecessary `continue`.
nnethercote Aug 28, 2024
8541b0f
Use `let`/`else` to reduce some indentation.
nnethercote Aug 28, 2024
ac7a293
Avoid repeated interning in `SelfArgVisitor`.
nnethercote Aug 30, 2024
24ad26d
Fixed some typos in the standard library documentation/comments
ranger-ross Aug 31, 2024
92f4590
Fixed typos in btree map docs
ranger-ross Aug 31, 2024
cbf92fc
Fixed more typos in library/core
ranger-ross Aug 31, 2024
f78979e
Actually parse stdout json, instead of using hacky contains logic.
aDotInTheVoid Aug 31, 2024
de7a14e
Fix LLVM ABI NAME for riscv64imac-unknown-nuttx-elf
no1wudi Sep 1, 2024
a007310
Mark myself as on vacation for triagebot
tgross35 Sep 1, 2024
a763f96
Pin memchr to 2.5.0 in the library rather than rustc_ast
tgross35 Aug 26, 2024
dcbe15c
Run `cargo update` in the root, library, and rustbook
tgross35 Aug 26, 2024
a57c399
Adjust allowed dependencies from the latest `cargo update`
tgross35 Aug 26, 2024
f8739f0
Port std library to RTEMS
thesummer Aug 21, 2023
55f3b01
rtems: Add spec file for arm_rtems6_eabihf
thesummer Jan 23, 2024
01b57cb
Add documentation for target armv7-rtems-eabihf
thesummer Jun 26, 2024
7ab44cd
Replace walk with visit so we dont skip outermost expr kind in def co…
compiler-errors Sep 1, 2024
9185445
Deny imports of rustc_type_ir::inherent outside of type ir + new trai…
compiler-errors Aug 28, 2024
0064bd1
add extra linebreaks so rustdoc can identify the first sentence
Aug 30, 2024
2d58ed9
Rollup merge of #127021 - thesummer:1-add-target-support-for-rtems-ar…
workingjubilee Sep 2, 2024
766102f
Rollup merge of #127474 - tesuji:foldable-inline-derefs, r=t-rustdoc
workingjubilee Sep 2, 2024
5680d4e
Rollup merge of #129624 - tgross35:cargo-update, r=Mark-Simulacrum
workingjubilee Sep 2, 2024
8934019
Rollup merge of #129678 - compiler-errors:type-ir-inherent, r=fmease
workingjubilee Sep 2, 2024
5377160
Rollup merge of #129738 - nnethercote:rustc_mir_transform-cleanups, r…
workingjubilee Sep 2, 2024
3126ef7
Rollup merge of #129793 - lolbinarycat:doc-missing-newlines, r=workin…
workingjubilee Sep 2, 2024
189efee
Rollup merge of #129804 - ranger-ross:fixed-documentation-typos, r=No…
workingjubilee Sep 2, 2024
e7f163d
Rollup merge of #129837 - aDotInTheVoid:test-better-json, r=jieyouxu
workingjubilee Sep 2, 2024
05c0de7
Rollup merge of #129842 - no1wudi:master, r=saethlin
workingjubilee Sep 2, 2024
efe8d64
Rollup merge of #129843 - tgross35:triagebot-vacation, r=tgross35
workingjubilee Sep 2, 2024
d82fa13
Rollup merge of #129858 - compiler-errors:async-def, r=cjgillot
workingjubilee Sep 2, 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
317 changes: 165 additions & 152 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions compiler/rustc_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ version = "0.0.0"
edition = "2021"

[dependencies]
# FIXME: bumping memchr to 2.7.1 causes linker errors in MSVC thin-lto
# tidy-alphabetical-start
bitflags = "2.4.1"
memchr = "=2.5.0"
memchr = "2.7.4"
rustc_ast_ir = { path = "../rustc_ast_ir" }
rustc_data_structures = { path = "../rustc_data_structures" }
rustc_index = { path = "../rustc_index" }
Expand Down
3 changes: 3 additions & 0 deletions compiler/rustc_lint/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,9 @@ lint_tykind = usage of `ty::TyKind`
lint_tykind_kind = usage of `ty::TyKind::<kind>`
.suggestion = try using `ty::<kind>` directly

lint_type_ir_inherent_usage = do not use `rustc_type_ir::inherent` unless you're inside of the trait solver
.note = the method or struct you're looking for is likely defined somewhere else downstream in the compiler

lint_undropped_manually_drops = calls to `std::mem::drop` with `std::mem::ManuallyDrop` instead of the inner value does nothing
.label = argument has type `{$arg_ty}`
.suggestion = use `std::mem::ManuallyDrop::into_inner` to get the inner value
Expand Down
30 changes: 28 additions & 2 deletions compiler/rustc_lint/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tracing::debug;
use crate::lints::{
BadOptAccessDiag, DefaultHashTypesDiag, DiagOutOfImpl, LintPassByHand, NonExistentDocKeyword,
NonGlobImportTypeIrInherent, QueryInstability, SpanUseEqCtxtDiag, TyQualified, TykindDiag,
TykindKind, UntranslatableDiag,
TykindKind, TypeIrInherentUsage, UntranslatableDiag,
};
use crate::{EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintContext};

Expand Down Expand Up @@ -277,13 +277,39 @@ declare_tool_lint! {
report_in_external_macro: true
}

declare_lint_pass!(TypeIr => [NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT]);
declare_tool_lint! {
/// The `usage_of_type_ir_inherent` lint detects usage `rustc_type_ir::inherent`.
///
/// This module should only be used within the trait solver.
pub rustc::USAGE_OF_TYPE_IR_INHERENT,
Allow,
"usage `rustc_type_ir::inherent` outside of trait system",
report_in_external_macro: true
}

declare_lint_pass!(TypeIr => [NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT, USAGE_OF_TYPE_IR_INHERENT]);

impl<'tcx> LateLintPass<'tcx> for TypeIr {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
let rustc_hir::ItemKind::Use(path, kind) = item.kind else { return };

let is_mod_inherent = |def_id| cx.tcx.is_diagnostic_item(sym::type_ir_inherent, def_id);

// Path segments except for the final.
if let Some(seg) =
path.segments.iter().find(|seg| seg.res.opt_def_id().is_some_and(is_mod_inherent))
{
cx.emit_span_lint(USAGE_OF_TYPE_IR_INHERENT, seg.ident.span, TypeIrInherentUsage);
}
// Final path resolutions, like `use rustc_type_ir::inherent`
else if path.res.iter().any(|res| res.opt_def_id().is_some_and(is_mod_inherent)) {
cx.emit_span_lint(
USAGE_OF_TYPE_IR_INHERENT,
path.segments.last().unwrap().ident.span,
TypeIrInherentUsage,
);
}

let (lo, hi, snippet) = match path.segments {
[.., penultimate, segment]
if penultimate.res.opt_def_id().is_some_and(is_mod_inherent) =>
Expand Down
5 changes: 5 additions & 0 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,11 @@ pub(crate) struct TyQualified {
pub suggestion: Span,
}

#[derive(LintDiagnostic)]
#[diag(lint_type_ir_inherent_usage)]
#[note]
pub(crate) struct TypeIrInherentUsage;

#[derive(LintDiagnostic)]
#[diag(lint_non_glob_import_type_ir_inherent)]
pub(crate) struct NonGlobImportTypeIrInherent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn add_move_for_packed_drop<'tcx>(

let source_info = terminator.source_info;
let ty = place.ty(body, tcx).ty;
let temp = patch.new_temp(ty, terminator.source_info.span);
let temp = patch.new_temp(ty, source_info.span);

let storage_dead_block = patch.new_block(BasicBlockData {
statements: vec![Statement { source_info, kind: StatementKind::StorageDead(temp) }],
Expand Down
29 changes: 11 additions & 18 deletions compiler/rustc_mir_transform/src/check_packed_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,17 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> {
}

fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, _location: Location) {
if context.is_borrow() {
if util::is_disaligned(self.tcx, self.body, self.param_env, *place) {
let def_id = self.body.source.instance.def_id();
if let Some(impl_def_id) = self.tcx.impl_of_method(def_id)
&& self.tcx.is_builtin_derived(impl_def_id)
{
// If we ever reach here it means that the generated derive
// code is somehow doing an unaligned reference, which it
// shouldn't do.
span_bug!(
self.source_info.span,
"builtin derive created an unaligned reference"
);
} else {
self.tcx
.dcx()
.emit_err(errors::UnalignedPackedRef { span: self.source_info.span });
}
if context.is_borrow() && util::is_disaligned(self.tcx, self.body, self.param_env, *place) {
let def_id = self.body.source.instance.def_id();
if let Some(impl_def_id) = self.tcx.impl_of_method(def_id)
&& self.tcx.is_builtin_derived(impl_def_id)
{
// If we ever reach here it means that the generated derive
// code is somehow doing an unaligned reference, which it
// shouldn't do.
span_bug!(self.source_info.span, "builtin derive created an unaligned reference");
} else {
self.tcx.dcx().emit_err(errors::UnalignedPackedRef { span: self.source_info.span });
}
}
}
Expand Down
Loading
Loading