Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #103264

Merged
merged 19 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a01b885
rustdoc: remove class name `location` from sidebar sibling nav
notriddle Oct 18, 2022
d38dc68
Use already checked RHS ty for LHS deref suggestions
compiler-errors Oct 19, 2022
ffe24e5
Update browser-ui-test version to 0.12.7
GuillaumeGomez Oct 19, 2022
afccb65
Clean up codeblock-tooltip rustdoc-gui test
GuillaumeGomez Oct 19, 2022
e60016e
Split is_stable from rustc_target::spec::abi::is_enabled.
m-ou-se Oct 19, 2022
ead96f7
Allow #[unstable] impls for fn() with unstable abi.
m-ou-se Oct 19, 2022
a44a22d
Add test.
m-ou-se Oct 19, 2022
5420fa3
Add test for #[unstable] impl for fn() -> !.
m-ou-se Oct 19, 2022
c4f829b
Allow #[unstable] impl for fn() -> UnstableType.
m-ou-se Oct 19, 2022
5b7bd2f
mark rust-analyzer as a host-only tool
pietroalbini Oct 19, 2022
db57058
rustdoc: move `setting-line` color CSS to settings.css
notriddle Oct 19, 2022
b0f6935
Make miri read_dir test a little more robust
SUPERCILEX Oct 19, 2022
433f736
Rollup merge of #103211 - notriddle:notriddle/dot-location, r=Guillau…
matthiaskrgr Oct 19, 2022
e500dcb
Rollup merge of #103223 - compiler-errors:deref-sugg-slow, r=wesleywiser
matthiaskrgr Oct 19, 2022
d17cef6
Rollup merge of #103237 - GuillaumeGomez:codeblock-tooltip-cleanup, r…
matthiaskrgr Oct 19, 2022
12775ce
Rollup merge of #103239 - m-ou-se:unstable-abi-fn-impl-check, r=lcnr
matthiaskrgr Oct 19, 2022
e85def7
Rollup merge of #103246 - ferrocene:pa-rust-analyzer-hosts, r=Mark-Si…
matthiaskrgr Oct 19, 2022
952c156
Rollup merge of #103257 - notriddle:notriddle/setting-line, r=Guillau…
matthiaskrgr Oct 19, 2022
652417e
Rollup merge of #103258 - SUPERCILEX:miri, r=RalfJung
matthiaskrgr Oct 19, 2022
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
11 changes: 6 additions & 5 deletions compiler/rustc_hir_analysis/src/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,11 +1130,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
};

self.check_lhs_assignable(lhs, "E0070", span, |err| {
let rhs_ty = self.check_expr(&rhs);
suggest_deref_binop(err, rhs_ty);
});

// This is (basically) inlined `check_expr_coercable_to_type`, but we want
// to suggest an additional fixup here in `suggest_deref_binop`.
let rhs_ty = self.check_expr_with_hint(&rhs, lhs_ty);
Expand All @@ -1145,6 +1140,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
diag.emit();
}

self.check_lhs_assignable(lhs, "E0070", span, |err| {
if let Some(rhs_ty) = self.typeck_results.borrow().expr_ty_opt(rhs) {
suggest_deref_binop(err, rhs_ty);
}
});

self.require_type_is_sized(lhs_ty, lhs.span, traits::AssignmentLhsSized);

if lhs_ty.references_error() || rhs_ty.references_error() {
Expand Down
17 changes: 17 additions & 0 deletions compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,25 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
if let TyKind::Never = t.kind {
self.fully_stable = false;
}
if let TyKind::BareFn(f) = t.kind {
if rustc_target::spec::abi::is_stable(f.abi.name()).is_err() {
self.fully_stable = false;
}
}
intravisit::walk_ty(self, t)
}

fn visit_fn_decl(&mut self, fd: &'tcx hir::FnDecl<'tcx>) {
for ty in fd.inputs {
self.visit_ty(ty)
}
if let hir::FnRetTy::Return(output_ty) = fd.output {
match output_ty.kind {
TyKind::Never => {} // `-> !` is stable
_ => self.visit_ty(output_ty),
}
}
}
}

