Auto merge of #99998 - matthiaskrgr:rollup-igafy0r, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #99519 (Remove implicit names and values from `--cfg` in `--check-cfg`)
 - #99620 (`-Z location-detail`: provide option to disable all location details)
 - #99932 (Fix unwinding on certain platforms when debug assertions are enabled)
 - #99973 (Layout things)
 - #99980 (Remove more Clean trait implementations)
 - #99984 (Fix compat.rs for `cfg(miri)`)
 - #99986 (Add wrap suggestions for record variants)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-08-01 01:11:08 +00:00
commit 6423ab3a75
28 changed files with 1241 additions and 1209 deletions

View File

@ -117,7 +117,6 @@ pub fn create_session(
let mut check_cfg = config::to_crate_check_config(check_cfg);
check_cfg.fill_well_known();
check_cfg.fill_actual(&cfg);
sess.parse_sess.config = cfg;
sess.parse_sess.check_config = check_cfg;

View File

@ -232,6 +232,10 @@ fn sanity_check_layout<'tcx>(
assert!(layout.abi.is_uninhabited());
}
if layout.size.bytes() % layout.align.abi.bytes() != 0 {
bug!("size is not a multiple of align, in the following layout:\n{layout:#?}");
}
if cfg!(debug_assertions) {
fn check_layout_abi<'tcx>(tcx: TyCtxt<'tcx>, layout: Layout<'tcx>) {
match layout.abi() {

View File

@ -1159,20 +1159,6 @@ impl CrateCheckConfig {
self.fill_well_known_names();
self.fill_well_known_values();
}
/// Fills a `CrateCheckConfig` with configuration names and values that are actually active.
pub fn fill_actual(&mut self, cfg: &CrateConfig) {
for &(k, v) in cfg {
if let Some(names_valid) = &mut self.names_valid {
names_valid.insert(k);
}
if let Some(v) = v {
self.values_valid.entry(k).and_modify(|values| {
values.insert(v);
});
}
}
}
}
pub fn build_configuration(sess: &Session, mut user_cfg: CrateConfig) -> CrateConfig {

View File

@ -393,8 +393,7 @@ mod desc {
"either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted";
pub const parse_linker_plugin_lto: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), or the path to the linker plugin";
pub const parse_location_detail: &str =
"comma separated list of location details to track: `file`, `line`, or `column`";
pub const parse_location_detail: &str = "either `none`, or a comma separated list of location details to track: `file`, `line`, or `column`";
pub const parse_switch_with_opt_path: &str =
"an optional path to the profiling data output directory";
pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`";
@ -551,6 +550,9 @@ mod parse {
ld.line = false;
ld.file = false;
ld.column = false;
if v == "none" {
return true;
}
for s in v.split(',') {
match s {
"file" => ld.file = true,
@ -1374,8 +1376,9 @@ options! {
llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],
"generate JSON tracing data file from LLVM data (default: no)"),
location_detail: LocationDetail = (LocationDetail::all(), parse_location_detail, [TRACKED],
"comma separated list of location details to be tracked when using caller_location \
valid options are `file`, `line`, and `column` (default: all)"),
"what location details should be tracked when using caller_location, either \
`none`, or a comma separated list of location details, for which \
valid options are `file`, `line`, and `column` (default: `file,line,column`)"),
ls: bool = (false, parse_bool, [UNTRACKED],
"list the symbols defined by a library crate (default: no)"),
macro_backtrace: bool = (false, parse_bool, [UNTRACKED],

View File

@ -1279,13 +1279,14 @@ impl<'a> fmt::Debug for LayoutS<'a> {
// This is how `Layout` used to print before it become
// `Interned<LayoutS>`. We print it like this to avoid having to update
// expected output in a lot of tests.
let LayoutS { size, align, abi, fields, largest_niche, variants } = self;
f.debug_struct("Layout")
.field("fields", &self.fields)
.field("variants", &self.variants)
.field("abi", &self.abi)
.field("largest_niche", &self.largest_niche)
.field("align", &self.align)
.field("size", &self.size)
.field("size", size)
.field("align", align)
.field("abi", abi)
.field("fields", fields)
.field("largest_niche", largest_niche)
.field("variants", variants)
.finish()
}
}

View File

@ -1,5 +1,6 @@
use crate::check::FnCtxt;
use rustc_infer::infer::InferOk;
use rustc_middle::middle::stability::EvalResult;
use rustc_trait_selection::infer::InferCtxtExt as _;
use rustc_trait_selection::traits::ObligationCause;
@ -363,18 +364,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
let compatible_variants: Vec<(String, Option<String>)> = expected_adt
let compatible_variants: Vec<(String, _, _, Option<String>)> = expected_adt
.variants()
.iter()
.filter(|variant| {
variant.fields.len() == 1 && variant.ctor_kind == hir::def::CtorKind::Fn
variant.fields.len() == 1
})
.filter_map(|variant| {
let sole_field = &variant.fields[0];
let field_is_local = sole_field.did.is_local();
let field_is_accessible =
sole_field.vis.is_accessible_from(expr.hir_id.owner.to_def_id(), self.tcx);
sole_field.vis.is_accessible_from(expr.hir_id.owner.to_def_id(), self.tcx)
// Skip suggestions for unstable public fields (for example `Pin::pointer`)
&& matches!(self.tcx.eval_stability(sole_field.did, None, expr.span, None), EvalResult::Allow | EvalResult::Unmarked);
if !field_is_local && !field_is_accessible {
return None;
@ -391,33 +394,45 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let Some(path) = variant_path.strip_prefix("std::prelude::")
&& let Some((_, path)) = path.split_once("::")
{
return Some((path.to_string(), note_about_variant_field_privacy));
return Some((path.to_string(), variant.ctor_kind, sole_field.name, note_about_variant_field_privacy));
}
Some((variant_path, note_about_variant_field_privacy))
Some((variant_path, variant.ctor_kind, sole_field.name, note_about_variant_field_privacy))
} else {
None
}
})
.collect();
let prefix = match self.maybe_get_struct_pattern_shorthand_field(expr) {
Some(ident) => format!("{ident}: "),
None => String::new(),
let suggestions_for = |variant: &_, ctor, field_name| {
let prefix = match self.maybe_get_struct_pattern_shorthand_field(expr) {
Some(ident) => format!("{ident}: "),
None => String::new(),
};
let (open, close) = match ctor {
hir::def::CtorKind::Fn => ("(".to_owned(), ")"),
hir::def::CtorKind::Fictive => (format!(" {{ {field_name}: "), " }"),
// unit variants don't have fields
hir::def::CtorKind::Const => unreachable!(),
};
vec![
(expr.span.shrink_to_lo(), format!("{prefix}{variant}{open}")),
(expr.span.shrink_to_hi(), close.to_owned()),
]
};
match &compatible_variants[..] {
[] => { /* No variants to format */ }
[(variant, note)] => {
[(variant, ctor_kind, field_name, note)] => {
// Just a single matching variant.
err.multipart_suggestion_verbose(
&format!(
"try wrapping the expression in `{variant}`{note}",
note = note.as_deref().unwrap_or("")
),
vec![
(expr.span.shrink_to_lo(), format!("{prefix}{variant}(")),
(expr.span.shrink_to_hi(), ")".to_string()),
],
suggestions_for(&**variant, *ctor_kind, *field_name),
Applicability::MaybeIncorrect,
);
}
@ -428,12 +443,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
"try wrapping the expression in a variant of `{}`",
self.tcx.def_path_str(expected_adt.did())
),
compatible_variants.into_iter().map(|(variant, _)| {
vec![
(expr.span.shrink_to_lo(), format!("{prefix}{variant}(")),
(expr.span.shrink_to_hi(), ")".to_string()),
]
}),
compatible_variants.into_iter().map(
|(variant, ctor_kind, field_name, _)| {
suggestions_for(&variant, ctor_kind, field_name)
},
),
Applicability::MaybeIncorrect,
);
}

View File

@ -306,7 +306,9 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context) -> Result<EHAction,
let eh_context = EHContext {
// The return address points 1 byte past the call instruction,
// which could be in the next IP range in LSDA range table.
ip: if ip_before_instr != 0 { ip } else { ip - 1 },
//
// `ip = -1` has special meaning, so use wrapping sub to allow for that
ip: if ip_before_instr != 0 { ip } else { ip.wrapping_sub(1) },
func_start: uw::_Unwind_GetRegionStart(context),
get_text_start: &|| uw::_Unwind_GetTextRelBase(context),
get_data_start: &|| uw::_Unwind_GetDataRelBase(context),

View File

@ -180,8 +180,8 @@ macro_rules! compat_fn_with_fallback {
fn load_from_module(module: Option<Module>) -> F {
unsafe {
static symbol_name: &CStr = ansi_str!(sym $symbol);
if let Some(f) = module.and_then(|m| m.proc_address(symbol_name)) {
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
if let Some(f) = module.and_then(|m| m.proc_address(SYMBOL_NAME)) {
PTR.store(f.as_ptr(), Ordering::Relaxed);
mem::transmute(f)
} else {
@ -251,7 +251,7 @@ macro_rules! compat_fn_optional {
pub fn option() -> Option<F> {
let mut func = NonNull::new(PTR.load(Ordering::Relaxed));
if func.is_none() {
Module::new($module).map(preload);
unsafe { Module::new($module).map(preload) };
func = NonNull::new(PTR.load(Ordering::Relaxed));
}
unsafe {
@ -262,8 +262,8 @@ macro_rules! compat_fn_optional {
#[allow(unused)]
pub(in crate::sys) fn preload(module: Module) {
unsafe {
let symbol_name = ansi_str!(sym $symbol);
if let Some(f) = module.proc_address(symbol_name) {
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
if let Some(f) = module.proc_address(SYMBOL_NAME) {
PTR.store(f.as_ptr(), Ordering::Relaxed);
}
}

View File

@ -18,6 +18,9 @@ check cfg specification is parsed using the Rust metadata syntax, just as the `-
These two options are independent. `names` checks only the namespace of condition names
while `values` checks only the namespace of the values of list-valued conditions.
NOTE: No implicit expectation is added when using `--cfg` for both forms. Users are expected to
pass all expected names and values using `names(...)` and `values(...)`.
## The `names(...)` form
The `names(...)` form enables checking the names. This form uses a named list:
@ -53,27 +56,6 @@ The first form enables checking condition names, while specifying that there are
condition names (outside of the set of well-known names defined by `rustc`). Omitting the
`--check-cfg 'names(...)'` option does not enable checking condition names.
Conditions that are enabled are implicitly valid; it is unnecessary (but legal) to specify a
condition name as both enabled and valid. For example, the following invocations are equivalent:
```bash
# condition names will be checked, and 'has_time_travel' is valid
rustc --cfg 'has_time_travel' --check-cfg 'names()'
# condition names will be checked, and 'has_time_travel' is valid
rustc --cfg 'has_time_travel' --check-cfg 'names(has_time_travel)'
```
In contrast, the following two invocations are _not_ equivalent:
```bash
# condition names will not be checked (because there is no --check-cfg names(...))
rustc --cfg 'has_time_travel'
# condition names will be checked, and 'has_time_travel' is both valid and enabled.
rustc --cfg 'has_time_travel' --check-cfg 'names(has_time_travel)'
```
## The `values(...)` form
The `values(...)` form enables checking the values within list-valued conditions. It has this
@ -149,7 +131,7 @@ fn tame_lion() {}
```bash
# This turns on checking for condition names, but not values, such as 'feature' values.
rustc --check-cfg 'names(is_embedded, has_feathers)' \
--cfg has_feathers --cfg 'feature = "zapping"' -Z unstable-options
--cfg has_feathers -Z unstable-options
```
```rust
@ -159,13 +141,14 @@ fn do_embedded() {}
#[cfg(has_feathers)] // This is expected as "has_feathers" was provided in names()
fn do_features() {}
#[cfg(has_feathers = "zapping")] // This is expected as "has_feathers" was provided in names()
// and because no value checking was enable for "has_feathers"
// no warning is emited for the value "zapping"
fn do_zapping() {}
#[cfg(has_mumble_frotz)] // This is UNEXPECTED because names checking is enable and
// "has_mumble_frotz" was not provided in names()
fn do_mumble_frotz() {}
#[cfg(feature = "lasers")] // This doesn't raise a warning, because values checking for "feature"
// was never used
fn shoot_lasers() {}
```
### Example: Checking feature values, but not condition names

View File

@ -17,8 +17,9 @@ within this list are:
- `line` - the source line of the panic will be included in the panic output
- `column` - the source column of the panic will be included in the panic output
Any combination of these three options are supported. If this option is not specified,
all three are included by default.
Any combination of these three options are supported. Alternatively, you can pass
`none` to this option, which results in no location details being tracked.
If this option is not specified, all three are included by default.
An example of a panic output when using `-Z location-detail=line`:
```text

View File

@ -1019,7 +1019,7 @@ impl<'tcx> Clean<'tcx, bool> for hir::IsAuto {
impl<'tcx> Clean<'tcx, Path> for hir::TraitRef<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
let path = self.path.clean(cx);
let path = clean_path(self.path, cx);
register_res(cx, path.res);
path
}
@ -1344,7 +1344,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
if let Some(expanded) = maybe_expand_private_type_alias(cx, path) {
expanded
} else {
let path = path.clean(cx);
let path = clean_path(path, cx);
resolve_type(cx, path)
}
}
@ -1380,7 +1380,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
ty::Error(_) => return Type::Infer,
_ => bug!("clean: expected associated type, found `{:?}`", ty),
};
let trait_ = hir::Path { span, res, segments: &[] }.clean(cx);
let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx);
register_res(cx, trait_.res);
let self_def_id = res.opt_def_id();
let self_type = clean_ty(qself, cx);
@ -1857,10 +1857,8 @@ fn clean_variant_data<'tcx>(
}
}
impl<'tcx> Clean<'tcx, Path> for hir::Path<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> Path {
Path { res: self.res, segments: self.segments.iter().map(|x| x.clean(cx)).collect() }
}
fn clean_path<'tcx>(path: &hir::Path<'tcx>, cx: &mut DocContext<'tcx>) -> Path {
Path { res: path.res, segments: path.segments.iter().map(|x| x.clean(cx)).collect() }
}
impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
@ -1886,7 +1884,8 @@ impl<'tcx> Clean<'tcx, GenericArgs> for hir::GenericArgs<'tcx> {
})
.collect::<Vec<_>>()
.into();
let bindings = self.bindings.iter().map(|x| x.clean(cx)).collect::<Vec<_>>().into();
let bindings =
self.bindings.iter().map(|x| clean_type_binding(x, cx)).collect::<Vec<_>>().into();
GenericArgs::AngleBracketed { args, bindings }
}
}
@ -2172,7 +2171,7 @@ fn clean_use_statement<'tcx>(
// Also check whether imports were asked to be inlined, in case we're trying to re-export a
// crate in Rust 2018+
let path = path.clean(cx);
let path = clean_path(path, cx);
let inner = if kind == hir::UseKind::Glob {
if !denied {
let mut visited = FxHashSet::default();
@ -2252,24 +2251,19 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
})
}
impl<'tcx> Clean<'tcx, TypeBinding> for hir::TypeBinding<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> TypeBinding {
TypeBinding {
assoc: PathSegment { name: self.ident.name, args: self.gen_args.clean(cx) },
kind: self.kind.clean(cx),
}
}
}
impl<'tcx> Clean<'tcx, TypeBindingKind> for hir::TypeBindingKind<'tcx> {
fn clean(&self, cx: &mut DocContext<'tcx>) -> TypeBindingKind {
match *self {
fn clean_type_binding<'tcx>(
type_binding: &hir::TypeBinding<'tcx>,
cx: &mut DocContext<'tcx>,
) -> TypeBinding {
TypeBinding {
assoc: PathSegment { name: type_binding.ident.name, args: type_binding.gen_args.clean(cx) },
kind: match type_binding.kind {
hir::TypeBindingKind::Equality { ref term } => {
TypeBindingKind::Equality { term: clean_hir_term(term, cx) }
}
hir::TypeBindingKind::Constraint { bounds } => TypeBindingKind::Constraint {
bounds: bounds.iter().filter_map(|b| b.clean(cx)).collect(),
},
}
},
}
}

View File

@ -69,7 +69,7 @@
-Z link-only=val -- link the `.rlink` file generated by `-Z no-link` (default: no)
-Z llvm-plugins=val -- a list LLVM plugins to enable (space separated)
-Z llvm-time-trace=val -- generate JSON tracing data file from LLVM data (default: no)
-Z location-detail=val -- comma separated list of location details to be tracked when using caller_location valid options are `file`, `line`, and `column` (default: all)
-Z location-detail=val -- what location details should be tracked when using caller_location, either `none`, or a comma separated list of location details, for which valid options are `file`, `line`, and `column` (default: `file,line,column`)
-Z ls=val -- list the symbols defined by a library crate (default: no)
-Z macro-backtrace=val -- show macro backtraces (default: no)
-Z merge-functions=val -- control the operation of the MergeFunctions LLVM pass, taking the same values as the target option of the same name

View File

@ -12,6 +12,7 @@ pub fn f() {}
pub fn g() {}
#[cfg(feature = "rand")]
//~^ WARNING unexpected `cfg` condition value
pub fn h() {}
pub fn main() {}

View File

@ -5,7 +5,15 @@ LL | #[cfg(feature = "sedre")]
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unexpected_cfgs)]` on by default
= note: expected values for `feature` are: full, rand, serde
= note: expected values for `feature` are: full, serde
warning: 1 warning emitted
warning: unexpected `cfg` condition value
--> $DIR/invalid-cfg-value.rs:14:7
|
LL | #[cfg(feature = "rand")]
| ^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: full, serde
warning: 2 warnings emitted

View File

@ -1,6 +1,6 @@
// This test checks the combination of well known names, their activation via names(), the usage of
// partial values() with a --cfg and test that we also correctly lint on the `cfg!` macro and
// `cfg_attr` attribute.
// This test checks the combination of well known names, their activation via names(),
// the usage of values(), and that no implicit is done with --cfg while also testing that
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
//
// check-pass
// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" -Z unstable-options
@ -16,6 +16,7 @@ fn do_windows_stuff() {}
fn use_foo() {}
#[cfg(feature = "bar")]
//~^ WARNING unexpected `cfg` condition value
fn use_bar() {}
#[cfg(feature = "zebra")]
@ -35,6 +36,7 @@ fn test_cfg_macro() {
//~^ WARNING unexpected `cfg` condition name
cfg!(feature = "foo");
cfg!(feature = "bar");
//~^ WARNING unexpected `cfg` condition value
cfg!(feature = "zebra");
//~^ WARNING unexpected `cfg` condition value
cfg!(xxx = "foo");

View File

@ -7,21 +7,29 @@ LL | #[cfg(widnows)]
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:21:7
--> $DIR/mix.rs:18:7
|
LL | #[cfg(feature = "bar")]
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:22:7
|
LL | #[cfg(feature = "zebra")]
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:25:12
--> $DIR/mix.rs:26:12
|
LL | #[cfg_attr(uu, test)]
| ^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:34:10
--> $DIR/mix.rs:35:10
|
LL | cfg!(widnows);
| ^^^^^^^ help: did you mean: `windows`
@ -29,132 +37,138 @@ LL | cfg!(widnows);
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:38:10
|
LL | cfg!(feature = "bar");
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:40:10
|
LL | cfg!(feature = "zebra");
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:40:10
--> $DIR/mix.rs:42:10
|
LL | cfg!(xxx = "foo");
| ^^^^^^^^^^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:42:10
--> $DIR/mix.rs:44:10
|
LL | cfg!(xxx);
| ^^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:44:14
--> $DIR/mix.rs:46:14
|
LL | cfg!(any(xxx, windows));
| ^^^
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:46:14
--> $DIR/mix.rs:48:14
|
LL | cfg!(any(feature = "bad", windows));
| ^^^^^^^^^^-----
| |
| help: did you mean: `"bar"`
| ^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:48:23
--> $DIR/mix.rs:50:23
|
LL | cfg!(any(windows, xxx));
| ^^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:50:20
--> $DIR/mix.rs:52:20
|
LL | cfg!(all(unix, xxx));
| ^^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:52:14
--> $DIR/mix.rs:54:14
|
LL | cfg!(all(aa, bb));
| ^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:52:18
--> $DIR/mix.rs:54:18
|
LL | cfg!(all(aa, bb));
| ^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:55:14
--> $DIR/mix.rs:57:14
|
LL | cfg!(any(aa, bb));
| ^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:55:18
--> $DIR/mix.rs:57:18
|
LL | cfg!(any(aa, bb));
| ^^
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:58:20
--> $DIR/mix.rs:60:20
|
LL | cfg!(any(unix, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:60:14
--> $DIR/mix.rs:62:14
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:60:19
--> $DIR/mix.rs:62:19
|
LL | cfg!(any(xxx, feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:63:14
--> $DIR/mix.rs:65:14
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
warning: unexpected `cfg` condition name
--> $DIR/mix.rs:63:25
--> $DIR/mix.rs:65:25
|
LL | cfg!(any(xxx, unix, xxx));
| ^^^
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:66:14
--> $DIR/mix.rs:68:14
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:66:33
--> $DIR/mix.rs:68:33
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: unexpected `cfg` condition value
--> $DIR/mix.rs:66:52
--> $DIR/mix.rs:68:52
|
LL | cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
| ^^^^^^^^^^^^^^^^^
|
= note: expected values for `feature` are: bar, foo
= note: expected values for `feature` are: foo
warning: 23 warnings emitted
warning: 25 warnings emitted

View File

@ -66,7 +66,7 @@ fn main() {
}
enum A {
B { b: B},
B { b: B },
}
struct A2(B);
@ -77,13 +77,12 @@ enum B {
}
fn foo() {
// We don't want to suggest `A::B(B::Fst)` here.
let a: A = B::Fst;
//~^ ERROR mismatched types
//~| HELP try wrapping
}
fn bar() {
// But we _do_ want to suggest `A2(B::Fst)` here!
let a: A2 = B::Fst;
//~^ ERROR mismatched types
//~| HELP try wrapping

View File

@ -191,15 +191,20 @@ LL | let _ = Foo { bar: Some(bar) };
| ++++++++++ +
error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:81:16
--> $DIR/compatible-variants.rs:80:16
|
LL | let a: A = B::Fst;
| - ^^^^^^ expected enum `A`, found enum `B`
| |
| expected due to this
|
help: try wrapping the expression in `A::B`
|
LL | let a: A = A::B { b: B::Fst };
| +++++++++ +
error[E0308]: mismatched types
--> $DIR/compatible-variants.rs:87:17
--> $DIR/compatible-variants.rs:86:17
|
LL | let a: A2 = B::Fst;
| -- ^^^^^^ expected struct `A2`, found enum `B`

View File

@ -26,4 +26,5 @@ struct Context { wrapper: Wrapper }
fn overton() {
let _c = Context { wrapper: Payload{} };
//~^ ERROR mismatched types
//~| try wrapping the expression in `Wrapper`
}

View File

@ -25,6 +25,11 @@ error[E0308]: mismatched types
|
LL | let _c = Context { wrapper: Payload{} };
| ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload`
|
help: try wrapping the expression in `Wrapper`
|
LL | let _c = Context { wrapper: Wrapper { payload: Payload{} } };
| ++++++++++++++++++ +
error: aborting due to 2 previous errors

View File

@ -1,4 +1,12 @@
error: layout_of(E) = Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +15,16 @@ error: layout_of(E) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,24 +37,30 @@ error: layout_of(E) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(12 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Uninhabited,
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -49,37 +73,13 @@ error: layout_of(E) = Layout {
2,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Uninhabited,
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(12 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(12 bytes),
}
--> $DIR/debug.rs:6:1
|
@ -87,6 +87,27 @@ LL | enum E { Foo, Bar(!, i32, i32) }
| ^^^^^^
error: layout_of(S) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -99,31 +120,10 @@ error: layout_of(S) = Layout {
2,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/debug.rs:9:1
|
@ -131,21 +131,21 @@ LL | struct S { f1: i32, f2: (), f3: i32 }
| ^^^^^^^^
error: layout_of(U) = Layout {
fields: Union(
2,
),
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
abi: Aggregate {
sized: true,
},
fields: Union(
2,
),
largest_niche: None,
variants: Single {
index: 0,
},
}
--> $DIR/debug.rs:12:1
|
@ -153,6 +153,27 @@ LL | union U { f1: (i32, i32), f3: i32 }
| ^^^^^^^
error: layout_of(std::result::Result<i32, i32>) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -161,6 +182,16 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -173,6 +204,27 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -181,9 +233,17 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -200,14 +260,6 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -216,65 +268,13 @@ error: layout_of(std::result::Result<i32, i32>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I32,
true,
),
valid_range: 0..=4294967295,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/debug.rs:15:1
|
@ -282,9 +282,10 @@ LL | type Test = Result<i32, i32>;
| ^^^^^^^^^
error: layout_of(i32) = Layout {
fields: Primitive,
variants: Single {
index: 0,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Scalar(
Initialized {
@ -295,12 +296,11 @@ error: layout_of(i32) = Layout {
valid_range: 0..=4294967295,
},
),
fields: Primitive,
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 0,
},
size: Size(4 bytes),
}
--> $DIR/debug.rs:18:1
|

View File

@ -1,4 +1,18 @@
error: layout_of(A) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +21,16 @@ error: layout_of(A) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,49 +43,25 @@ error: layout_of(A) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
}
--> $DIR/hexagon-enum.rs:16:1
|
@ -69,6 +69,20 @@ LL | enum A { Apple }
| ^^^^^^
error: layout_of(B) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -77,6 +91,16 @@ error: layout_of(B) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -89,49 +113,25 @@ error: layout_of(B) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(1 bytes),
},
size: Size(1 bytes),
}
--> $DIR/hexagon-enum.rs:20:1
|
@ -139,6 +139,20 @@ LL | enum B { Banana = 255, }
| ^^^^^^
error: layout_of(C) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -147,6 +161,16 @@ error: layout_of(C) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -159,49 +183,25 @@ error: layout_of(C) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
size: Size(2 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(2 bytes),
},
size: Size(2 bytes),
}
--> $DIR/hexagon-enum.rs:24:1
|
@ -209,6 +209,20 @@ LL | enum C { Chaenomeles = 256, }
| ^^^^^^
error: layout_of(P) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -217,6 +231,16 @@ error: layout_of(P) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -229,49 +253,25 @@ error: layout_of(P) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/hexagon-enum.rs:28:1
|
@ -279,6 +279,20 @@ LL | enum P { Peach = 0x1000_0000isize, }
| ^^^^^^
error: layout_of(T) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -287,6 +301,16 @@ error: layout_of(T) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -299,49 +323,25 @@ error: layout_of(T) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/hexagon-enum.rs:34:1
|

View File

@ -1,76 +1,8 @@
error: layout_of(MissingPayloadField) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
],
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -87,6 +19,14 @@ error: layout_of(MissingPayloadField) = Layout {
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -97,26 +37,6 @@ error: layout_of(MissingPayloadField) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
|
LL | pub enum MissingPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadField) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -129,6 +49,26 @@ error: layout_of(CommonPayloadField) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -137,69 +77,43 @@ error: layout_of(CommonPayloadField) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
},
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
],
},
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1
|
LL | pub enum MissingPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadField) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -216,6 +130,14 @@ error: layout_of(CommonPayloadField) = Layout {
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -226,26 +148,6 @@ error: layout_of(CommonPayloadField) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
|
LL | pub enum CommonPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -258,6 +160,27 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -266,9 +189,17 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -277,21 +208,14 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
),
valid_range: 0..=1,
},
Union {
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -300,33 +224,25 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
],
},
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1
|
LL | pub enum CommonPayloadField {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
@ -342,6 +258,14 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -352,11 +276,87 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
],
memory_index: [
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
],
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1
|
@ -364,6 +364,26 @@ LL | pub enum CommonPayloadFieldIsMaybeUninit {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(NicheFirst) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
Union {
value: Int(
I8,
false,
),
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -372,6 +392,16 @@ error: layout_of(NicheFirst) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -388,18 +418,10 @@ error: layout_of(NicheFirst) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
variants: Single {
index: 0,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -417,6 +439,16 @@ error: layout_of(NicheFirst) = Layout {
valid_range: 0..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -427,80 +459,48 @@ error: layout_of(NicheFirst) = Layout {
valid_range: 0..=2,
},
),
variants: Single {
index: 0,
},
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
],
},
abi: ScalarPair(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
Union {
value: Int(
I8,
false,
),
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1
|
@ -508,6 +508,26 @@ LL | pub enum NicheFirst {
| ^^^^^^^^^^^^^^^^^^^
error: layout_of(NicheSecond) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Union {
value: Int(
I8,
false,
),
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -516,6 +536,16 @@ error: layout_of(NicheSecond) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -532,18 +562,10 @@ error: layout_of(NicheSecond) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
variants: Single {
index: 0,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: ScalarPair(
Initialized {
@ -561,6 +583,16 @@ error: layout_of(NicheSecond) = Layout {
valid_range: 0..=2,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
Size(1 bytes),
],
memory_index: [
0,
1,
],
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -571,80 +603,48 @@ error: layout_of(NicheSecond) = Layout {
valid_range: 0..=2,
},
),
variants: Single {
index: 0,
},
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
},
Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
],
},
abi: ScalarPair(
Union {
value: Int(
I8,
false,
),
},
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
largest_niche: Some(
Niche {
offset: Size(1 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=4,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
}
--> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1
|

View File

@ -1,4 +1,12 @@
error: layout_of(Aligned1) = Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,58 +15,6 @@ error: layout_of(Aligned1) = Layout {
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -69,26 +25,6 @@ error: layout_of(Aligned1) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
size: Size(8 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:8:1
|
LL | pub enum Aligned1 {
| ^^^^^^^^^^^^^^^^^
error: layout_of(Aligned2) = Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Multiple {
tag: Initialized {
value: Int(
@ -101,43 +37,55 @@ error: layout_of(Aligned2) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(8 bytes),
align: AbiAndPrefAlign {
abi: Align(8 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
size: Size(1 bytes),
},
],
},
}
--> $DIR/issue-96185-overaligned-enum.rs:8:1
|
LL | pub enum Aligned1 {
| ^^^^^^^^^^^^^^^^^
error: layout_of(Aligned2) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Scalar(
Initialized {
value: Int(
@ -147,6 +95,14 @@ error: layout_of(Aligned2) = Layout {
valid_range: 0..=1,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -157,11 +113,55 @@ error: layout_of(Aligned2) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Multiple {
tag: Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
tag_encoding: Direct,
tag_field: 0,
variants: [
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
],
},
size: Size(1 bytes),
}
--> $DIR/issue-96185-overaligned-enum.rs:16:1
|

View File

@ -1,4 +1,18 @@
error: layout_of(A) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +21,16 @@ error: layout_of(A) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,49 +43,25 @@ error: layout_of(A) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
}
--> $DIR/thumb-enum.rs:16:1
|
@ -69,6 +69,20 @@ LL | enum A { Apple }
| ^^^^^^
error: layout_of(B) = Layout {
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -77,6 +91,16 @@ error: layout_of(B) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -89,49 +113,25 @@ error: layout_of(B) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(1 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 255..=255,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(4 bytes),
},
size: Size(1 bytes),
}
--> $DIR/thumb-enum.rs:20:1
|
@ -139,6 +139,20 @@ LL | enum B { Banana = 255, }
| ^^^^^^
error: layout_of(C) = Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -147,6 +161,16 @@ error: layout_of(C) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -159,49 +183,25 @@ error: layout_of(C) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
size: Size(2 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 256..=256,
},
),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: Align(4 bytes),
},
size: Size(2 bytes),
}
--> $DIR/thumb-enum.rs:24:1
|
@ -209,6 +209,20 @@ LL | enum C { Chaenomeles = 256, }
| ^^^^^^
error: layout_of(P) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -217,6 +231,16 @@ error: layout_of(P) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -229,49 +253,25 @@ error: layout_of(P) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
false,
),
valid_range: 268435456..=268435456,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/thumb-enum.rs:28:1
|
@ -279,6 +279,20 @@ LL | enum P { Peach = 0x1000_0000isize, }
| ^^^^^^
error: layout_of(T) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -287,6 +301,16 @@ error: layout_of(T) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -299,49 +323,25 @@ error: layout_of(T) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [],
memory_index: [],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [],
memory_index: [],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
],
},
abi: Scalar(
Initialized {
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I32,
true,
),
valid_range: 2164260864..=2164260864,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
},
size: Size(4 bytes),
}
--> $DIR/thumb-enum.rs:34:1
|

View File

@ -1,4 +1,12 @@
error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -7,6 +15,16 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -19,6 +37,14 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -27,20 +53,20 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -49,12 +75,6 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -65,32 +85,12 @@ error: layout_of(std::result::Result<[u32; 0], bool>) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:13:1
|
@ -98,6 +98,14 @@ LL | type AlignedResult = Result<[u32; 0], bool>;
| ^^^^^^^^^^^^^^^^^^
error: layout_of(MultipleAlignments) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -106,6 +114,16 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=2,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -118,6 +136,14 @@ error: layout_of(MultipleAlignments) = Layout {
tag_field: 0,
variants: [
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(2 bytes),
@ -126,20 +152,20 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(2 bytes),
pref: $PREF_ALIGN,
},
size: Size(2 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -148,20 +174,20 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -170,12 +196,6 @@ error: layout_of(MultipleAlignments) = Layout {
0,
],
},
variants: Single {
index: 2,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -186,32 +206,12 @@ error: layout_of(MultipleAlignments) = Layout {
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 2,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=2,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:21:1
|
@ -219,6 +219,14 @@ LL | enum MultipleAlignments {
| ^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -227,6 +235,16 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -239,6 +257,14 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
tag_field: 0,
variants: [
Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(4 bytes),
@ -247,20 +273,20 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
largest_niche: None,
variants: Single {
index: 0,
},
},
Layout {
size: Size(3 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
},
Layout {
fields: Arbitrary {
offsets: [
Size(1 bytes),
@ -269,12 +295,6 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
0,
],
},
variants: Single {
index: 1,
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(1 bytes),
@ -285,32 +305,12 @@ error: layout_of(std::result::Result<[u32; 0], Packed<std::num::NonZeroU16>>) =
valid_range: 1..=65535,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(3 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I8,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:37:1
|
@ -318,6 +318,14 @@ LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>;
| ^^^^^^^^^^^^^^^^^^^^^^^
error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -326,6 +334,16 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 0..=1,
},
),
variants: Multiple {
tag: Initialized {
value: Int(
@ -342,28 +360,14 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
tag_field: 0,
variants: [
Layout {
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
variants: Single {
index: 0,
},
abi: Aggregate {
sized: true,
},
largest_niche: None,
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(0 bytes),
},
Layout {
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
@ -372,12 +376,28 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
0,
],
},
largest_niche: None,
variants: Single {
index: 1,
index: 0,
},
},
Layout {
size: Size(2 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
},
abi: Aggregate {
sized: true,
},
fields: Arbitrary {
offsets: [
Size(0 bytes),
],
memory_index: [
0,
],
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
@ -388,32 +408,12 @@ error: layout_of(std::result::Result<[u32; 0], Packed<U16IsZero>>) = Layout {
valid_range: 0..=0,
},
),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: $PREF_ALIGN,
variants: Single {
index: 1,
},
size: Size(2 bytes),
},
],
},
abi: Aggregate {
sized: true,
},
largest_niche: Some(
Niche {
offset: Size(0 bytes),
value: Int(
I16,
false,
),
valid_range: 0..=1,
},
),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: $PREF_ALIGN,
},
size: Size(4 bytes),
}
--> $DIR/zero-sized-array-enum-niche.rs:44:1
|

View File

@ -0,0 +1,8 @@
// run-fail
// check-run-results
// compile-flags: -Zlocation-detail=none
// exec-env:RUST_BACKTRACE=0
fn main() {
panic!("no location info");
}

View File

@ -0,0 +1,2 @@
thread 'main' panicked at 'no location info', <redacted>:0:0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace