Skip to content

Commit b1a392a

Browse files
authored
Merge branch 'rust-lang:master' into checked_ilog
2 parents 717880d + 8ed1d4a commit b1a392a

File tree

93 files changed

+2014
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2014
-472
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ build/
5858
\#*
5959
\#*\#
6060
.#*
61-
rustc-ice-*.txt
6261

6362
## Tags
6463
tags

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ impl Attribute {
9999
}
100100
}
101101

102+
pub fn path_matches(&self, name: &[Symbol]) -> bool {
103+
match &self.kind {
104+
AttrKind::Normal(normal) => {
105+
normal.item.path.segments.len() == name.len()
106+
&& normal
107+
.item
108+
.path
109+
.segments
110+
.iter()
111+
.zip(name)
112+
.all(|(s, n)| s.args.is_none() && s.ident.name == *n)
113+
}
114+
AttrKind::DocComment(..) => false,
115+
}
116+
}
117+
102118
pub fn is_word(&self) -> bool {
103119
if let AttrKind::Normal(normal) = &self.kind {
104120
matches!(normal.item.args, AttrArgs::Empty)

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
//!
8989
//! When generating the `expr` for the `A` impl, the `SubstructureFields` is
9090
//!
91-
//! ```{.text}
91+
//! ```text
9292
//! Struct(vec![FieldInfo {
9393
//! span: <span of x>
9494
//! name: Some(<ident of x>),
@@ -99,7 +99,7 @@
9999
//!
100100
//! For the `B` impl, called with `B(a)` and `B(b)`,
101101
//!
102-
//! ```{.text}
102+
//! ```text
103103
//! Struct(vec![FieldInfo {
104104
//! span: <span of `i32`>,
105105
//! name: None,
@@ -113,7 +113,7 @@
113113
//! When generating the `expr` for a call with `self == C0(a)` and `other
114114
//! == C0(b)`, the SubstructureFields is
115115
//!
116-
//! ```{.text}
116+
//! ```text
117117
//! EnumMatching(0, <ast::Variant for C0>,
118118
//! vec![FieldInfo {
119119
//! span: <span of i32>
@@ -125,7 +125,7 @@
125125
//!
126126
//! For `C1 {x}` and `C1 {x}`,
127127
//!
128-
//! ```{.text}
128+
//! ```text
129129
//! EnumMatching(1, <ast::Variant for C1>,
130130
//! vec![FieldInfo {
131131
//! span: <span of x>
@@ -137,7 +137,7 @@
137137
//!
138138
//! For the tags,
139139
//!
140-
//! ```{.text}
140+
//! ```text
141141
//! EnumTag(
142142
//! &[<ident of self tag>, <ident of other tag>], <expr to combine with>)
143143
//! ```
@@ -149,7 +149,7 @@
149149
//!
150150
//! A static method on the types above would result in,
151151
//!
152-
//! ```{.text}
152+
//! ```text
153153
//! StaticStruct(<ast::VariantData of A>, Named(vec![(<ident of x>, <span of x>)]))
154154
//!
155155
//! StaticStruct(<ast::VariantData of B>, Unnamed(vec![<span of x>]))

compiler/rustc_const_eval/src/interpret/operand.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ impl<Prov: Provenance> std::fmt::Display for ImmTy<'_, Prov> {
136136

137137
impl<Prov: Provenance> std::fmt::Debug for ImmTy<'_, Prov> {
138138
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
139-
f.debug_struct("ImmTy").field("imm", &self.imm).field("ty", &self.layout.ty).finish()
139+
// Printing `layout` results in too much noise; just print a nice version of the type.
140+
f.debug_struct("ImmTy")
141+
.field("imm", &self.imm)
142+
.field("ty", &format_args!("{}", self.layout.ty))
143+
.finish()
140144
}
141145
}
142146

@@ -305,7 +309,11 @@ pub struct OpTy<'tcx, Prov: Provenance = AllocId> {
305309

306310
impl<Prov: Provenance> std::fmt::Debug for OpTy<'_, Prov> {
307311
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
308-
f.debug_struct("OpTy").field("op", &self.op).field("ty", &self.layout.ty).finish()
312+
// Printing `layout` results in too much noise; just print a nice version of the type.
313+
f.debug_struct("OpTy")
314+
.field("op", &self.op)
315+
.field("ty", &format_args!("{}", self.layout.ty))
316+
.finish()
309317
}
310318
}
311319

