Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5f62326
Prepare for merging from rust-lang/rust
invalid-email-address Nov 24, 2025
7a3ccfa
Merge ref 'd3e1ccdf40ae' from rust-lang/rust
invalid-email-address Nov 24, 2025
f976589
Merge pull request #2653 from rust-lang/rustc-pull
tshepang Nov 24, 2025
7593f9d
Fix link to README in ui test documentation
reddevilmidzy Nov 24, 2025
7fd977d
Merge pull request #2654 from reddevilmidzy/fix-link
tshepang Nov 24, 2025
4aa5ee9
Update contributing.md with Rust Book reference
reddevilmidzy Nov 25, 2025
4ae1585
Merge pull request #2655 from reddevilmidzy/docs
jyn514 Nov 25, 2025
b881bd2
add a high-level design description
ZuseZ4 Nov 25, 2025
1a114ae
Merge pull request #2656 from rust-lang/highlevel-offload-doc
ZuseZ4 Nov 25, 2025
2aa9360
Give an overview of our stability guarantees
Enselic Nov 27, 2025
7e318fb
Merge pull request #2657 from Enselic/stability-guarantees
tshepang Nov 27, 2025
430ec29
Prepare for merging from rust-lang/rust
invalid-email-address Nov 27, 2025
763749c
Merge ref '1be6b13be73d' from rust-lang/rust
invalid-email-address Nov 27, 2025
9178b42
Merge pull request #2658 from rust-lang/rustc-pull
tshepang Nov 27, 2025
9289323
Specify toolchain part in building and running
Mattias-Petersson Nov 27, 2025
16a47d9
Update src/building/how-to-build-and-run.md
Mattias-Petersson Nov 28, 2025
b43ab5d
Merge pull request #2659 from Mattias-Petersson/fix-1737
tshepang Nov 28, 2025
bd21195
Update to mdbook 0.5
ehuss Nov 22, 2025
5d8e7ae
Fix some broken links
ehuss Nov 28, 2025
b003edf
Merge pull request #2660 from ehuss/fix-links
tshepang Nov 28, 2025
5c73527
Merge pull request #2652 from ehuss/mdbook-0.5
tshepang Nov 28, 2025
05b8b5a
sembr backend/libs-and-metadata.md
tshepang Nov 29, 2025
9e61149
link text spanning separate lines is awkward
tshepang Nov 29, 2025
1d1de85
Merge pull request #2661 from rust-lang/tshepang/sembr
tshepang Nov 29, 2025
74da3a2
add coercions chapter and split out non hir typeck stuff
BoxyUwU Nov 29, 2025
c3c1401
do not mess with a &[u8; 2]
tshepang Nov 29, 2025
e26128a
sembr tests/crater.md
tshepang Nov 29, 2025
c58288a
manual formatting improvement
tshepang Nov 29, 2025
93a3a3d
Merge pull request #2664 from rust-lang/tshepang/sembr
tshepang Nov 29, 2025
c5e928d
Prepare for merging from rust-lang/rust
invalid-email-address Dec 1, 2025
5a04906
Merge ref 'dfe1b8c97bcd' from rust-lang/rust
invalid-email-address Dec 1, 2025
67c7b17
Merge pull request #2665 from rust-lang/rustc-pull
tshepang Dec 1, 2025
b55796f
Uppper typo
BoxyUwU Dec 1, 2025
8b15760
Add coercions chapter and split out non hir typeck stuff
BoxyUwU Dec 1, 2025
5e0b153
Fix example which wrongly implied that the upper bound of edition ran…
fmease Dec 2, 2025
b55fefc
Merge pull request #2669 from fmease/fix-ed-range
fmease Dec 2, 2025
f113df3
Remove pagetoc
ehuss Dec 3, 2025
4eee8cb
Merge pull request #2671 from ehuss/remove-pagetoc
tshepang Dec 3, 2025
0ab78c1
`is_const_default_method` is completely handled by the `constness` query
oli-obk Dec 3, 2025
8d70cfe
Add a section about `rustc_clean`
JonathanBrouwer Dec 2, 2025
023a931
Merge pull request #2670 from rust-lang/rustc_clean
JonathanBrouwer Dec 3, 2025
ce050d6
Add Zed to quickstart
reddevilmidzy Dec 4, 2025
caac41d
Merge pull request #2673 from reddevilmidzy/zed
tshepang Dec 4, 2025
8f59eb0
Move attribute lints to `rustc_lint`
JonathanBrouwer Dec 4, 2025
2421920
f*::min/max: fix comparing with libm and IEEE operations
RalfJung Dec 2, 2025
b53b824
Rollup merge of #149563 - RalfJung:f-min-max, r=tgross35
jhpratt Dec 6, 2025
e5f552a
Rollup merge of #149592 - oli-obk:no_is_const_default_method_fn, r=fe…
jhpratt Dec 6, 2025
28435f8
Rollup merge of #149662 - JonathanBrouwer:lint-rework, r=jdonszelmann
jhpratt Dec 6, 2025
00e2496
Rollup merge of #149684 - tshepang:rdg-sync, r=tshepang
jhpratt Dec 6, 2025
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
3 changes: 2 additions & 1 deletion Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3945,6 +3945,7 @@ dependencies = [
"rustc_hashes",
"rustc_hir_id",
"rustc_index",
"rustc_lint_defs",
"rustc_macros",
"rustc_serialize",
"rustc_span",
Expand All @@ -3962,14 +3963,14 @@ dependencies = [
"rustc_abi",
"rustc_arena",
"rustc_ast",
"rustc_attr_parsing",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_fluent_macro",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_lint",
"rustc_lint_defs",
"rustc_macros",
"rustc_middle",
Expand Down
31 changes: 0 additions & 31 deletions compiler/rustc_attr_parsing/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ attr_parsing_deprecated_item_suggestion =
.help = add `#![feature(deprecated_suggestion)]` to the crate root
.note = see #94785 for more details

attr_parsing_empty_attribute =
unused attribute
.suggestion = {$valid_without_list ->
[true] remove these parentheses
*[other] remove this attribute
}
.note = {$valid_without_list ->
[true] using `{$attr_path}` with an empty list is equivalent to not using a list at all
*[other] using `{$attr_path}` with an empty list has no effect
}


attr_parsing_empty_confusables =
expected at least one confusable name
attr_parsing_empty_link_name =
Expand Down Expand Up @@ -119,19 +107,9 @@ attr_parsing_invalid_repr_hint_no_value =
attr_parsing_invalid_since =
'since' must be a Rust version number, such as "1.31.0"

attr_parsing_invalid_style = {$is_used_as_inner ->
[false] crate-level attribute should be an inner attribute: add an exclamation mark: `#![{$name}]`
*[other] the `#![{$name}]` attribute can only be used at the crate root
}
.note = This attribute does not have an `!`, which means it is applied to this {$target}

attr_parsing_invalid_target = `#[{$name}]` attribute cannot be used on {$target}
.help = `#[{$name}]` can {$only}be applied to {$applied}
.suggestion = remove the attribute
attr_parsing_invalid_target_lint = `#[{$name}]` attribute cannot be used on {$target}
.warn = {-attr_parsing_previously_accepted}
.help = `#[{$name}]` can {$only}be applied to {$applied}
.suggestion = remove the attribute

attr_parsing_limit_invalid =
`limit` must be a non-negative integer
Expand Down Expand Up @@ -250,19 +228,10 @@ attr_parsing_unsupported_literal_generic =
attr_parsing_unsupported_literal_suggestion =
consider removing the prefix

attr_parsing_unused_duplicate =
unused attribute
.suggestion = remove this attribute
.note = attribute also specified here
.warn = {-attr_parsing_previously_accepted}

attr_parsing_unused_multiple =
multiple `{$name}` attributes
.suggestion = remove this attribute
.note = attribute also specified here

-attr_parsing_previously_accepted =
this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!

attr_parsing_whole_archive_needs_static =
linking modifier `whole-archive` is only compatible with `static` linking kind
5 changes: 2 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SingleAttributeParser which is what we have two of here.

use rustc_hir::attrs::{AttributeKind, InlineAttr};
use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT;

use super::prelude::*;

Expand Down Expand Up @@ -56,9 +57,7 @@ impl<S: Stage> SingleAttributeParser<S> for InlineParser {
}
}
ArgParser::NameValue(_) => {
let suggestions = cx.suggestions();
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
cx.warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
return None;
}
}
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_attr_parsing/src/attributes/link_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rustc_feature::Features;
use rustc_hir::attrs::AttributeKind::{LinkName, LinkOrdinal, LinkSection};
use rustc_hir::attrs::*;
use rustc_session::Session;
use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT;
use rustc_session::parse::feature_err;
use rustc_span::kw;
use rustc_target::spec::{Arch, BinaryFormat};
Expand Down Expand Up @@ -71,9 +72,7 @@ impl<S: Stage> CombineAttributeParser<S> for LinkParser {
// Specifically `#[link = "dl"]` is accepted with a FCW
// For more information, see https://github.com/rust-lang/rust/pull/143193
ArgParser::NameValue(nv) if nv.value_as_str().is_some_and(|v| v == sym::dl) => {
let suggestions = cx.suggestions();
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
cx.warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
return None;
}
_ => {
Expand Down
15 changes: 3 additions & 12 deletions compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use rustc_errors::DiagArgValue;
use rustc_hir::attrs::MacroUseArgs;
use rustc_session::lint::builtin::INVALID_MACRO_EXPORT_ARGUMENTS;

use super::prelude::*;
use crate::session_diagnostics::IllFormedAttributeInputLint;
Expand Down Expand Up @@ -152,23 +153,13 @@ impl<S: Stage> SingleAttributeParser<S> for MacroExportParser {
ArgParser::NoArgs => false,
ArgParser::List(list) => {
let Some(l) = list.single() else {
let span = cx.attr_span;
let suggestions = cx.suggestions();
cx.emit_lint(
AttributeLintKind::InvalidMacroExportArguments { suggestions },
span,
);
cx.warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
};
match l.meta_item().and_then(|i| i.path().word_sym()) {
Some(sym::local_inner_macros) => true,
_ => {
let span = cx.attr_span;
let suggestions = cx.suggestions();
cx.emit_lint(
AttributeLintKind::InvalidMacroExportArguments { suggestions },
span,
);
cx.warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
}
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_attr_parsing/src/attributes/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ pub(super) use rustc_feature::{AttributeTemplate, template};
#[doc(hidden)]
pub(super) use rustc_hir::attrs::AttributeKind;
#[doc(hidden)]
pub(super) use rustc_hir::lints::AttributeLintKind;
#[doc(hidden)]
pub(super) use rustc_hir::{MethodKind, Target};
#[doc(hidden)]
pub(super) use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
Expand Down
13 changes: 4 additions & 9 deletions compiler/rustc_attr_parsing/src/attributes/test_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT;

use super::prelude::*;

pub(crate) struct IgnoreParser;
Expand All @@ -20,20 +22,13 @@ impl<S: Stage> SingleAttributeParser<S> for IgnoreParser {
ArgParser::NoArgs => None,
ArgParser::NameValue(name_value) => {
let Some(str_value) = name_value.value_as_str() else {
let suggestions = cx.suggestions();
let span = cx.attr_span;
cx.emit_lint(
AttributeLintKind::IllFormedAttributeInput { suggestions },
span,
);
cx.warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
return None;
};
Some(str_value)
}
ArgParser::List(_) => {
let suggestions = cx.suggestions();
let span = cx.attr_span;
cx.emit_lint(AttributeLintKind::IllFormedAttributeInput { suggestions }, span);
cx.warn_ill_formed_attribute_input(ILL_FORMED_ATTRIBUTE_INPUT);
return None;
}
},
Expand Down
20 changes: 17 additions & 3 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use rustc_hir::attrs::AttributeKind;
use rustc_hir::lints::{AttributeLint, AttributeLintKind};
use rustc_hir::{AttrPath, CRATE_HIR_ID, HirId};
use rustc_session::Session;
use rustc_session::lint::{Lint, LintId};
use rustc_span::{ErrorGuaranteed, Span, Symbol};

use crate::AttributeParser;
Expand Down Expand Up @@ -381,19 +382,20 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
/// Emit a lint. This method is somewhat special, since lints emitted during attribute parsing
/// must be delayed until after HIR is built. This method will take care of the details of
/// that.
pub(crate) fn emit_lint(&mut self, lint: AttributeLintKind, span: Span) {
pub(crate) fn emit_lint(&mut self, lint: &'static Lint, kind: AttributeLintKind, span: Span) {
if !matches!(
self.stage.should_emit(),
ShouldEmit::ErrorsAndLints | ShouldEmit::EarlyFatal { also_emit_lints: true }
) {
return;
}
let id = self.target_id;
(self.emit_lint)(AttributeLint { id, span, kind: lint });
(self.emit_lint)(AttributeLint { lint_id: LintId::of(lint), id, span, kind });
}

pub(crate) fn warn_unused_duplicate(&mut self, used_span: Span, unused_span: Span) {
self.emit_lint(
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
AttributeLintKind::UnusedDuplicate {
this: unused_span,
other: used_span,
Expand All @@ -409,6 +411,7 @@ impl<'f, 'sess: 'f, S: Stage> SharedContext<'f, 'sess, S> {
unused_span: Span,
) {
self.emit_lint(
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
AttributeLintKind::UnusedDuplicate {
this: unused_span,
other: used_span,
Expand Down Expand Up @@ -632,14 +635,25 @@ impl<'f, 'sess: 'f, S: Stage> AcceptContext<'f, 'sess, S> {
}

pub(crate) fn warn_empty_attribute(&mut self, span: Span) {
let attr_path = self.attr_path.clone();
let attr_path = self.attr_path.clone().to_string();
let valid_without_list = self.template.word;
self.emit_lint(
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
AttributeLintKind::EmptyAttribute { first_span: span, attr_path, valid_without_list },
span,
);
}

pub(crate) fn warn_ill_formed_attribute_input(&mut self, lint: &'static Lint) {
let suggestions = self.suggestions();
let span = self.attr_span;
self.emit_lint(
lint,
AttributeLintKind::IllFormedAttributeInput { suggestions, docs: None },
span,
);
}

pub(crate) fn suggestions(&self) -> Vec<String> {
let style = match self.parsed_description {
// If the outer and inner spans are equal, we are parsing an embedded attribute
Expand Down
17 changes: 14 additions & 3 deletions compiler/rustc_attr_parsing/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use rustc_hir::attrs::AttributeKind;
use rustc_hir::lints::AttributeLint;
use rustc_hir::{AttrArgs, AttrItem, AttrPath, Attribute, HashIgnoredAttrId, Target};
use rustc_session::Session;
use rustc_session::lint::BuiltinLintDiag;
use rustc_span::{DUMMY_SP, Span, Symbol, sym};

use crate::context::{AcceptContext, FinalizeContext, SharedContext, Stage};
Expand Down Expand Up @@ -115,7 +116,12 @@ impl<'sess> AttributeParser<'sess, Early> {
OmitDoc::Skip,
std::convert::identity,
|lint| {
crate::lints::emit_attribute_lint(&lint, sess);
sess.psess.buffer_lint(
lint.lint_id.lint,
lint.span,
lint.id,
BuiltinLintDiag::AttributeLint(lint.kind),
)
},
)
}
Expand Down Expand Up @@ -183,8 +189,13 @@ impl<'sess> AttributeParser<'sess, Early> {
sess,
stage: Early { emit_errors },
};
let mut emit_lint = |lint| {
crate::lints::emit_attribute_lint(&lint, sess);
let mut emit_lint = |lint: AttributeLint<NodeId>| {
sess.psess.buffer_lint(
lint.lint_id.lint,
lint.span,
lint.id,
BuiltinLintDiag::AttributeLint(lint.kind),
)
};
if let Some(safety) = attr_safety {
parser.check_attribute_safety(
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_attr_parsing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ mod interface;
/// like lists or name-value pairs.
pub mod parser;

mod lints;
mod safety;
mod session_diagnostics;
mod target_checking;
Expand All @@ -111,7 +110,6 @@ pub use attributes::cfg_select::*;
pub use attributes::util::{is_builtin_attr, is_doc_alias_attrs_contain_symbol, parse_version};
pub use context::{Early, Late, OmitDoc, ShouldEmit};
pub use interface::AttributeParser;
pub use lints::emit_attribute_lint;
pub use session_diagnostics::ParsedDescription;

rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
Loading
Loading