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

Commit 90fdc1f

Browse files
committed
Auto merge of rust-lang#117716 - GuillaumeGomez:rollup-83gnhll, r=GuillaumeGomez
Rollup of 5 pull requests Successful merges: - rust-lang#117263 (handle the case when the change-id isn't found) - rust-lang#117282 (Recover from incorrectly ordered/duplicated function keywords) - rust-lang#117679 (tests/rustdoc-json: Avoid needless use of `no_core` and `lang_items`) - rust-lang#117702 (target: move base and target specifications) - rust-lang#117713 (Add test for reexported hidden item with `--document-hidden-items`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 341efb1 + 9d3c802 commit 90fdc1f

File tree

341 files changed

+706
-712
lines changed

Some content is hidden

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

341 files changed

+706
-712
lines changed

compiler/rustc_parse/src/parser/item.rs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,22 +2401,39 @@ impl<'a> Parser<'a> {
24012401
Misplaced(Span),
24022402
}
24032403

2404+
// We may be able to recover
2405+
let mut recover_constness = constness;
2406+
let mut recover_asyncness = asyncness;
2407+
let mut recover_unsafety = unsafety;
24042408
// This will allow the machine fix to directly place the keyword in the correct place or to indicate
24052409
// that the keyword is already present and the second instance should be removed.
24062410
let wrong_kw = if self.check_keyword(kw::Const) {
24072411
match constness {
24082412
Const::Yes(sp) => Some(WrongKw::Duplicated(sp)),
2409-
Const::No => Some(WrongKw::Misplaced(async_start_sp)),
2413+
Const::No => {
2414+
recover_constness = Const::Yes(self.token.span);
2415+
Some(WrongKw::Misplaced(async_start_sp))
2416+
}
24102417
}
24112418
} else if self.check_keyword(kw::Async) {
24122419
match asyncness {
24132420
Async::Yes { span, .. } => Some(WrongKw::Duplicated(span)),
2414-
Async::No => Some(WrongKw::Misplaced(unsafe_start_sp)),
2421+
Async::No => {
2422+
recover_asyncness = Async::Yes {
2423+
span: self.token.span,
2424+
closure_id: DUMMY_NODE_ID,
2425+
return_impl_trait_id: DUMMY_NODE_ID,
2426+
};
2427+
Some(WrongKw::Misplaced(unsafe_start_sp))
2428+
}
24152429
}
24162430
} else if self.check_keyword(kw::Unsafe) {
24172431
match unsafety {
24182432
Unsafe::Yes(sp) => Some(WrongKw::Duplicated(sp)),
2419-
Unsafe::No => Some(WrongKw::Misplaced(ext_start_sp)),
2433+
Unsafe::No => {
2434+
recover_unsafety = Unsafe::Yes(self.token.span);
2435+
Some(WrongKw::Misplaced(ext_start_sp))
2436+
}
24202437
}
24212438
} else {
24222439
None
@@ -2486,6 +2503,23 @@ impl<'a> Parser<'a> {
24862503
}
24872504
}
24882505
}
2506+
2507+
if wrong_kw.is_some()
2508+
&& self.may_recover()
2509+
&& self.look_ahead(1, |tok| tok.is_keyword_case(kw::Fn, case))
2510+
{
2511+
// Advance past the misplaced keyword and `fn`
2512+
self.bump();
2513+
self.bump();
2514+
err.emit();
2515+
return Ok(FnHeader {
2516+
constness: recover_constness,
2517+
unsafety: recover_unsafety,
2518+
asyncness: recover_asyncness,
2519+
ext,
2520+
});
2521+
}
2522+
24892523
return Err(err);
24902524
}
24912525
}

compiler/rustc_target/src/spec/aarch64_fuchsia.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

compiler/rustc_target/src/spec/avr_unknown_gnu_atmega328.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

compiler/rustc_target/src/spec/android_base.rs renamed to compiler/rustc_target/src/spec/base/android.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::spec::{SanitizerSet, TargetOptions};
1+
use crate::spec::{base, SanitizerSet, TargetOptions};
22

33
pub fn opts() -> TargetOptions {
4-
let mut base = super::linux_base::opts();
4+
let mut base = base::linux::opts();
55
base.os = "android".into();
66
base.is_like_android = true;
77
base.default_dwarf_version = 2;

compiler/rustc_target/src/spec/apple_base.rs renamed to compiler/rustc_target/src/spec/base/apple/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::{borrow::Cow, env};
22

3+
use crate::spec::{add_link_args, add_link_args_iter};
34
use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs};
45
use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions};
56

67
#[cfg(test)]
7-
#[path = "apple/tests.rs"]
88
mod tests;
99

1010
use Arch::*;
@@ -102,13 +102,13 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
102102
LinkerFlavor::Darwin(Cc::No, Lld::No),
103103
&["-arch", arch, "-platform_version"],
104104
);
105-
super::add_link_args_iter(
105+
add_link_args_iter(
106106
&mut args,
107107
LinkerFlavor::Darwin(Cc::No, Lld::No),
108108
[platform_name, platform_version.clone(), platform_version].into_iter(),
109109
);
110110
if abi != "macabi" {
111-
super::add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-arch", arch]);
111+
add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &["-arch", arch]);
112112
}
113113

114114
args

compiler/rustc_target/src/spec/apple/tests.rs renamed to compiler/rustc_target/src/spec/base/apple/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{
1+
use crate::spec::targets::{
22
aarch64_apple_darwin, aarch64_apple_ios_sim, aarch64_apple_watchos_sim, i686_apple_darwin,
33
x86_64_apple_darwin, x86_64_apple_ios, x86_64_apple_tvos, x86_64_apple_watchos_sim,
44
};

0 commit comments

Comments
 (0)