compiler/rustc_const_eval/src/interpret/place.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ pub struct MPlaceTy<'tcx, Prov: Provenance = AllocId> {
117117

118118
impl<Prov: Provenance> std::fmt::Debug for MPlaceTy<'_, Prov> {
119119
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
120+
// Printing `layout` results in too much noise; just print a nice version of the type.
120121
f.debug_struct("MPlaceTy")
121122
.field("mplace", &self.mplace)
122-
.field("ty", &self.layout.ty)
123+
.field("ty", &format_args!("{}", self.layout.ty))
123124
.finish()
124125
}
125126
}
@@ -237,7 +238,11 @@ pub struct PlaceTy<'tcx, Prov: Provenance = AllocId> {
237238

238239
impl<Prov: Provenance> std::fmt::Debug for PlaceTy<'_, Prov> {
239240
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
240-
f.debug_struct("PlaceTy").field("place", &self.place).field("ty", &self.layout.ty).finish()
241+
// Printing `layout` results in too much noise; just print a nice version of the type.
242+
f.debug_struct("PlaceTy")
243+
.field("place", &self.place)
244+
.field("ty", &format_args!("{}", self.layout.ty))
245+
.finish()
241246
}
242247
}
243248

compiler/rustc_feature/src/active.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ declare_features! (
401401
/// Allows function attribute `#[coverage(on/off)]`, to control coverage
402402
/// instrumentation of that function.
403403
(active, coverage_attribute, "CURRENT_RUSTC_VERSION", Some(84605), None),
404+
/// Allows users to provide classes for fenced code block using `class:classname`.
405+
(active, custom_code_classes_in_docs, "CURRENT_RUSTC_VERSION", Some(79483), None),
404406
/// Allows non-builtin attributes in inner attribute position.
405407
(active, custom_inner_attributes, "1.30.0", Some(54726), None),
406408
/// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`.
@@ -414,7 +416,7 @@ declare_features! (
414416
/// Allows having using `suggestion` in the `#[deprecated]` attribute.
415417
(active, deprecated_suggestion, "1.61.0", Some(94785), None),
416418
/// Allows using the `#[diagnostic]` attribute tool namespace
417-
(active, diagnostic_namespace, "1.73.0", Some(94785), None),
419+
(active, diagnostic_namespace, "1.73.0", Some(111996), None),
418420
/// Controls errors in trait implementations.
419421
(active, do_not_recommend, "1.67.0", Some(51992), None),
420422
/// Tells rustdoc to automatically generate `#[doc(cfg(...))]`.

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ use rustc_hir::def::DefKind;
117117
fluent_messages! { "../messages.ftl" }
118118

119119
fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
120-
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `win64`, `sysv64` or `efiapi`";
120+
const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`";
121121
const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
122122
const UNSTABLE_EXPLAIN: &str =
123123
"using calling conventions other than `C` or `cdecl` for varargs functions is unstable";

compiler/rustc_interface/src/util.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,13 @@ pub fn build_output_filenames(attrs: &[ast::Attribute], sess: &Session) -> Outpu
568568
) {
569569
sess.emit_fatal(errors::MultipleOutputTypesToStdout);
570570
}
571+
572+
let crate_name = sess
573+
.opts
574+
.crate_name
575+
.clone()
576+
.or_else(|| rustc_attr::find_crate_name(attrs).map(|n| n.to_string()));
577+
571578
match sess.io.output_file {
572579
None => {
573580
// "-" as input file will cause the parser to read from stdin so we
@@ -576,15 +583,11 @@ pub fn build_output_filenames(attrs: &[ast::Attribute], sess: &Session) -> Outpu
576583
let dirpath = sess.io.output_dir.clone().unwrap_or_default();
577584

578585
// If a crate name is present, we use it as the link name
579-
let stem = sess
580-
.opts
581-
.crate_name
582-
.clone()
583-
.or_else(|| rustc_attr::find_crate_name(attrs).map(|n| n.to_string()))
584-
.unwrap_or_else(|| sess.io.input.filestem().to_owned());
586+
let stem = crate_name.clone().unwrap_or_else(|| sess.io.input.filestem().to_owned());
585587

586588
OutputFilenames::new(
587589
dirpath,
590+
crate_name.unwrap_or_else(|| stem.replace('-', "_")),
588591
stem,
589592
None,
590593
sess.io.temps_dir.clone(),
@@ -609,9 +612,12 @@ pub fn build_output_filenames(attrs: &[ast::Attribute], sess: &Session) -> Outpu
609612
sess.emit_warning(errors::IgnoringOutDir);
610613
}
611614

615+
let out_filestem =
616+
out_file.filestem().unwrap_or_default().to_str().unwrap().to_string();
612617
OutputFilenames::new(
613618
out_file.parent().unwrap_or_else(|| Path::new("")).to_path_buf(),
614-
out_file.filestem().unwrap_or_default().to_str().unwrap().to_string(),
619+
crate_name.unwrap_or_else(|| out_filestem.replace('-', "_")),
620+
out_filestem,
615621
ofile,
616622
sess.io.temps_dir.clone(),
617623
sess.opts.cg.extra_filename.clone(),

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,8 +3405,8 @@ declare_lint_pass! {
34053405
UNFULFILLED_LINT_EXPECTATIONS,
34063406
UNINHABITED_STATIC,
34073407
UNKNOWN_CRATE_TYPES,
3408-
UNKNOWN_DIAGNOSTIC_ATTRIBUTES,
34093408
UNKNOWN_LINTS,
3409+
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
34103410
UNNAMEABLE_TEST_ITEMS,
34113411
UNNAMEABLE_TYPES,
34123412
UNREACHABLE_CODE,
@@ -4420,7 +4420,8 @@ declare_lint! {
44204420
}
44214421

44224422
declare_lint! {
4423-
/// The `unknown_diagnostic_attributes` lint detects unrecognized diagnostic attributes.
4423+
/// The `unknown_or_malformed_diagnostic_attributes` lint detects unrecognized or otherwise malformed
4424+
/// diagnostic attributes.
44244425
///
44254426
/// ### Example
44264427
///
@@ -4432,15 +4433,17 @@ declare_lint! {
44324433
///
44334434
/// {{produces}}
44344435
///
4436+
///
44354437
/// ### Explanation
44364438
///
44374439
/// It is usually a mistake to specify a diagnostic attribute that does not exist. Check
44384440
/// the spelling, and check the diagnostic attribute listing for the correct name. Also
44394441
/// consider if you are using an old version of the compiler, and the attribute
44404442
/// is only available in a newer version.
4441-
pub UNKNOWN_DIAGNOSTIC_ATTRIBUTES,
4443+
pub UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
44424444
Warn,
4443-
"unrecognized diagnostic attribute"
4445+
"unrecognized or malformed diagnostic attribute",
4446+
@feature_gate = sym::diagnostic_namespace;
44444447
}
44454448

44464449
declare_lint! {

compiler/rustc_metadata/src/fs.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::errors::{
55
use crate::{encode_metadata, EncodedMetadata};
66

77
use rustc_data_structures::temp_dir::MaybeTempDir;
8-
use rustc_hir::def_id::LOCAL_CRATE;
98
use rustc_middle::ty::TyCtxt;
109
use rustc_session::config::{OutFileName, OutputType};
1110
use rustc_session::output::filename_for_metadata;
@@ -40,8 +39,7 @@ pub fn emit_wrapper_file(
4039
}
4140

4241
pub fn encode_and_write_metadata(tcx: TyCtxt<'_>) -> (EncodedMetadata, bool) {
43-
let crate_name = tcx.crate_name(LOCAL_CRATE);
44-
let out_filename = filename_for_metadata(tcx.sess, crate_name, tcx.output_filenames(()));
42+
let out_filename = filename_for_metadata(tcx.sess, tcx.output_filenames(()));
4543
// To avoid races with another rustc process scanning the output directory,
4644
// we need to write the file somewhere else and atomically move it to its
4745
// final destination, with an `fs::rename` call. In order for the rename to

0 commit comments

Comments
 (0)