Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a289cfc

Browse files
committed
Auto merge of rust-lang#99462 - matthiaskrgr:rollup-ihhwaru, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#98028 (Add E0790 as more specific variant of E0283) - rust-lang#99384 (use body's param-env when checking if type needs drop) - rust-lang#99401 (Avoid `Symbol` to `&str` conversions) - rust-lang#99419 (Stabilize `core::task::ready!`) - rust-lang#99435 (Revert "Stabilize $$ in Rust 1.63.0") - rust-lang#99438 (Improve suggestions for `NonZeroT` <- `T` coercion error) - rust-lang#99441 (Update mdbook) - rust-lang#99453 (:arrow_up: rust-analyzer) - rust-lang#99457 (use `par_for_each_in` in `par_body_owners` and `collect_crate_mono_items`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8bd12e8 + e6904fc commit a289cfc

File tree

55 files changed

+705
-204
lines changed

Some content is hidden

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

55 files changed

+705
-204
lines changed

Cargo.lock

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ version = "3.2.5"
634634
source = "registry+https://github.com/rust-lang/crates.io-index"
635635
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"
636636
dependencies = [
637-
"heck 0.4.0",
637+
"heck",
638638
"proc-macro-error",
639639
"proc-macro2",
640640
"quote",
@@ -1202,17 +1202,14 @@ checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f"
12021202

12031203
[[package]]
12041204
name = "elasticlunr-rs"
1205-
version = "2.3.9"
1205+
version = "3.0.0"
12061206
source = "registry+https://github.com/rust-lang/crates.io-index"
1207-
checksum = "35622eb004c8f0c5e7e2032815f3314a93df0db30a1ce5c94e62c1ecc81e22b9"
1207+
checksum = "e6dae5cac90640734ee881bc5f21b6e5123f4e5235e52428db114abffc2391d6"
12081208
dependencies = [
1209-
"lazy_static",
12101209
"regex",
12111210
"serde",
12121211
"serde_derive",
12131212
"serde_json",
1214-
"strum",
1215-
"strum_macros",
12161213
]
12171214

12181215
[[package]]
@@ -1735,15 +1732,6 @@ dependencies = [
17351732
"rustc-std-workspace-core",
17361733
]
17371734

1738-
[[package]]
1739-
name = "heck"
1740-
version = "0.3.1"
1741-
source = "registry+https://github.com/rust-lang/crates.io-index"
1742-
checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
1743-
dependencies = [
1744-
"unicode-segmentation",
1745-
]
1746-
17471735
[[package]]
17481736
name = "heck"
17491737
version = "0.4.0"
@@ -2360,17 +2348,17 @@ dependencies = [
23602348

23612349
[[package]]
23622350
name = "mdbook"
2363-
version = "0.4.18"
2351+
version = "0.4.20"
23642352
source = "registry+https://github.com/rust-lang/crates.io-index"
2365-
checksum = "74612ae81a3e5ee509854049dfa4c7975ae033c06f5fc4735c7dfbe60ee2a39d"
2353+
checksum = "13cdad8057b09a519c6c63e6d7c93ea854f5d7fbfe284df864d5e1140d215a2d"
23662354
dependencies = [
23672355
"ammonia",
23682356
"anyhow",
23692357
"chrono",
23702358
"clap",
23712359
"clap_complete",
23722360
"elasticlunr-rs",
2373-
"env_logger 0.7.1",
2361+
"env_logger 0.9.0",
23742362
"handlebars",
23752363
"lazy_static",
23762364
"log",
@@ -2379,7 +2367,6 @@ dependencies = [
23792367
"pulldown-cmark",
23802368
"regex",
23812369
"serde",
2382-
"serde_derive",
23832370
"serde_json",
23842371
"shlex",
23852372
"tempfile",
@@ -3335,7 +3322,7 @@ dependencies = [
33353322
"difference",
33363323
"env_logger 0.9.0",
33373324
"futures 0.3.19",
3338-
"heck 0.4.0",
3325+
"heck",
33393326
"home",
33403327
"itertools",
33413328
"jsonrpc-core",
@@ -5134,24 +5121,6 @@ version = "0.10.0"
51345121
source = "registry+https://github.com/rust-lang/crates.io-index"
51355122
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
51365123

5137-
[[package]]
5138-
name = "strum"
5139-
version = "0.18.0"
5140-
source = "registry+https://github.com/rust-lang/crates.io-index"
5141-
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
5142-
5143-
[[package]]
5144-
name = "strum_macros"
5145-
version = "0.18.0"
5146-
source = "registry+https://github.com/rust-lang/crates.io-index"
5147-
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
5148-
dependencies = [
5149-
"heck 0.3.1",
5150-
"proc-macro2",
5151-
"quote",
5152-
"syn",
5153-
]
5154-
51555124
[[package]]
51565125
name = "syn"
51575126
version = "1.0.91"

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
145145
InlineAsmRegOrRegClass::Reg(s) => {
146146
asm::InlineAsmRegOrRegClass::Reg(if let Some(asm_arch) = asm_arch {
147147
asm::InlineAsmReg::parse(asm_arch, s).unwrap_or_else(|e| {
148-
let msg = format!("invalid register `{}`: {}", s.as_str(), e);
148+
let msg = format!("invalid register `{}`: {}", s, e);
149149
sess.struct_span_err(*op_sp, &msg).emit();
150150
asm::InlineAsmReg::Err
151151
})
@@ -156,7 +156,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
156156
InlineAsmRegOrRegClass::RegClass(s) => {
157157
asm::InlineAsmRegOrRegClass::RegClass(if let Some(asm_arch) = asm_arch {
158158
asm::InlineAsmRegClass::parse(asm_arch, s).unwrap_or_else(|e| {
159-
let msg = format!("invalid register class `{}`: {}", s.as_str(), e);
159+
let msg = format!("invalid register class `{}`: {}", s, e);
160160
sess.struct_span_err(*op_sp, &msg).emit();
161161
asm::InlineAsmRegClass::Err
162162
})

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ impl<'a> PostExpansionVisitor<'a> {
6262
let ast::StrLit { symbol_unescaped, span, .. } = abi;
6363

6464
if let ast::Const::Yes(_) = constness {
65-
match symbol_unescaped.as_str() {
65+
match symbol_unescaped {
6666
// Stable
67-
"Rust" | "C" => {}
67+
sym::Rust | sym::C => {}
6868
abi => gate_feature_post!(
6969
&self,
7070
const_extern_fn,

compiler/rustc_codegen_llvm/src/debuginfo/gdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global<'ll>(cx: &CodegenCx<'ll, '
5555
// The initial byte `4` instructs GDB that the following pretty printer
5656
// is defined inline as opposed to in a standalone file.
5757
section_contents.extend_from_slice(b"\x04");
58-
let vis_name = format!("pretty-printer-{}-{}\n", crate_name.as_str(), index);
58+
let vis_name = format!("pretty-printer-{}-{}\n", crate_name, index);
5959
section_contents.extend_from_slice(vis_name.as_bytes());
6060
section_contents.extend_from_slice(&visualizer.src);
6161

compiler/rustc_data_structures/src/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ cfg_if! {
146146
t.into_iter()
147147
}
148148

149-
pub fn par_for_each_in<T: IntoIterator>(t: T, for_each: impl Fn(T::Item) + Sync + Send) {
149+
pub fn par_for_each_in<T: IntoIterator>(t: T, mut for_each: impl FnMut(T::Item) + Sync + Send) {
150150
// We catch panics here ensuring that all the loop iterations execute.
151151
// This makes behavior consistent with the parallel compiler.
152152
let mut panic = None;

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ E0785: include_str!("./error_codes/E0785.md"),
492492
E0786: include_str!("./error_codes/E0786.md"),
493493
E0787: include_str!("./error_codes/E0787.md"),
494494
E0788: include_str!("./error_codes/E0788.md"),
495+
E0790: include_str!("./error_codes/E0790.md"),
495496
;
496497
// E0006, // merged with E0005
497498
// E0008, // cannot bind by-move into a pattern guard

compiler/rustc_error_codes/src/error_codes/E0283.md

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,27 @@ An implementation cannot be chosen unambiguously because of lack of information.
33
Erroneous code example:
44

55
```compile_fail,E0283
6-
trait Generator {
7-
fn create() -> u32;
8-
}
9-
10-
struct Impl;
11-
12-
impl Generator for Impl {
13-
fn create() -> u32 { 1 }
14-
}
15-
16-
struct AnotherImpl;
6+
struct Foo;
177
18-
impl Generator for AnotherImpl {
19-
fn create() -> u32 { 2 }
8+
impl Into<u32> for Foo {
9+
fn into(self) -> u32 { 1 }
2010
}
2111
22-
fn main() {
23-
let cont: u32 = Generator::create();
24-
// error, impossible to choose one of Generator trait implementation
25-
// Should it be Impl or AnotherImpl, maybe something else?
26-
}
12+
let foo = Foo;
13+
let bar: u32 = foo.into() * 1u32;
2714
```
2815

2916
This error can be solved by adding type annotations that provide the missing
30-
information to the compiler. In this case, the solution is to use a concrete
31-
type:
17+
information to the compiler. In this case, the solution is to specify the
18+
trait's type parameter:
3219

3320
```
34-
trait Generator {
35-
fn create() -> u32;
36-
}
37-
38-
struct AnotherImpl;
21+
struct Foo;
3922
40-
impl Generator for AnotherImpl {
41-
fn create() -> u32 { 2 }
23+
impl Into<u32> for Foo {
24+
fn into(self) -> u32 { 1 }
4225
}
4326
44-
fn main() {
45-
let gen1 = AnotherImpl::create();
46-
47-
// if there are multiple methods with same name (different traits)
48-
let gen2 = <AnotherImpl as Generator>::create();
49-
}
27+
let foo = Foo;
28+
let bar: u32 = Into::<u32>::into(foo) * 1u32;
5029
```
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
You need to specify a specific implementation of the trait in order to call the
2+
method.
3+
4+
Erroneous code example:
5+
6+
```compile_fail,E0790
7+
trait Generator {
8+
fn create() -> u32;
9+
}
10+
11+
struct Impl;
12+
13+
impl Generator for Impl {
14+
fn create() -> u32 { 1 }
15+
}
16+
17+
struct AnotherImpl;
18+
19+
impl Generator for AnotherImpl {
20+
fn create() -> u32 { 2 }
21+
}
22+
23+
let cont: u32 = Generator::create();
24+
// error, impossible to choose one of Generator trait implementation
25+
// Should it be Impl or AnotherImpl, maybe something else?
26+
```
27+
28+
This error can be solved by adding type annotations that provide the missing
29+
information to the compiler. In this case, the solution is to use a concrete
30+
type:
31+
32+
```
33+
trait Generator {
34+
fn create() -> u32;
35+
}
36+
37+
struct AnotherImpl;
38+
39+
impl Generator for AnotherImpl {
40+
fn create() -> u32 { 2 }
41+
}
42+
43+
let gen1 = AnotherImpl::create();
44+
45+
// if there are multiple methods with same name (different traits)
46+
let gen2 = <AnotherImpl as Generator>::create();
47+
```

compiler/rustc_expand/src/mbe/quoted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ fn parse_tree(
234234
sess,
235235
&Token { kind: token::Dollar, span },
236236
);
237+
} else {
238+
maybe_emit_macro_metavar_expr_feature(features, sess, span);
237239
}
238240
TokenTree::token(token::Dollar, span)
239241
}

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ pub fn suggest_adding_lifetime_params<'tcx>(
228228
if is_impl {
229229
sugg.push_str(" and update trait if needed");
230230
}
231-
err.multipart_suggestion(sugg.as_str(), suggestions, Applicability::MaybeIncorrect);
231+
err.multipart_suggestion(sugg, suggestions, Applicability::MaybeIncorrect);
232232

233233
true
234234
}

0 commit comments

Comments
 (0)