Skip to content

Commit 0ab7c1d

Browse files
committed
Auto merge of #82517 - Dylan-DPC:rollup-a1958gb, r=Dylan-DPC
Rollup of 16 pull requests Successful merges: - #75807 (Convert core/num/mod.rs to intra-doc links) - #80534 (Use #[doc = include_str!()] in std) - #80553 (Add an impl of Error on `Arc<impl Error>`.) - #81167 (Make ptr::write const) - #81575 (rustdoc: Name fields of `ResolutionFailure::WrongNamespace`) - #81713 (Account for associated consts in the "unstable assoc item name colission" lint) - #82078 (Make char and u8 methods const) - #82087 (Fix ICE caused by suggestion with no code substitutions) - #82090 (Do not consider using a semicolon inside of a different-crate macro) - #82213 (Slices for vecs) - #82214 (Remove redundant to_string calls) - #82220 (fix the false 'defined here' messages) - #82313 (Update normalize.css to 8.0.1) - #82321 (AST: Remove some unnecessary boxes) - #82364 (Improve error msgs when found type is deref of expected) - #82514 (Update Clippy) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b36f770 + ebe67d9 commit 0ab7c1d

File tree

172 files changed

+7140
-3437
lines changed

Some content is hidden

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

172 files changed

+7140
-3437
lines changed

Cargo.lock

+119-11
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,14 @@ dependencies = [
565565
"cargo_metadata 0.12.0",
566566
"clippy-mini-macro-test",
567567
"clippy_lints",
568-
"compiletest_rs",
568+
"compiletest_rs 0.6.0",
569569
"derive-new",
570570
"rustc-workspace-hack",
571571
"rustc_tools_util 0.2.0",
572572
"semver 0.11.0",
573573
"serde",
574574
"tempfile",
575-
"tester",
575+
"tester 0.9.0",
576576
]
577577

