Auto merge of #106786 - JohnTitor:rollup-8f4vk8m, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #105795 (Stabilize `abi_efiapi` feature) - #106446 ([LSDA] Take ttype_index into account when taking unwind action) - #106675 (Mark ZST as FFI-safe if all its fields are PhantomData) - #106740 (Adding a hint on iterator type errors) - #106741 (Fix reexport of `doc(hidden)` item) - #106759 (Revert "Make nested RPITIT inherit the parent opaque's generics.") - #106772 (Re-add mw to review rotation) - #106778 (Exclude formatting commit from blame) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
86ad69d4c6
@ -6,3 +6,5 @@ a06baa56b95674fc626b3c3fd680d6a65357fe60
|
|||||||
971c549ca334b7b7406e61e958efcca9c4152822
|
971c549ca334b7b7406e61e958efcca9c4152822
|
||||||
# refactor infcx building
|
# refactor infcx building
|
||||||
283abbf0e7d20176f76006825b5c52e9a4234e4c
|
283abbf0e7d20176f76006825b5c52e9a4234e4c
|
||||||
|
# format libstd/sys
|
||||||
|
c34fbfaad38cf5829ef5cfe780dc9d58480adeaa
|
||||||
|
@ -48,6 +48,8 @@ declare_features! (
|
|||||||
|
|
||||||
/// Allows `#[target_feature(...)]` on aarch64 platforms
|
/// Allows `#[target_feature(...)]` on aarch64 platforms
|
||||||
(accepted, aarch64_target_feature, "1.61.0", Some(44839), None),
|
(accepted, aarch64_target_feature, "1.61.0", Some(44839), None),
|
||||||
|
/// Allows using the `efiapi` ABI.
|
||||||
|
(accepted, abi_efiapi, "CURRENT_RUSTC_VERSION", Some(65815), None),
|
||||||
/// Allows the sysV64 ABI to be specified on all platforms
|
/// Allows the sysV64 ABI to be specified on all platforms
|
||||||
/// instead of just the platforms on which it is the C ABI.
|
/// instead of just the platforms on which it is the C ABI.
|
||||||
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
|
(accepted, abi_sysv64, "1.24.0", Some(36167), None),
|
||||||
|
@ -281,8 +281,6 @@ declare_features! (
|
|||||||
(active, abi_avr_interrupt, "1.45.0", Some(69664), None),
|
(active, abi_avr_interrupt, "1.45.0", Some(69664), None),
|
||||||
/// Allows `extern "C-cmse-nonsecure-call" fn()`.
|
/// Allows `extern "C-cmse-nonsecure-call" fn()`.
|
||||||
(active, abi_c_cmse_nonsecure_call, "1.51.0", Some(81391), None),
|
(active, abi_c_cmse_nonsecure_call, "1.51.0", Some(81391), None),
|
||||||
/// Allows using the `efiapi` ABI.
|
|
||||||
(active, abi_efiapi, "1.40.0", Some(65815), None),
|
|
||||||
/// Allows `extern "msp430-interrupt" fn()`.
|
/// Allows `extern "msp430-interrupt" fn()`.
|
||||||
(active, abi_msp430_interrupt, "1.16.0", Some(38487), None),
|
(active, abi_msp430_interrupt, "1.16.0", Some(38487), None),
|
||||||
/// Allows `extern "ptx-*" fn()`.
|
/// Allows `extern "ptx-*" fn()`.
|
||||||
|
@ -4,6 +4,7 @@ use hir::{
|
|||||||
GenericParamKind, HirId, Node,
|
GenericParamKind, HirId, Node,
|
||||||
};
|
};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::DefId;
|
use rustc_hir::def_id::DefId;
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
@ -142,7 +143,20 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
|
|||||||
Some(tcx.typeck_root_def_id(def_id))
|
Some(tcx.typeck_root_def_id(def_id))
|
||||||
}
|
}
|
||||||
Node::Item(item) => match item.kind {
|
Node::Item(item) => match item.kind {
|
||||||
ItemKind::OpaqueTy(hir::OpaqueTy { .. }) => {
|
ItemKind::OpaqueTy(hir::OpaqueTy {
|
||||||
|
origin:
|
||||||
|
hir::OpaqueTyOrigin::FnReturn(fn_def_id) | hir::OpaqueTyOrigin::AsyncFn(fn_def_id),
|
||||||
|
in_trait,
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
if in_trait {
|
||||||
|
assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn))
|
||||||
|
} else {
|
||||||
|
assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn | DefKind::Fn))
|
||||||
|
}
|
||||||
|
Some(fn_def_id.to_def_id())
|
||||||
|
}
|
||||||
|
ItemKind::OpaqueTy(hir::OpaqueTy { origin: hir::OpaqueTyOrigin::TyAlias, .. }) => {
|
||||||
let parent_id = tcx.hir().get_parent_item(hir_id);
|
let parent_id = tcx.hir().get_parent_item(hir_id);
|
||||||
assert_ne!(parent_id, hir::CRATE_OWNER_ID);
|
assert_ne!(parent_id, hir::CRATE_OWNER_ID);
|
||||||
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
|
debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent_id);
|
||||||
|
@ -878,39 +878,39 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||||||
) -> FfiResult<'tcx> {
|
) -> FfiResult<'tcx> {
|
||||||
use FfiResult::*;
|
use FfiResult::*;
|
||||||
|
|
||||||
if def.repr().transparent() {
|
let transparent_safety = def.repr().transparent().then(|| {
|
||||||
// Can assume that at most one field is not a ZST, so only check
|
// Can assume that at most one field is not a ZST, so only check
|
||||||
// that field's type for FFI-safety.
|
// that field's type for FFI-safety.
|
||||||
if let Some(field) = transparent_newtype_field(self.cx.tcx, variant) {
|
if let Some(field) = transparent_newtype_field(self.cx.tcx, variant) {
|
||||||
self.check_field_type_for_ffi(cache, field, substs)
|
return self.check_field_type_for_ffi(cache, field, substs);
|
||||||
} else {
|
} else {
|
||||||
// All fields are ZSTs; this means that the type should behave
|
// All fields are ZSTs; this means that the type should behave
|
||||||
// like (), which is FFI-unsafe
|
// like (), which is FFI-unsafe... except if all fields are PhantomData,
|
||||||
|
// which is tested for below
|
||||||
FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None }
|
FfiUnsafe { ty, reason: fluent::lint_improper_ctypes_struct_zst, help: None }
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
// We can't completely trust repr(C) markings; make sure the fields are
|
// We can't completely trust repr(C) markings; make sure the fields are
|
||||||
// actually safe.
|
// actually safe.
|
||||||
let mut all_phantom = !variant.fields.is_empty();
|
let mut all_phantom = !variant.fields.is_empty();
|
||||||
for field in &variant.fields {
|
for field in &variant.fields {
|
||||||
match self.check_field_type_for_ffi(cache, &field, substs) {
|
match self.check_field_type_for_ffi(cache, &field, substs) {
|
||||||
FfiSafe => {
|
FfiSafe => {
|
||||||
all_phantom = false;
|
all_phantom = false;
|
||||||
}
|
|
||||||
FfiPhantom(..) if def.is_enum() => {
|
|
||||||
return FfiUnsafe {
|
|
||||||
ty,
|
|
||||||
reason: fluent::lint_improper_ctypes_enum_phantomdata,
|
|
||||||
help: None,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
FfiPhantom(..) => {}
|
|
||||||
r => return r,
|
|
||||||
}
|
}
|
||||||
|
FfiPhantom(..) if !def.repr().transparent() && def.is_enum() => {
|
||||||
|
return FfiUnsafe {
|
||||||
|
ty,
|
||||||
|
reason: fluent::lint_improper_ctypes_enum_phantomdata,
|
||||||
|
help: None,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
FfiPhantom(..) => {}
|
||||||
|
r => return transparent_safety.unwrap_or(r),
|
||||||
}
|
}
|
||||||
|
|
||||||
if all_phantom { FfiPhantom(ty) } else { FfiSafe }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if all_phantom { FfiPhantom(ty) } else { transparent_safety.unwrap_or(FfiSafe) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks if the given type is "ffi-safe" (has a stable, well-defined
|
/// Checks if the given type is "ffi-safe" (has a stable, well-defined
|
||||||
|
@ -149,7 +149,7 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
|||||||
match name {
|
match name {
|
||||||
// Stable
|
// Stable
|
||||||
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
|
"Rust" | "C" | "cdecl" | "stdcall" | "fastcall" | "aapcs" | "win64" | "sysv64"
|
||||||
| "system" => Ok(()),
|
| "system" | "efiapi" => Ok(()),
|
||||||
"rust-intrinsic" => Err(AbiDisabled::Unstable {
|
"rust-intrinsic" => Err(AbiDisabled::Unstable {
|
||||||
feature: sym::intrinsics,
|
feature: sym::intrinsics,
|
||||||
explain: "intrinsics are subject to change",
|
explain: "intrinsics are subject to change",
|
||||||
@ -198,10 +198,6 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
|
|||||||
feature: sym::abi_avr_interrupt,
|
feature: sym::abi_avr_interrupt,
|
||||||
explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
|
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 {
|
"C-cmse-nonsecure-call" => Err(AbiDisabled::Unstable {
|
||||||
feature: sym::abi_c_cmse_nonsecure_call,
|
feature: sym::abi_c_cmse_nonsecure_call,
|
||||||
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
explain: "C-cmse-nonsecure-call ABI is experimental and subject to change",
|
||||||
|
@ -58,6 +58,11 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
|
|||||||
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||||
syntax `start..end` or the inclusive range syntax `start..=end`"
|
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||||
),
|
),
|
||||||
|
on(
|
||||||
|
_Self = "{float}",
|
||||||
|
note = "if you want to iterate between `start` until a value `end`, use the exclusive range \
|
||||||
|
syntax `start..end` or the inclusive range syntax `start..=end`"
|
||||||
|
),
|
||||||
label = "`{Self}` is not an iterator",
|
label = "`{Self}` is not an iterator",
|
||||||
message = "`{Self}` is not an iterator"
|
message = "`{Self}` is not an iterator"
|
||||||
)]
|
)]
|
||||||
|
@ -84,7 +84,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
|
|||||||
let cs_start = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
let cs_start = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
||||||
let cs_len = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
let cs_len = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
||||||
let cs_lpad = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
let cs_lpad = read_encoded_pointer(&mut reader, context, call_site_encoding)?;
|
||||||
let cs_action = reader.read_uleb128();
|
let cs_action_entry = reader.read_uleb128();
|
||||||
// Callsite table is sorted by cs_start, so if we've passed the ip, we
|
// Callsite table is sorted by cs_start, so if we've passed the ip, we
|
||||||
// may stop searching.
|
// may stop searching.
|
||||||
if ip < func_start + cs_start {
|
if ip < func_start + cs_start {
|
||||||
@ -95,7 +95,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
|
|||||||
return Ok(EHAction::None);
|
return Ok(EHAction::None);
|
||||||
} else {
|
} else {
|
||||||
let lpad = lpad_base + cs_lpad;
|
let lpad = lpad_base + cs_lpad;
|
||||||
return Ok(interpret_cs_action(cs_action, lpad));
|
return Ok(interpret_cs_action(action_table as *mut u8, cs_action_entry, lpad));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,26 +113,39 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
|
|||||||
let mut idx = ip;
|
let mut idx = ip;
|
||||||
loop {
|
loop {
|
||||||
let cs_lpad = reader.read_uleb128();
|
let cs_lpad = reader.read_uleb128();
|
||||||
let cs_action = reader.read_uleb128();
|
let cs_action_entry = reader.read_uleb128();
|
||||||
idx -= 1;
|
idx -= 1;
|
||||||
if idx == 0 {
|
if idx == 0 {
|
||||||
// Can never have null landing pad for sjlj -- that would have
|
// Can never have null landing pad for sjlj -- that would have
|
||||||
// been indicated by a -1 call site index.
|
// been indicated by a -1 call site index.
|
||||||
let lpad = (cs_lpad + 1) as usize;
|
let lpad = (cs_lpad + 1) as usize;
|
||||||
return Ok(interpret_cs_action(cs_action, lpad));
|
return Ok(interpret_cs_action(action_table as *mut u8, cs_action_entry, lpad));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn interpret_cs_action(cs_action: u64, lpad: usize) -> EHAction {
|
unsafe fn interpret_cs_action(
|
||||||
if cs_action == 0 {
|
action_table: *mut u8,
|
||||||
// If cs_action is 0 then this is a cleanup (Drop::drop). We run these
|
cs_action_entry: u64,
|
||||||
|
lpad: usize,
|
||||||
|
) -> EHAction {
|
||||||
|
if cs_action_entry == 0 {
|
||||||
|
// If cs_action_entry is 0 then this is a cleanup (Drop::drop). We run these
|
||||||
// for both Rust panics and foreign exceptions.
|
// for both Rust panics and foreign exceptions.
|
||||||
EHAction::Cleanup(lpad)
|
EHAction::Cleanup(lpad)
|
||||||
} else {
|
} else {
|
||||||
// Stop unwinding Rust panics at catch_unwind.
|
// If lpad != 0 and cs_action_entry != 0, we have to check ttype_index.
|
||||||
EHAction::Catch(lpad)
|
// If ttype_index == 0 under the condition, we take cleanup action.
|
||||||
|
let action_record = (action_table as *mut u8).offset(cs_action_entry as isize - 1);
|
||||||
|
let mut action_reader = DwarfReader::new(action_record);
|
||||||
|
let ttype_index = action_reader.read_sleb128();
|
||||||
|
if ttype_index == 0 {
|
||||||
|
EHAction::Cleanup(lpad)
|
||||||
|
} else {
|
||||||
|
// Stop unwinding Rust panics at catch_unwind.
|
||||||
|
EHAction::Catch(lpad)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
# `abi_efiapi`
|
|
||||||
|
|
||||||
The tracking issue for this feature is: [#65815]
|
|
||||||
|
|
||||||
[#65815]: https://github.com/rust-lang/rust/issues/65815
|
|
||||||
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
The `efiapi` calling convention can be used for defining a function with
|
|
||||||
an ABI compatible with the UEFI Interfaces as defined in the [UEFI
|
|
||||||
Specification].
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```rust,ignore (not-all-targets-support-uefi)
|
|
||||||
#![feature(abi_efiapi)]
|
|
||||||
|
|
||||||
extern "efiapi" { fn f1(); }
|
|
||||||
|
|
||||||
extern "efiapi" fn f2() { todo!() }
|
|
||||||
```
|
|
||||||
|
|
||||||
[UEFI Specification]: https://uefi.org/specs/UEFI/2.10/
|
|
@ -12,5 +12,6 @@ pub(crate) const STRIP_PRIV_IMPORTS: Pass = Pass {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn strip_priv_imports(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
|
pub(crate) fn strip_priv_imports(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate {
|
||||||
ImportStripper { tcx: cx.tcx }.fold_crate(krate)
|
let is_json_output = cx.output_format.is_json() && !cx.show_coverage;
|
||||||
|
ImportStripper { tcx: cx.tcx, is_json_output }.fold_crate(krate)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ pub(crate) fn strip_private(mut krate: clean::Crate, cx: &mut DocContext<'_>) ->
|
|||||||
is_json_output,
|
is_json_output,
|
||||||
tcx: cx.tcx,
|
tcx: cx.tcx,
|
||||||
};
|
};
|
||||||
krate = ImportStripper { tcx: cx.tcx }.fold_crate(stripper.fold_crate(krate));
|
krate =
|
||||||
|
ImportStripper { tcx: cx.tcx, is_json_output }.fold_crate(stripper.fold_crate(krate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip all impls referencing private items
|
// strip all impls referencing private items
|
||||||
|
@ -243,12 +243,25 @@ impl<'a> DocFolder for ImplStripper<'a, '_> {
|
|||||||
/// This stripper discards all private import statements (`use`, `extern crate`)
|
/// This stripper discards all private import statements (`use`, `extern crate`)
|
||||||
pub(crate) struct ImportStripper<'tcx> {
|
pub(crate) struct ImportStripper<'tcx> {
|
||||||
pub(crate) tcx: TyCtxt<'tcx>,
|
pub(crate) tcx: TyCtxt<'tcx>,
|
||||||
|
pub(crate) is_json_output: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'tcx> ImportStripper<'tcx> {
|
||||||
|
fn import_should_be_hidden(&self, i: &Item, imp: &clean::Import) -> bool {
|
||||||
|
if self.is_json_output {
|
||||||
|
// FIXME: This should be handled the same way as for HTML output.
|
||||||
|
imp.imported_item_is_doc_hidden(self.tcx)
|
||||||
|
} else {
|
||||||
|
i.attrs.lists(sym::doc).has_word(sym::hidden)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> DocFolder for ImportStripper<'tcx> {
|
impl<'tcx> DocFolder for ImportStripper<'tcx> {
|
||||||
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
fn fold_item(&mut self, i: Item) -> Option<Item> {
|
||||||
match *i.kind {
|
match *i.kind {
|
||||||
clean::ImportItem(imp) if imp.imported_item_is_doc_hidden(self.tcx) => None,
|
clean::ImportItem(imp) if self.import_should_be_hidden(&i, &imp) => None,
|
||||||
|
clean::ImportItem(_) if i.attrs.lists(sym::doc).has_word(sym::hidden) => None,
|
||||||
clean::ExternCrateItem { .. } | clean::ImportItem(..)
|
clean::ExternCrateItem { .. } | clean::ImportItem(..)
|
||||||
if i.visibility(self.tcx) != Some(Visibility::Public) =>
|
if i.visibility(self.tcx) != Some(Visibility::Public) =>
|
||||||
{
|
{
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// compile-flags: -C no-prepopulate-passes
|
// compile-flags: -C no-prepopulate-passes
|
||||||
|
|
||||||
#![crate_type = "lib"]
|
#![crate_type = "lib"]
|
||||||
#![feature(no_core, lang_items, abi_efiapi)]
|
#![feature(no_core, lang_items)]
|
||||||
#![no_core]
|
#![no_core]
|
||||||
|
|
||||||
#[lang="sized"]
|
#[lang="sized"]
|
||||||
|
26
tests/rustdoc/reexport-doc-hidden.rs
Normal file
26
tests/rustdoc/reexport-doc-hidden.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Part of <https://github.com/rust-lang/rust/issues/59368>.
|
||||||
|
// This test ensures that reexporting a `doc(hidden)` item will
|
||||||
|
// still show the reexport.
|
||||||
|
|
||||||
|
#![crate_name = "foo"]
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub type Type = u32;
|
||||||
|
|
||||||
|
// @has 'foo/index.html'
|
||||||
|
// @has - '//*[@id="reexport.Type2"]/code' 'pub use crate::Type as Type2;'
|
||||||
|
pub use crate::Type as Type2;
|
||||||
|
|
||||||
|
// @count - '//*[@id="reexport.Type3"]' 0
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub use crate::Type as Type3;
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
#[doc(hidden)]
|
||||||
|
macro_rules! foo {
|
||||||
|
() => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a bug: https://github.com/rust-lang/rust/issues/59368
|
||||||
|
// @!has - '//*[@id="reexport.Macro"]/code' 'pub use crate::foo as Macro;'
|
||||||
|
pub use crate::foo as Macro;
|
@ -1,5 +1,7 @@
|
|||||||
// check-pass
|
|
||||||
// edition: 2021
|
// edition: 2021
|
||||||
|
// known-bug: #105197
|
||||||
|
// failure-status:101
|
||||||
|
// dont-check-compiler-stderr
|
||||||
|
|
||||||
#![feature(async_fn_in_trait)]
|
#![feature(async_fn_in_trait)]
|
||||||
#![feature(return_position_impl_trait_in_trait)]
|
#![feature(return_position_impl_trait_in_trait)]
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![feature(abi_efiapi)]
|
|
||||||
|
|
||||||
fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
||||||
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
//~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
||||||
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
//~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:1:14
|
||||||
|
|
|
|
||||||
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -8,13 +8,13 @@ LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
|||||||
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:1:14
|
||||||
|
|
|
|
||||||
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
||||||
|
|
||||||
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:6:12
|
||||||
|
|
|
|
||||||
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -23,13 +23,13 @@ LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
|||||||
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:6:12
|
||||||
|
|
|
|
||||||
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
LL | fn sysv(f: extern "sysv64" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
||||||
|
|
||||||
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11
|
||||||
|
|
|
|
||||||
LL | fn win(f: extern "win64" fn(usize, ...)) {
|
LL | fn win(f: extern "win64" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -38,7 +38,7 @@ LL | fn win(f: extern "win64" fn(usize, ...)) {
|
|||||||
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
= help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl`
|
||||||
--> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11
|
--> $DIR/feature-gate-extended_varargs_abi_support.rs:11:11
|
||||||
|
|
|
|
||||||
LL | fn win(f: extern "win64" fn(usize, ...)) {
|
LL | fn win(f: extern "win64" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
// ignore-arm stdcall isn't supported
|
// ignore-arm stdcall isn't supported
|
||||||
#![feature(extended_varargs_abi_support)]
|
#![feature(extended_varargs_abi_support)]
|
||||||
#![feature(abi_efiapi)]
|
|
||||||
|
|
||||||
fn baz(f: extern "stdcall" fn(usize, ...)) {
|
fn baz(f: extern "stdcall" fn(usize, ...)) {
|
||||||
//~^ ERROR: C-variadic function must have a compatible calling convention,
|
//~^ ERROR: C-variadic function must have a compatible calling convention,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi`
|
error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi`
|
||||||
--> $DIR/variadic-ffi-2.rs:5:11
|
--> $DIR/variadic-ffi-2.rs:4:11
|
||||||
|
|
|
|
||||||
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
|
LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
// needs-llvm-components: x86
|
|
||||||
// compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib
|
|
||||||
#![no_core]
|
|
||||||
#![feature(no_core, lang_items)]
|
|
||||||
#[lang="sized"]
|
|
||||||
trait Sized { }
|
|
||||||
|
|
||||||
// Functions
|
|
||||||
extern "efiapi" fn f1() {} //~ ERROR efiapi ABI is experimental
|
|
||||||
|
|
||||||
// Methods in trait defintion
|
|
||||||
trait Tr {
|
|
||||||
extern "efiapi" fn f2(); //~ ERROR efiapi ABI is experimental
|
|
||||||
extern "efiapi" fn f3() {} //~ ERROR efiapi ABI is experimental
|
|
||||||
}
|
|
||||||
|
|
||||||
struct S;
|
|
||||||
|
|
||||||
// Methods in trait impl
|
|
||||||
impl Tr for S {
|
|
||||||
extern "efiapi" fn f2() {} //~ ERROR efiapi ABI is experimental
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods in inherent impl
|
|
||||||
impl S {
|
|
||||||
extern "efiapi" fn f4() {} //~ ERROR efiapi ABI is experimental
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function pointer types
|
|
||||||
type A = extern "efiapi" fn(); //~ ERROR efiapi ABI is experimental
|
|
||||||
|
|
||||||
// Foreign modules
|
|
||||||
extern "efiapi" {} //~ ERROR efiapi ABI is experimental
|
|
@ -1,66 +0,0 @@
|
|||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:9:8
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" fn f1() {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:13:12
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" fn f2();
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:14:12
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" fn f3() {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:21:12
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" fn f2() {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:26:12
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" fn f4() {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:30:17
|
|
||||||
|
|
|
||||||
LL | type A = extern "efiapi" fn();
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0658]: efiapi ABI is experimental and subject to change
|
|
||||||
--> $DIR/feature-gate-abi-efiapi.rs:33:8
|
|
||||||
|
|
|
||||||
LL | extern "efiapi" {}
|
|
||||||
| ^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #65815 <https://github.com/rust-lang/rust/issues/65815> for more information
|
|
||||||
= help: add `#![feature(abi_efiapi)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0658`.
|
|
15
tests/ui/iterators/float_iterator_hint.rs
Normal file
15
tests/ui/iterators/float_iterator_hint.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// #106728
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
for i in 0.2 {
|
||||||
|
//~^ ERROR `{float}` is not an iterator
|
||||||
|
//~| `{float}` is not an iterator
|
||||||
|
//~| NOTE in this expansion of desugaring of `for` loop
|
||||||
|
//~| NOTE in this expansion of desugaring of `for` loop
|
||||||
|
//~| NOTE in this expansion of desugaring of `for` loop
|
||||||
|
//~| NOTE in this expansion of desugaring of `for` loop
|
||||||
|
//~| NOTE if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
|
//~| NOTE required for `{float}` to implement `IntoIterator`
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
}
|
13
tests/ui/iterators/float_iterator_hint.stderr
Normal file
13
tests/ui/iterators/float_iterator_hint.stderr
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
error[E0277]: `{float}` is not an iterator
|
||||||
|
--> $DIR/float_iterator_hint.rs:4:14
|
||||||
|
|
|
||||||
|
LL | for i in 0.2 {
|
||||||
|
| ^^^ `{float}` is not an iterator
|
||||||
|
|
|
||||||
|
= help: the trait `Iterator` is not implemented for `{float}`
|
||||||
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
|
= note: required for `{float}` to implement `IntoIterator`
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0277`.
|
@ -115,6 +115,7 @@ LL | for _ in 42.0 {}
|
|||||||
| ^^^^ `{float}` is not an iterator
|
| ^^^^ `{float}` is not an iterator
|
||||||
|
|
|
|
||||||
= help: the trait `Iterator` is not implemented for `{float}`
|
= help: the trait `Iterator` is not implemented for `{float}`
|
||||||
|
= note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end`
|
||||||
= note: required for `{float}` to implement `IntoIterator`
|
= note: required for `{float}` to implement `IntoIterator`
|
||||||
|
|
||||||
error: aborting due to 12 previous errors
|
error: aborting due to 12 previous errors
|
||||||
|
22
tests/ui/lint/lint-ffi-safety-all-phantom.rs
Normal file
22
tests/ui/lint/lint-ffi-safety-all-phantom.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// This is a regression test for issue https://github.com/rust-lang/rust/issues/106629.
|
||||||
|
// It ensures that transparent types where all fields are PhantomData are marked as
|
||||||
|
// FFI-safe.
|
||||||
|
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
#[repr(transparent)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
struct MyPhantom(core::marker::PhantomData<u8>);
|
||||||
|
|
||||||
|
#[repr(C)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct Bar {
|
||||||
|
pub x: i32,
|
||||||
|
_marker: MyPhantom,
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
pub fn foo(bar: *mut Bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -471,6 +471,7 @@ compiler-team = [
|
|||||||
"@lcnr",
|
"@lcnr",
|
||||||
"@nagisa",
|
"@nagisa",
|
||||||
"@wesleywiser",
|
"@wesleywiser",
|
||||||
|
"@michaelwoerister",
|
||||||
]
|
]
|
||||||
compiler-team-contributors = [
|
compiler-team-contributors = [
|
||||||
"@compiler-errors",
|
"@compiler-errors",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user