/// Given the list of enabled features that were not language features (i.e., that
Expand Down
268 changes: 109 additions & 159 deletions compiler/rustc_target/src/spec/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,175 +109,125 @@ pub enum AbiDisabled {
Unrecognized,
}

fn gate_feature_post(
pub fn is_enabled(
features: &rustc_feature::Features,
feature: Symbol,
span: Span,
explain: &'static str,
name: &str,
) -> Result<(), AbiDisabled> {
if !features.enabled(feature) && !span.allows_unstable(feature) {
Err(AbiDisabled::Unstable { feature, explain })
} else {
Ok(())
let s = is_stable(name);
if let Err(AbiDisabled::Unstable { feature, .. }) = s {
if features.enabled(feature) || span.allows_unstable(feature) {
return Ok(());
}
}
s
}

pub fn is_enabled(
features: &rustc_feature::Features,
span: Span,
name: &str,
) -> Result<(), AbiDisabled> {
pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
match name {
// Stable
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
| "system" => Ok(()),
"rust-intrinsic" => {
gate_feature_post(features, sym::intrinsics, span, "intrinsics are subject to change")
}
"platform-intrinsic" => gate_feature_post(
features,
sym::platform_intrinsics,
span,
"platform intrinsics are experimental and possibly buggy",
),
"vectorcall" => gate_feature_post(
features,
sym::abi_vectorcall,
span,
"vectorcall is experimental and subject to change",
),
"thiscall" => gate_feature_post(
features,
sym::abi_thiscall,
span,
"thiscall is experimental and subject to change",
),
"rust-call" => gate_feature_post(
features,
sym::unboxed_closures,
span,
"rust-call ABI is subject to change",
),
"rust-cold" => gate_feature_post(
features,
sym::rust_cold_cc,
span,
"rust-cold is experimental and subject to change",
),
"ptx-kernel" => gate_feature_post(
features,
sym::abi_ptx,
span,
"PTX ABIs are experimental and subject to change",
),
"unadjusted" => gate_feature_post(
features,
sym::abi_unadjusted,
span,
"unadjusted ABI is an implementation detail and perma-unstable",
),
"msp430-interrupt" => gate_feature_post(
features,
sym::abi_msp430_interrupt,
span,
"msp430-interrupt ABI is experimental and subject to change",
),
"x86-interrupt" => gate_feature_post(
features,
sym::abi_x86_interrupt,
span,
"x86-interrupt ABI is experimental and subject to change",
),
"amdgpu-kernel" => gate_feature_post(
features,
sym::abi_amdgpu_kernel,
span,
"amdgpu-kernel ABI is experimental and subject to change",
),
"avr-interrupt" | "avr-non-blocking-interrupt" => gate_feature_post(
features,
sym::abi_avr_interrupt,
span,
"avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
),
"efiapi" => gate_feature_post(
features,
sym::abi_efiapi,
span,
"efiapi ABI is experimental and subject to change",
),
"C-cmse-nonsecure-call" => gate_feature_post(
features,
sym::abi_c_cmse_nonsecure_call,
span,
"C-cmse-nonsecure-call ABI is experimental and subject to change",
),
"C-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"C-unwind ABI is experimental and subject to change",
),
"stdcall-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"stdcall-unwind ABI is experimental and subject to change",
),
"system-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"system-unwind ABI is experimental and subject to change",
),
"thiscall-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"thiscall-unwind ABI is experimental and subject to change",
),
"cdecl-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"cdecl-unwind ABI is experimental and subject to change",
),
"fastcall-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"fastcall-unwind ABI is experimental and subject to change",
),
"vectorcall-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"vectorcall-unwind ABI is experimental and subject to change",
),
"aapcs-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"aapcs-unwind ABI is experimental and subject to change",
),
"win64-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"win64-unwind ABI is experimental and subject to change",
),
"sysv64-unwind" => gate_feature_post(
features,
sym::c_unwind,
span,
"sysv64-unwind ABI is experimental and subject to change",
),
"wasm" => gate_feature_post(
features,
sym::wasm_abi,
span,
"wasm ABI is experimental and subject to change",
),
"rust-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::intrinsics,
explain: "intrinsics are subject to change",
}),
"platform-intrinsic" => Err(AbiDisabled::Unstable {
feature: sym::platform_intrinsics,
explain: "platform intrinsics are experimental and possibly buggy",
}),
"vectorcall" => Err(AbiDisabled::Unstable {
feature: sym::abi_vectorcall,
explain: "vectorcall is experimental and subject to change",
}),
"thiscall" => Err(AbiDisabled::Unstable {
feature: sym::abi_thiscall,
explain: "thiscall is experimental and subject to change",
}),
"rust-call" => Err(AbiDisabled::Unstable {
feature: sym::unboxed_closures,
explain: "rust-call ABI is subject to change",
}),
"rust-cold" => Err(AbiDisabled::Unstable {
feature: sym::rust_cold_cc,
explain: "rust-cold is experimental and subject to change",
}),
"ptx-kernel" => Err(AbiDisabled::Unstable {
feature: sym::abi_ptx,
explain: "PTX ABIs are experimental and subject to change",
}),
"unadjusted" => Err(AbiDisabled::Unstable {
feature: sym::abi_unadjusted,
explain: "unadjusted ABI is an implementation detail and perma-unstable",
}),
"msp430-interrupt" => Err(AbiDisabled::Unstable {
feature: sym::abi_msp430_interrupt,
explain: "msp430-interrupt ABI is experimental and subject to change",
}),
"x86-interrupt" => Err(AbiDisabled::Unstable {
feature: sym::abi_x86_interrupt,
explain: "x86-interrupt ABI is experimental and subject to change",
}),
"amdgpu-kernel" => Err(AbiDisabled::Unstable {
feature: sym::abi_amdgpu_kernel,
explain: "amdgpu-kernel ABI is experimental and subject to change",
}),
"avr-interrupt" | "avr-non-blocking-interrupt" => Err(AbiDisabled::Unstable {
feature: sym::abi_avr_interrupt,
explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
}),
"efiapi" => Err(AbiDisabled::Unstable {
feature: sym::abi_efiapi,
explain: "efiapi ABI is experimental and subject to change",
}),
"C-cmse-nonsecure-call" => Err(AbiDisabled::Unstable {
feature: sym::abi_c_cmse_nonsecure_call,
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
}),
"C-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "C-unwind ABI is experimental and subject to change",
}),
"stdcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "stdcall-unwind ABI is experimental and subject to change",
}),
"system-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "system-unwind ABI is experimental and subject to change",
}),
"thiscall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "thiscall-unwind ABI is experimental and subject to change",
}),
"cdecl-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "cdecl-unwind ABI is experimental and subject to change",
}),
"fastcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "fastcall-unwind ABI is experimental and subject to change",
}),
"vectorcall-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "vectorcall-unwind ABI is experimental and subject to change",
}),
"aapcs-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "aapcs-unwind ABI is experimental and subject to change",
}),
"win64-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "win64-unwind ABI is experimental and subject to change",
}),
"sysv64-unwind" => Err(AbiDisabled::Unstable {
feature: sym::c_unwind,
explain: "sysv64-unwind ABI is experimental and subject to change",
}),
"wasm" => Err(AbiDisabled::Unstable {
feature: sym::wasm_abi,
explain: "wasm ABI is experimental and subject to change",
}),
_ => Err(AbiDisabled::Unrecognized),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ pub struct RustAnalyzer {
impl Step for RustAnalyzer {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = false;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
Expand Down Expand Up @@ -742,7 +742,7 @@ pub struct RustAnalyzerProcMacroSrv {
impl Step for RustAnalyzerProcMacroSrv {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = false;
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
let builder = run.builder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.6
0.12.7
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,7 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) {
if !it.is_mod() {
let path: String = cx.current.iter().map(|s| s.as_str()).intersperse("::").collect();

write!(buffer, "<h2 class=\"location\"><a href=\"index.html\">In {}</a></h2>", path);
write!(buffer, "<h2><a href=\"index.html\">In {}</a></h2>", path);
}

// Closes sidebar-elems div.
Expand Down
Loading