578578
[[package]]
@@ -584,6 +584,7 @@ name = "clippy_lints"
584584
version = "0.1.52"
585585
dependencies = [
586586
"cargo_metadata 0.12.0",
587+
"clippy_utils",
587588
"if_chain",
588589
"itertools 0.9.0",
589590
"pulldown-cmark 0.8.0",
@@ -600,6 +601,20 @@ dependencies = [
600601
"url 2.1.1",
601602
]
602603

604+
[[package]]
605+
name = "clippy_utils"
606+
version = "0.1.52"
607+
dependencies = [
608+
"if_chain",
609+
"itertools 0.9.0",
610+
"regex-syntax",
611+
"rustc-semver",
612+
"serde",
613+
"smallvec 1.6.1",
614+
"toml",
615+
"unicode-normalization",
616+
]
617+
603618
[[package]]
604619
name = "cloudabi"
605620
version = "0.1.0"
@@ -695,7 +710,30 @@ dependencies = [
695710
"serde_derive",
696711
"serde_json",
697712
"tempfile",
698-
"tester",
713+
"tester 0.7.0",
714+
"winapi 0.3.9",
715+
]
716+
717+
[[package]]
718+
name = "compiletest_rs"
719+
version = "0.6.0"
720+
source = "registry+https://github.com/rust-lang/crates.io-index"
721+
checksum = "0086d6ad78cf409c3061618cd98e2789d5c9ce598fc9651611cf62eae0a599cb"
722+
dependencies = [
723+
"diff",
724+
"filetime",
725+
"getopts",
726+
"lazy_static",
727+
"libc",
728+
"log",
729+
"miow 0.3.6",
730+
"regex",
731+
"rustfix",
732+
"serde",
733+
"serde_derive",
734+
"serde_json",
735+
"tempfile",
736+
"tester 0.9.0",
699737
"winapi 0.3.9",
700738
]
701739

@@ -984,14 +1022,35 @@ dependencies = [
9841022
"dirs-sys",
9851023
]
9861024

1025+
[[package]]
1026+
name = "dirs-next"
1027+
version = "2.0.0"
1028+
source = "registry+https://github.com/rust-lang/crates.io-index"
1029+
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
1030+
dependencies = [
1031+
"cfg-if 1.0.0",
1032+
"dirs-sys-next",
1033+
]
1034+
9871035
[[package]]
9881036
name = "dirs-sys"
9891037
version = "0.3.5"
9901038
source = "registry+https://github.com/rust-lang/crates.io-index"
9911039
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
9921040
dependencies = [
9931041
"libc",
994-
"redox_users",
1042+
"redox_users 0.3.4",
1043+
"winapi 0.3.9",
1044+
]
1045+
1046+
[[package]]
1047+
name = "dirs-sys-next"
1048+
version = "0.1.2"
1049+
source = "registry+https://github.com/rust-lang/crates.io-index"
1050+
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
1051+
dependencies = [
1052+
"libc",
1053+
"redox_users 0.4.0",
9951054
"winapi 0.3.9",
9961055
]
9971056

@@ -1115,7 +1174,7 @@ checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
11151174
dependencies = [
11161175
"cfg-if 0.1.10",
11171176
"libc",
1118-
"redox_syscall",
1177+
"redox_syscall 0.1.57",
11191178
"winapi 0.3.9",
11201179
]
11211180

@@ -2226,7 +2285,7 @@ name = "miri"
22262285
version = "0.1.0"
22272286
dependencies = [
22282287
"colored",
2229-
"compiletest_rs",
2288+
"compiletest_rs 0.5.0",
22302289
"env_logger 0.7.1",
22312290
"getrandom 0.2.0",
22322291
"hex 0.4.2",
@@ -2458,7 +2517,7 @@ dependencies = [
24582517
"cloudabi",
24592518
"instant",
24602519
"libc",
2461-
"redox_syscall",
2520+
"redox_syscall 0.1.57",
24622521
"smallvec 1.6.1",
24632522
"winapi 0.3.9",
24642523
]
@@ -2899,17 +2958,36 @@ version = "0.1.57"
28992958
source = "registry+https://github.com/rust-lang/crates.io-index"
29002959
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
29012960

2961+
[[package]]
2962+
name = "redox_syscall"
2963+
version = "0.2.5"
2964+
source = "registry+https://github.com/rust-lang/crates.io-index"
2965+
checksum = "94341e4e44e24f6b591b59e47a8a027df12e008d73fd5672dbea9cc22f4507d9"
2966+
dependencies = [
2967+
"bitflags",
2968+
]
2969+
29022970
[[package]]
29032971
name = "redox_users"
29042972
version = "0.3.4"
29052973
source = "registry+https://github.com/rust-lang/crates.io-index"
29062974
checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
29072975
dependencies = [
29082976
"getrandom 0.1.14",
2909-
"redox_syscall",
2977+
"redox_syscall 0.1.57",
29102978
"rust-argon2",
29112979
]
29122980

2981+
[[package]]
2982+
name = "redox_users"
2983+
version = "0.4.0"
2984+
source = "registry+https://github.com/rust-lang/crates.io-index"
2985+
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
2986+
dependencies = [
2987+
"getrandom 0.2.0",
2988+
"redox_syscall 0.2.5",
2989+
]
2990+
29132991
[[package]]
29142992
name = "regex"
29152993
version = "1.4.3"
@@ -4535,6 +4613,12 @@ dependencies = [
45354613
"unicode_categories",
45364614
]
45374615

4616+
[[package]]
4617+
name = "rustversion"
4618+
version = "1.0.4"
4619+
source = "registry+https://github.com/rust-lang/crates.io-index"
4620+
checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd"
4621+
45384622
[[package]]
45394623
name = "ryu"
45404624
version = "1.0.5"
@@ -4812,7 +4896,7 @@ checksum = "7fd8b795c389288baa5f355489c65e71fd48a02104600d15c4cfbc561e9e429d"
48124896
dependencies = [
48134897
"cfg-if 0.1.10",
48144898
"libc",
4815-
"redox_syscall",
4899+
"redox_syscall 0.1.57",
48164900
"winapi 0.3.9",
48174901
]
48184902

@@ -4973,7 +5057,7 @@ checksum = "c8a4c1d0bee3230179544336c15eefb563cf0302955d962e456542323e8c2e8a"
49735057
dependencies = [
49745058
"filetime",
49755059
"libc",
4976-
"redox_syscall",
5060+
"redox_syscall 0.1.57",
49775061
"xattr",
49785062
]
49795063

@@ -4986,7 +5070,7 @@ dependencies = [
49865070
"cfg-if 0.1.10",
49875071
"libc",
49885072
"rand",
4989-
"redox_syscall",
5073+
"redox_syscall 0.1.57",
49905074
"remove_dir_all",
49915075
"winapi 0.3.9",
49925076
]
@@ -5020,6 +5104,17 @@ dependencies = [
50205104
"winapi 0.3.9",
50215105
]
50225106

5107+
[[package]]
5108+
name = "term"
5109+
version = "0.7.0"
5110+
source = "registry+https://github.com/rust-lang/crates.io-index"
5111+
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
5112+
dependencies = [
5113+
"dirs-next",
5114+
"rustversion",
5115+
"winapi 0.3.9",
5116+
]
5117+
50235118
[[package]]
50245119
name = "termcolor"
50255120
version = "1.1.0"
@@ -5065,6 +5160,19 @@ dependencies = [
50655160
"term 0.6.1",
50665161
]
50675162

5163+
[[package]]
5164+
name = "tester"
5165+
version = "0.9.0"
5166+
source = "registry+https://github.com/rust-lang/crates.io-index"
5167+
checksum = "0639d10d8f4615f223a57275cf40f9bdb7cfbb806bcb7f7cc56e3beb55a576eb"
5168+
dependencies = [
5169+
"cfg-if 1.0.0",
5170+
"getopts",
5171+
"libc",
5172+
"num_cpus",
5173+
"term 0.7.0",
5174+
]
5175+
50685176
[[package]]
50695177
name = "textwrap"
50705178
version = "0.11.0"

compiler/rustc_ast/src/ast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2695,7 +2695,7 @@ pub enum ItemKind {
26952695
/// A use declaration item (`use`).
26962696
///
26972697
/// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
2698-
Use(P<UseTree>),
2698+
Use(UseTree),
26992699
/// A static item (`static`).
27002700
///
27012701
/// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
@@ -2719,7 +2719,7 @@ pub enum ItemKind {
27192719
/// E.g., `extern {}` or `extern "C" {}`.
27202720
ForeignMod(ForeignMod),
27212721
/// Module-level inline assembly (from `global_asm!()`).
2722-
GlobalAsm(P<GlobalAsm>),
2722+
GlobalAsm(GlobalAsm),
27232723
/// A type alias (`type`).
27242724
///
27252725
/// E.g., `type Foo = Bar<u8>;`.

compiler/rustc_builtin_macros/src/global_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn expand_global_asm<'cx>(
2828
ident: Ident::invalid(),
2929
attrs: Vec::new(),
3030
id: ast::DUMMY_NODE_ID,
31-
kind: ast::ItemKind::GlobalAsm(P(global_asm)),
31+
kind: ast::ItemKind::GlobalAsm(global_asm),
3232
vis: ast::Visibility {
3333
span: sp.shrink_to_lo(),
3434
kind: ast::VisibilityKind::Inherited,

compiler/rustc_builtin_macros/src/standard_library_imports.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_ast as ast;
2-
use rustc_ast::ptr::P;
32
use rustc_expand::base::{ExtCtxt, ResolverExpand};
43
use rustc_expand::expand::ExpansionConfig;
54
use rustc_session::Session;
@@ -72,11 +71,11 @@ pub fn inject(
7271
span,
7372
Ident::invalid(),
7473
vec![cx.attribute(cx.meta_word(span, sym::prelude_import))],
75-
ast::ItemKind::Use(P(ast::UseTree {
74+
ast::ItemKind::Use(ast::UseTree {
7675
prefix: cx.path(span, import_path),
7776
kind: ast::UseTreeKind::Glob,
7877
span,
79-
})),
78+
}),
8079
);
8180

8281
krate.items.insert(0, use_item);

compiler/rustc_codegen_llvm/src/allocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub(crate) unsafe fn codegen(
9393
let args = [usize, usize]; // size, align
9494

9595
let ty = llvm::LLVMFunctionType(void, args.as_ptr(), args.len() as c_uint, False);
96-
let name = "__rust_alloc_error_handler".to_string();
96+
let name = "__rust_alloc_error_handler";
9797
let llfn = llvm::LLVMRustGetOrInsertFunction(llmod, name.as_ptr().cast(), name.len(), ty);
9898
// -> ! DIFlagNoReturn
9999
llvm::Attribute::NoReturn.apply_llfn(llvm::AttributePlace::Function, llfn);

compiler/rustc_codegen_llvm/src/asm.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
6161
// Default per-arch clobbers
6262
// Basically what clang does
6363
let arch_clobbers = match &self.sess().target.arch[..] {
64-
"x86" | "x86_64" => vec!["~{dirflag}", "~{fpsr}", "~{flags}"],
65-
"mips" | "mips64" => vec!["~{$1}"],
66-
_ => Vec::new(),
64+
"x86" | "x86_64" => &["~{dirflag}", "~{fpsr}", "~{flags}"][..],
65+
"mips" | "mips64" => &["~{$1}"],
66+
_ => &[],
6767
};
6868

6969
let all_constraints = ia

compiler/rustc_codegen_ssa/src/back/link.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,16 @@ fn get_linker(
181181
let original_path = tool.path();
182182
if let Some(ref root_lib_path) = original_path.ancestors().nth(4) {
183183
let arch = match t.arch.as_str() {
184-
"x86_64" => Some("x64".to_string()),
185-
"x86" => Some("x86".to_string()),
186-
"aarch64" => Some("arm64".to_string()),
187-
"arm" => Some("arm".to_string()),
184+
"x86_64" => Some("x64"),
185+
"x86" => Some("x86"),
186+
"aarch64" => Some("arm64"),
187+
"arm" => Some("arm"),
188188
_ => None,
189189
};
190190
if let Some(ref a) = arch {
191191
// FIXME: Move this to `fn linker_with_args`.
192192
let mut arg = OsString::from("/LIBPATH:");
193-
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a.to_string()));
193+
arg.push(format!("{}\\lib\\{}\\store", root_lib_path.display(), a));
194194
cmd.arg(&arg);
195195
} else {
196196
warn!("arch is not supported");

compiler/rustc_errors/src/diagnostic.rs

+6
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ impl Diagnostic {
295295
suggestion: Vec<(Span, String)>,
296296
applicability: Applicability,
297297
) -> &mut Self {
298+
assert!(!suggestion.is_empty());
298299
self.suggestions.push(CodeSuggestion {
299300
substitutions: vec![Substitution {
300301
parts: suggestion
@@ -318,6 +319,10 @@ impl Diagnostic {
318319
suggestions: Vec<Vec<(Span, String)>>,
319320
applicability: Applicability,
320321
) -> &mut Self {
322+
assert!(!suggestions.is_empty());
323+
for s in &suggestions {
324+
assert!(!s.is_empty());
325+
}
321326
self.suggestions.push(CodeSuggestion {
322327
substitutions: suggestions
323328
.into_iter()
@@ -348,6 +353,7 @@ impl Diagnostic {
348353
suggestion: Vec<(Span, String)>,
349354
applicability: Applicability,
350355
) -> &mut Self {
356+
assert!(!suggestion.is_empty());
351357
self.suggestions.push(CodeSuggestion {
352358
substitutions: vec![Substitution {
353359
parts: suggestion

compiler/rustc_hir/src/hir.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,14 @@ impl Expr<'_> {
15771577
expr
15781578
}
15791579

1580+
pub fn peel_blocks(&self) -> &Self {
1581+
let mut expr = self;
1582+
while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
1583+
expr = inner;
1584+
}
1585+
expr
1586+
}
1587+
15801588
pub fn can_have_side_effects(&self) -> bool {
15811589
match self.peel_drop_temps().kind {
15821590
ExprKind::Path(_) | ExprKind::Lit(_) => false,

0 commit comments

Comments
 (0)