From 28f82d0fdb4dc072037cee2e043064a7c2953b81 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Wed, 27 Aug 2025 23:09:10 +0800 Subject: [PATCH 1/5] Implement lint unconstructible_pub_struct --- compiler/rustc_lint_defs/src/builtin.rs | 33 ++++ compiler/rustc_middle/src/query/mod.rs | 1 + compiler/rustc_passes/messages.ftl | 4 + compiler/rustc_passes/src/dead.rs | 184 +++++++++++++++--- compiler/rustc_passes/src/errors.rs | 8 + .../dead-code/unconstructable-pub-struct.rs | 83 ++++++++ .../unconstructable-pub-struct.stderr | 31 +++ 7 files changed, 315 insertions(+), 29 deletions(-) create mode 100644 tests/ui/lint/dead-code/unconstructable-pub-struct.rs create mode 100644 tests/ui/lint/dead-code/unconstructable-pub-struct.stderr diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 899632b9d4b75..284c1cca6ff80 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -112,6 +112,7 @@ declare_lint_pass! { TYVAR_BEHIND_RAW_POINTER, UNCONDITIONAL_PANIC, UNCONDITIONAL_RECURSION, + UNCONSTRUCTABLE_PUB_STRUCT, UNCOVERED_PARAM_IN_PROJECTION, UNEXPECTED_CFGS, UNFULFILLED_LINT_EXPECTATIONS, @@ -758,6 +759,38 @@ declare_lint! { "detect unused, unexported items" } +declare_lint! { + /// The `unconstructable_pub_struct` lint detects public structs that + /// are unused locally and cannot be constructed externally. + /// + /// ### Example + /// + /// ```rust,compile_fail + /// #![deny(unconstructable_pub_struct)] + /// + /// pub struct Foo(i32); + /// # fn main() {} + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// Unconstructable pub structs may signal a mistake or unfinished code. + /// To silence the warning for individual items, prefix the name with an + /// underscore such as `_Foo`. + /// + /// To preserve this lint, add a field with unit or never types that + /// indicate that the behavior is intentional, or use `PhantomData` as + /// field types if the struct is only used at the type level to check + /// things like well-formedness. + /// + /// Otherwise, consider removing it if the struct is no longer in use. + pub UNCONSTRUCTABLE_PUB_STRUCT, + Allow, + "detects pub structs that are unused locally and cannot be constructed externally" +} + declare_lint! { /// The `unused_attributes` lint detects attributes that were not used by /// the compiler. diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 15c84a5b01fb2..0c6e08b804034 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1221,6 +1221,7 @@ rustc_queries! { query live_symbols_and_ignored_derived_traits(_: ()) -> &'tcx Result<( LocalDefIdSet, LocalDefIdMap>, + LocalDefIdSet, ), ErrorGuaranteed> { arena_cache desc { "finding live symbols in crate" } diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 91a20a12b6334..8653b5862274b 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -586,6 +586,10 @@ passes_trait_impl_const_stable = passes_transparent_incompatible = transparent {$target} cannot have other repr hints +passes_unconstructable_pub_struct = + pub struct `{$name}` is unconstructable externally and never constructed locally + .help = this struct may be unused locally and also externally, consider removing it + passes_unexportable_adt_with_private_fields = ADT types with private fields are not exportable .note = `{$field_name}` is private diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs index 705d1b9e38408..dd85d3ff31d85 100644 --- a/compiler/rustc_passes/src/dead.rs +++ b/compiler/rustc_passes/src/dead.rs @@ -10,7 +10,7 @@ use hir::def_id::{LocalDefIdMap, LocalDefIdSet}; use rustc_abi::FieldIdx; use rustc_data_structures::fx::FxIndexSet; use rustc_errors::{ErrorGuaranteed, MultiSpan}; -use rustc_hir::def::{CtorOf, DefKind, Res}; +use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res}; use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId}; use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{self as hir, Node, PatKind, QPath}; @@ -19,12 +19,13 @@ use rustc_middle::middle::privacy::Level; use rustc_middle::query::Providers; use rustc_middle::ty::{self, AssocTag, TyCtxt}; use rustc_middle::{bug, span_bug}; -use rustc_session::lint::builtin::DEAD_CODE; +use rustc_session::lint::builtin::{DEAD_CODE, UNCONSTRUCTABLE_PUB_STRUCT}; use rustc_session::lint::{self, LintExpectationId}; use rustc_span::{Symbol, kw, sym}; use crate::errors::{ - ChangeFields, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, UselessAssignment, + ChangeFields, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, UnconstructablePubStruct, + UselessAssignment, }; /// Any local definition that may call something in its body block should be explored. For example, @@ -67,6 +68,43 @@ fn should_explore(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { } } +fn struct_can_be_constructed_directly(tcx: TyCtxt<'_>, id: LocalDefId) -> bool { + let adt_def = tcx.adt_def(id); + + // Such types often declared in Rust but constructed by FFI, so ignore + if adt_def.repr().c() || adt_def.repr().transparent() { + return true; + } + + // Skip types contain fields of unit and never type, + // it's usually intentional to make the type not constructible + if adt_def.all_fields().any(|field| { + let field_type = tcx.type_of(field.did).instantiate_identity(); + field_type.is_unit() || field_type.is_never() + }) { + return true; + } + + adt_def.all_fields().all(|field| { + let field_type = tcx.type_of(field.did).instantiate_identity(); + // Skip fields of PhantomData, + // cause it's a common way to check things like well-formedness + if field_type.is_phantom_data() { + return true; + } + + field.vis.is_public() + }) +} + +fn method_has_no_receiver(tcx: TyCtxt<'_>, id: LocalDefId) -> bool { + if let Some(fn_decl) = tcx.hir_fn_decl_by_hir_id(tcx.local_def_id_to_hir_id(id)) { + !fn_decl.implicit_self.has_implicit_self() + } else { + true + } +} + /// Determine if a work from the worklist is coming from a `#[allow]` /// or a `#[expect]` of `dead_code` #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] @@ -372,6 +410,34 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { ControlFlow::Continue(()) } + fn mark_live_symbols_until_unsolved_items_fixed( + &mut self, + unsolved_items: &mut Vec, + ) -> Result<(), ErrorGuaranteed> { + if let ControlFlow::Break(guar) = self.mark_live_symbols() { + return Err(guar); + } + + // We have marked the primary seeds as live. We now need to process unsolved items from traits + // and trait impls: add them to the work list if the trait or the implemented type is live. + let mut items_to_check: Vec<_> = unsolved_items + .extract_if(.., |&mut local_def_id| self.check_impl_or_impl_item_live(local_def_id)) + .collect(); + + while !items_to_check.is_empty() { + self.worklist.extend(items_to_check.drain(..).map(|id| (id, ComesFromAllowExpect::No))); + if let ControlFlow::Break(guar) = self.mark_live_symbols() { + return Err(guar); + } + + items_to_check.extend(unsolved_items.extract_if(.., |&mut local_def_id| { + self.check_impl_or_impl_item_live(local_def_id) + })); + } + + Ok(()) + } + /// Automatically generated items marked with `rustc_trivial_field_reads` /// will be ignored for the purposes of dead code analysis (see PR #85200 /// for discussion). @@ -491,9 +557,12 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { (self.tcx.local_parent(local_def_id), trait_item_id) } // impl items are live if the corresponding traits are live - DefKind::Impl { of_trait: true } => { - (local_def_id, self.tcx.impl_trait_id(local_def_id).as_local()) - } + DefKind::Impl { of_trait } => ( + local_def_id, + of_trait + .then(|| self.tcx.impl_trait_id(local_def_id)) + .and_then(|did| did.as_local()), + ), _ => bug!(), }; @@ -698,6 +767,12 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> { } } +fn has_allow_unconstructable_pub_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool { + let hir_id = tcx.local_def_id_to_hir_id(def_id); + let lint_level = tcx.lint_level_at_node(UNCONSTRUCTABLE_PUB_STRUCT, hir_id).level; + matches!(lint_level, lint::Allow | lint::Expect) +} + fn has_allow_dead_code_or_lang_attr( tcx: TyCtxt<'_>, def_id: LocalDefId, @@ -757,7 +832,9 @@ fn maybe_record_as_seed<'tcx>( unsolved_items: &mut Vec, ) { let allow_dead_code = has_allow_dead_code_or_lang_attr(tcx, owner_id.def_id); - if let Some(comes_from_allow) = allow_dead_code { + if let Some(comes_from_allow) = allow_dead_code + && !tcx.effective_visibilities(()).is_reachable(owner_id.def_id) + { worklist.push((owner_id.def_id, comes_from_allow)); } @@ -821,6 +898,33 @@ fn create_and_seed_worklist( effective_vis .is_public_at_level(Level::Reachable) .then_some(id) + .filter(|id| { + let (is_seed, is_impl_or_impl_item) = match tcx.def_kind(*id) { + DefKind::Impl { .. } => (false, true), + DefKind::AssocFn => ( + !matches!(tcx.def_kind(tcx.local_parent(*id)), DefKind::Impl { .. }) + || method_has_no_receiver(tcx, *id), + true, + ), + DefKind::Struct => ( + has_allow_unconstructable_pub_struct(tcx, *id) + || struct_can_be_constructed_directly(tcx, *id), + false, + ), + DefKind::Ctor(CtorOf::Struct, CtorKind::Fn) => ( + has_allow_unconstructable_pub_struct(tcx, tcx.local_parent(*id)) + || struct_can_be_constructed_directly(tcx, tcx.local_parent(*id)), + false, + ), + _ => (true, false), + }; + + if !is_seed && is_impl_or_impl_item { + unsolved_impl_item.push(*id); + } + + is_seed + }) .map(|id| (id, ComesFromAllowExpect::No)) }) // Seed entry point @@ -841,7 +945,7 @@ fn create_and_seed_worklist( fn live_symbols_and_ignored_derived_traits( tcx: TyCtxt<'_>, (): (), -) -> Result<(LocalDefIdSet, LocalDefIdMap>), ErrorGuaranteed> { +) -> Result<(LocalDefIdSet, LocalDefIdMap>, LocalDefIdSet), ErrorGuaranteed> { let (worklist, mut unsolved_items) = create_and_seed_worklist(tcx); let mut symbol_visitor = MarkSymbolVisitor { worklist, @@ -855,32 +959,33 @@ fn live_symbols_and_ignored_derived_traits( ignore_variant_stack: vec![], ignored_derived_traits: Default::default(), }; - if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { - return Err(guar); - } + symbol_visitor.mark_live_symbols_until_unsolved_items_fixed(&mut unsolved_items)?; - // We have marked the primary seeds as live. We now need to process unsolved items from traits - // and trait impls: add them to the work list if the trait or the implemented type is live. - let mut items_to_check: Vec<_> = unsolved_items - .extract_if(.., |&mut local_def_id| { - symbol_visitor.check_impl_or_impl_item_live(local_def_id) - }) - .collect(); + let reachable_items = + tcx.effective_visibilities(()).iter().filter_map(|(&id, effective_vis)| { + effective_vis.is_public_at_level(Level::Reachable).then_some(id) + }); - while !items_to_check.is_empty() { - symbol_visitor - .worklist - .extend(items_to_check.drain(..).map(|id| (id, ComesFromAllowExpect::No))); - if let ControlFlow::Break(guar) = symbol_visitor.mark_live_symbols() { - return Err(guar); + let mut unstructurable_pub_structs = LocalDefIdSet::default(); + for id in reachable_items { + if symbol_visitor.live_symbols.contains(&id) { + continue; } - items_to_check.extend(unsolved_items.extract_if(.., |&mut local_def_id| { - symbol_visitor.check_impl_or_impl_item_live(local_def_id) - })); + if matches!(tcx.def_kind(id), DefKind::Struct) { + unstructurable_pub_structs.insert(id); + } + + symbol_visitor.worklist.push((id, ComesFromAllowExpect::No)); } - Ok((symbol_visitor.live_symbols, symbol_visitor.ignored_derived_traits)) + symbol_visitor.mark_live_symbols_until_unsolved_items_fixed(&mut unsolved_items)?; + + Ok(( + symbol_visitor.live_symbols, + symbol_visitor.ignored_derived_traits, + unstructurable_pub_structs, + )) } struct DeadItem { @@ -1160,7 +1265,7 @@ impl<'tcx> DeadVisitor<'tcx> { } fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { - let Ok((live_symbols, ignored_derived_traits)) = + let Ok((live_symbols, ignored_derived_traits, unstructurable_pub_structs)) = tcx.live_symbols_and_ignored_derived_traits(()).as_ref() else { return; @@ -1252,6 +1357,27 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) { for foreign_item in module_items.foreign_items() { visitor.check_definition(foreign_item.owner_id.def_id); } + + for item in module_items.free_items() { + let def_id = item.owner_id.def_id; + + if !unstructurable_pub_structs.contains(&def_id) { + continue; + } + + let Some(name) = tcx.opt_item_name(def_id.to_def_id()) else { + continue; + }; + + if name.as_str().starts_with('_') { + continue; + } + + let hir_id = tcx.local_def_id_to_hir_id(def_id); + let vis_span = tcx.hir_node(hir_id).expect_item().vis_span; + let diag = UnconstructablePubStruct { name, vis_span }; + tcx.emit_node_span_lint(UNCONSTRUCTABLE_PUB_STRUCT, hir_id, tcx.hir_span(hir_id), diag); + } } pub(crate) fn provide(providers: &mut Providers) { diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index e4826cccd32f8..950cd2023861e 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -1261,6 +1261,14 @@ pub(crate) enum MultipleDeadCodes<'tcx> { }, } +#[derive(LintDiagnostic)] +#[diag(passes_unconstructable_pub_struct)] +pub(crate) struct UnconstructablePubStruct { + pub name: Symbol, + #[help] + pub vis_span: Span, +} + #[derive(Subdiagnostic)] #[note(passes_enum_variant_same_name)] pub(crate) struct EnumVariantSameName<'tcx> { diff --git a/tests/ui/lint/dead-code/unconstructable-pub-struct.rs b/tests/ui/lint/dead-code/unconstructable-pub-struct.rs new file mode 100644 index 0000000000000..dc9f228052f0a --- /dev/null +++ b/tests/ui/lint/dead-code/unconstructable-pub-struct.rs @@ -0,0 +1,83 @@ +#![feature(never_type)] +#![deny(unconstructable_pub_struct)] + +pub struct T1(!); +pub struct T2(()); +pub struct T3(std::marker::PhantomData); + +pub struct T4 { + _x: !, +} + +pub struct T5 { + _x: !, + _y: X, +} + +pub struct T6 { + _x: (), +} + +pub struct T7 { + _x: (), + _y: X, +} + +pub struct T8 { + _x: std::marker::PhantomData, +} + +pub struct T9 { //~ ERROR: pub struct `T9` is unconstructable externally and never constructed locally + _x: std::marker::PhantomData, + _y: i32, +} + +pub struct _T10(i32); + +mod pri { + pub struct Unreachable(i32); +} + +pub struct NeverConstructed(i32); //~ ERROR: pub struct `NeverConstructed` is unconstructable externally and never constructed locally + +impl NeverConstructed { + pub fn not_construct_self(&self) {} +} + +impl Clone for NeverConstructed { + fn clone(&self) -> NeverConstructed { + NeverConstructed(0) + } +} + +pub trait Trait { + fn not_construct_self(&self); +} + +impl Trait for NeverConstructed { + fn not_construct_self(&self) { + self.0; + } +} + +pub struct Constructed(i32); + +impl Constructed { + pub fn construct_self() -> Self { + Constructed(0) + } +} + +impl Clone for Constructed { + fn clone(&self) -> Constructed { + Constructed(0) + } +} + +impl Trait for Constructed { + fn not_construct_self(&self) { + self.0; + } +} + +fn main() {} diff --git a/tests/ui/lint/dead-code/unconstructable-pub-struct.stderr b/tests/ui/lint/dead-code/unconstructable-pub-struct.stderr new file mode 100644 index 0000000000000..9effbf3ea51e6 --- /dev/null +++ b/tests/ui/lint/dead-code/unconstructable-pub-struct.stderr @@ -0,0 +1,31 @@ +error: pub struct `T9` is unconstructable externally and never constructed locally + --> $DIR/unconstructable-pub-struct.rs:30:1 + | +LL | pub struct T9 { + | ^^^^^^^^^^^^^^^^ + | +help: this struct may be unused locally and also externally, consider removing it + --> $DIR/unconstructable-pub-struct.rs:30:1 + | +LL | pub struct T9 { + | ^^^ +note: the lint level is defined here + --> $DIR/unconstructable-pub-struct.rs:2:9 + | +LL | #![deny(unconstructable_pub_struct)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: pub struct `NeverConstructed` is unconstructable externally and never constructed locally + --> $DIR/unconstructable-pub-struct.rs:41:1 + | +LL | pub struct NeverConstructed(i32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: this struct may be unused locally and also externally, consider removing it + --> $DIR/unconstructable-pub-struct.rs:41:1 + | +LL | pub struct NeverConstructed(i32); + | ^^^ + +error: aborting due to 2 previous errors + From bc3f07254deaf8278b18ab16f0a6695c0f9d02ac Mon Sep 17 00:00:00 2001 From: mu001999 Date: Thu, 13 Nov 2025 22:10:16 +0800 Subject: [PATCH 2/5] Deny by default to crater test --- compiler/rustc_lint_defs/src/builtin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 284c1cca6ff80..d5030b65751ba 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -787,7 +787,7 @@ declare_lint! { /// /// Otherwise, consider removing it if the struct is no longer in use. pub UNCONSTRUCTABLE_PUB_STRUCT, - Allow, + Deny, "detects pub structs that are unused locally and cannot be constructed externally" } From bf2b027ff2e4e0afbe91664dd12d36aa71f0ebda Mon Sep 17 00:00:00 2001 From: mu001999 Date: Thu, 13 Nov 2025 22:55:43 +0800 Subject: [PATCH 3/5] Removed dead code --- .../hir-ty/src/next_solver/infer/mod.rs | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs index 443191423a88d..0a30386b7ad66 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/next_solver/infer/mod.rs @@ -1,7 +1,6 @@ //! Infer context the next-trait-solver. use std::cell::{Cell, RefCell}; -use std::fmt; use std::ops::Range; use std::sync::Arc; @@ -299,32 +298,6 @@ pub enum BoundRegionConversionTime { AssocTypeProjection(SolverDefId), } -#[derive(Copy, Clone, Debug)] -pub struct FixupError { - unresolved: TyOrConstInferVar, -} - -impl fmt::Display for FixupError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use TyOrConstInferVar::*; - - match self.unresolved { - TyInt(_) => write!( - f, - "cannot determine the type of this integer; \ - add a suffix to specify the type explicitly" - ), - TyFloat(_) => write!( - f, - "cannot determine the type of this number; \ - add a suffix to specify the type explicitly" - ), - Ty(_) => write!(f, "unconstrained type"), - Const(_) => write!(f, "unconstrained const value"), - } - } -} - /// See the `region_obligations` field for more information. #[derive(Clone, Debug)] pub struct TypeOutlivesConstraint<'db> { From 544cd3f59d01e874ca69a91ea5250875eb72894b Mon Sep 17 00:00:00 2001 From: mu001999 Date: Tue, 2 Dec 2025 23:36:44 +0800 Subject: [PATCH 4/5] Add lint UNCONSTRUCTABLE_PUB_STRUCT to unused lint group --- compiler/rustc_lint/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index 78b76e083d416..7a63129ce92b8 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -293,6 +293,7 @@ fn register_builtins(store: &mut LintStore) { UNUSED_VARIABLES, UNUSED_ASSIGNMENTS, DEAD_CODE, + UNCONSTRUCTABLE_PUB_STRUCT, UNUSED_MUT, UNREACHABLE_CODE, UNREACHABLE_PATTERNS, From 4dc0f128de16103a7781c7111429ad440813c80b Mon Sep 17 00:00:00 2001 From: mu001999 Date: Wed, 3 Dec 2025 08:44:21 +0800 Subject: [PATCH 5/5] [TEMP] Bless tests --- tests/assembly-llvm/asm/arm-types.rs | 1 + tests/assembly-llvm/asm/powerpc-types.rs | 1 + tests/assembly-llvm/asm/s390x-types.rs | 1 + tests/assembly-llvm/simd-bitmask.rs | 1 + tests/assembly-llvm/simd-intrinsic-select.rs | 1 + tests/codegen-llvm/is_val_statically_known.rs | 1 + tests/codegen-llvm/simd/extract-insert-dyn.rs | 1 + .../item-collection/generic-impl.rs | 1 + .../item-collection/overloaded-operators.rs | 1 + tests/crashes/130797.rs | 1 + tests/crashes/98322.rs | 1 + tests/incremental/auxiliary/issue-79661.rs | 1 + .../incremental/hashes/struct_constructors.rs | 2 + tests/incremental/incremental_proc_macro.rs | 2 + .../issue-108481-feed-eval-always.rs | 2 + .../issue-79661-missing-def-path-hash.rs | 2 + ...apping-impls-in-new-solver-issue-135514.rs | 2 + .../mir-opt/pre-codegen/derived_ord_debug.rs | 1 + ...rtial_cmp.PreCodegen.after.panic-abort.mir | 4 +- ...tial_cmp.PreCodegen.after.panic-unwind.mir | 4 +- ...pl#1}-cmp.PreCodegen.after.panic-abort.mir | 4 +- ...l#1}-cmp.PreCodegen.after.panic-unwind.mir | 4 +- tests/pretty/issue-4264.pp | 10 +- tests/pretty/issue-4264.rs | 2 + .../inline_cross/auxiliary/issue-46727.rs | 2 + .../auxiliary/extern-builtin-type-impl-dep.rs | 2 + .../reexport/auxiliary/wrap-unnamable-type.rs | 2 + .../auxiliary/parent-crate-115718.rs | 2 + .../issue-115259-suggest-iter-mut.fixed | 2 + .../borrowck/issue-115259-suggest-iter-mut.rs | 2 + .../issue-115259-suggest-iter-mut.stderr | 2 +- .../struct-with-reference-to-trait-5708.rs | 2 + .../auxiliary/coherence_copy_like_lib.rs | 2 + tests/ui/coherence/auxiliary/coherence_lib.rs | 2 + .../ui/coherence/impl-foreign-for-foreign.rs | 2 + .../coherence/impl-foreign-for-foreign.stderr | 2 +- .../impl-foreign-for-fundamental[foreign].rs | 2 + ...pl-foreign-for-fundamental[foreign].stderr | 4 +- .../impl-foreign-for-fundamental[local].rs | 2 + tests/ui/coherence/impl-foreign-for-local.rs | 2 + ...foreign-for-locally-defined-fundamental.rs | 2 + ...or-locally-defined-fundamental[foreign].rs | 2 + .../impl-foreign[foreign]-for-local.rs | 2 + ...reign[fundemental[foreign]]-for-foreign.rs | 2 + ...n[fundemental[foreign]]-for-foreign.stderr | 6 +- ...foreign[fundemental[local]]-for-foreign.rs | 2 + .../impl[t]-foreign-for-foreign[t].rs | 2 + .../impl[t]-foreign-for-foreign[t].stderr | 4 +- .../impl[t]-foreign-for-fundamental[t].rs | 2 + .../impl[t]-foreign-for-fundamental[t].stderr | 2 +- ...]-foreign[foreign[t]_local]-for-foreign.rs | 2 + ...[t]-foreign[foreign]-for-fundamental[t].rs | 2 + ...foreign[foreign]-for-fundamental[t].stderr | 4 +- .../impl[t]-foreign[foreign]-for-t.rs | 2 + .../impl[t]-foreign[foreign]-for-t.stderr | 2 +- ...[t]-foreign[fundamental[t]]-for-foreign.rs | 2 + ...foreign[fundamental[t]]-for-foreign.stderr | 4 +- ...eign[fundamental[t]]-for-fundamental[t].rs | 2 + ...[fundamental[t]]-for-fundamental[t].stderr | 4 +- ...pl[t]-foreign[fundamental[t]]-for-local.rs | 2 + .../impl[t]-foreign[fundamental[t]]-for-t.rs | 2 + ...pl[t]-foreign[fundamental[t]]-for-t.stderr | 4 +- ...reign[fundamental[t]_local]-for-foreign.rs | 2 + ...n[fundamental[t]_local]-for-foreign.stderr | 4 +- ...eign[fundemental[local]]-for-foreign[t].rs | 2 + .../impl[t]-foreign[local]-for-foreign.rs | 2 + .../impl[t]-foreign[local]-for-foreign[t].rs | 2 + ...eign[local]-for-fundamental[foreign[t]].rs | 2 + ...pl[t]-foreign[local]-for-fundamental[t].rs | 2 + ...]-foreign[local]-for-fundamental[t].stderr | 4 +- .../impl[t]-foreign[local]-for-local.rs | 2 + .../coherence/impl[t]-foreign[local]-for-t.rs | 2 + .../impl[t]-foreign[local]-for-t.stderr | 2 +- ...reign[local_fundamental[t]]-for-foreign.rs | 2 + .../impl[t]-foreign[t]-for-foreign.rs | 2 + .../impl[t]-foreign[t]-for-foreign.stderr | 2 +- .../impl[t]-foreign[t]-for-fundamental.rs | 2 + .../impl[t]-foreign[t]-for-fundamental.stderr | 4 +- .../coherence/impl[t]-foreign[t]-for-local.rs | 2 + .../ui/coherence/impl[t]-foreign[t]-for-t.rs | 2 + .../coherence/impl[t]-foreign[t]-for-t.stderr | 2 +- .../auxiliary/unsized_const_param.rs | 2 + .../adt_const_params/unsized_field-1.rs | 2 + .../adt_const_params/unsized_field-1.stderr | 12 +-- .../auxiliary/generics_of_parent.rs | 2 + .../auxiliary/trait_object_lt_defaults_lib.rs | 2 + .../defaults/trait_object_lt_defaults.rs | 2 + .../generic_const_exprs/associated-consts.rs | 2 + .../parent_generics_of_encoding.rs | 2 + .../auxiliary/xcrate_unit_struct.rs | 2 + tests/ui/cross-crate/unit-struct-2.rs | 2 + tests/ui/cross-crate/unit-struct.rs | 2 + tests/ui/cross-crate/unit-struct.stderr | 8 +- tests/ui/deriving/issue-58319.rs | 2 + tests/ui/extern/auxiliary/fat_drop.rs | 2 + tests/ui/extern/extern_fat_drop.rs | 2 + tests/ui/issues/auxiliary/issue-31702-2.rs | 2 + tests/ui/issues/issue-31702.rs | 2 + ...-dont-override-forbid-in-same-scope.stderr | 18 ++++ tests/ui/lint/outer-forbid.stderr | 18 ++++ tests/ui/packed/auxiliary/packed.rs | 2 + tests/ui/packed/packed-struct-size-xc.rs | 2 + ...re-clause-before-tuple-struct-body-0.fixed | 2 + ...where-clause-before-tuple-struct-body-0.rs | 2 + ...e-clause-before-tuple-struct-body-0.stderr | 4 +- .../ui/pattern/usefulness/auxiliary/empty.rs | 2 + ...tch-check-notes.exhaustive_patterns.stderr | 14 +-- .../empty-match-check-notes.normal.stderr | 14 +-- .../usefulness/empty-match-check-notes.rs | 2 + tests/ui/pattern/usefulness/uninhabited.rs | 2 + .../privacy/auxiliary/privacy_tuple_struct.rs | 2 + .../auxiliary/private-inferred-type.rs | 1 + tests/ui/privacy/privacy5.stderr | 96 +++++++++---------- tests/ui/pub/pub-ident-struct-4.fixed | 2 + tests/ui/pub/pub-ident-struct-4.rs | 2 + tests/ui/pub/pub-ident-struct-4.stderr | 2 +- .../reachable/auxiliary/foreign-priv-aux.rs | 2 + tests/ui/reachable/foreign-priv.rs | 2 + tests/ui/regions/regions-issue-21422.rs | 2 + .../uninhabited/auxiliary/uninhabited.rs | 2 + .../uninhabited/coercions.rs | 2 + .../uninhabited/coercions.stderr | 8 +- .../uninhabited/indirect_match.rs | 2 + .../uninhabited/indirect_match.stderr | 16 ++-- ...indirect_match_with_exhaustive_patterns.rs | 2 + ...rect_match_with_exhaustive_patterns.stderr | 16 ++-- .../issue-65157-repeated-match-arm.rs | 2 + .../issue-65157-repeated-match-arm.stderr | 4 +- .../uninhabited/match.rs | 2 + .../uninhabited/match.stderr | 8 +- .../match_with_exhaustive_patterns.rs | 2 + .../match_with_exhaustive_patterns.stderr | 4 +- .../uninhabited/patterns.rs | 2 + .../uninhabited/patterns.stderr | 10 +- .../rfcs/rfc-2093-infer-outlives/privacy.rs | 2 + tests/ui/static/auxiliary/nested_item.rs | 2 + tests/ui/static/nested_item_main.rs | 2 + .../structs-enums/newtype-struct-with-dtor.rs | 2 + .../ui/structs-enums/uninstantiable-struct.rs | 2 + .../structs/auxiliary/struct_field_privacy.rs | 2 + .../auxiliary/struct_variant_privacy.rs | 2 + tests/ui/structs/struct-field-privacy.rs | 2 + tests/ui/structs/struct-field-privacy.stderr | 10 +- .../structs/struct-variant-privacy-xc.stderr | 4 +- tests/ui/structs/suggest-private-fields.rs | 2 + .../ui/structs/suggest-private-fields.stderr | 8 +- .../ui/suggestions/derive-clone-for-eq.fixed | 2 + tests/ui/suggestions/derive-clone-for-eq.rs | 2 + .../ui/suggestions/derive-clone-for-eq.stderr | 4 +- .../ui/suggestions/option-content-move.fixed | 2 + tests/ui/suggestions/option-content-move.rs | 2 + .../ui/suggestions/option-content-move.stderr | 4 +- tests/ui/traits/object/generics.rs | 2 + .../auxiliary/drop-shim-relates-opaque-aux.rs | 1 + .../typeck/auxiliary/tdticc_coherence_lib.rs | 2 + ...efault-trait-impl-cross-crate-coherence.rs | 2 + ...lt-trait-impl-cross-crate-coherence.stderr | 8 +- 157 files changed, 416 insertions(+), 167 deletions(-) diff --git a/tests/assembly-llvm/asm/arm-types.rs b/tests/assembly-llvm/asm/arm-types.rs index 2022c86ef2e04..8578f478a719f 100644 --- a/tests/assembly-llvm/asm/arm-types.rs +++ b/tests/assembly-llvm/asm/arm-types.rs @@ -13,6 +13,7 @@ #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +#![allow(unconstructable_pub_struct)] extern crate minicore; use minicore::*; diff --git a/tests/assembly-llvm/asm/powerpc-types.rs b/tests/assembly-llvm/asm/powerpc-types.rs index 076b216d019e8..145d20c2e54a1 100644 --- a/tests/assembly-llvm/asm/powerpc-types.rs +++ b/tests/assembly-llvm/asm/powerpc-types.rs @@ -17,6 +17,7 @@ #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +#![allow(unconstructable_pub_struct)] extern crate minicore; use minicore::*; diff --git a/tests/assembly-llvm/asm/s390x-types.rs b/tests/assembly-llvm/asm/s390x-types.rs index 24db91bf77728..c2ea29081cacf 100644 --- a/tests/assembly-llvm/asm/s390x-types.rs +++ b/tests/assembly-llvm/asm/s390x-types.rs @@ -12,6 +12,7 @@ #![crate_type = "rlib"] #![no_core] #![allow(asm_sub_register, non_camel_case_types)] +#![allow(unconstructable_pub_struct)] extern crate minicore; use minicore::*; diff --git a/tests/assembly-llvm/simd-bitmask.rs b/tests/assembly-llvm/simd-bitmask.rs index 115d76e8ba927..f482065df0480 100644 --- a/tests/assembly-llvm/simd-bitmask.rs +++ b/tests/assembly-llvm/simd-bitmask.rs @@ -16,6 +16,7 @@ #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] #![allow(non_camel_case_types)] +#![allow(unconstructable_pub_struct)] extern crate minicore; use minicore::*; diff --git a/tests/assembly-llvm/simd-intrinsic-select.rs b/tests/assembly-llvm/simd-intrinsic-select.rs index 84ae6568b742a..75f132efd81f3 100644 --- a/tests/assembly-llvm/simd-intrinsic-select.rs +++ b/tests/assembly-llvm/simd-intrinsic-select.rs @@ -14,6 +14,7 @@ #![feature(no_core, lang_items, repr_simd, intrinsics)] #![no_core] #![allow(non_camel_case_types)] +#![allow(unconstructable_pub_struct)] extern crate minicore; use minicore::*; diff --git a/tests/codegen-llvm/is_val_statically_known.rs b/tests/codegen-llvm/is_val_statically_known.rs index 8119d3a3bf678..187eba2a42db5 100644 --- a/tests/codegen-llvm/is_val_statically_known.rs +++ b/tests/codegen-llvm/is_val_statically_known.rs @@ -2,6 +2,7 @@ #![feature(core_intrinsics)] #![feature(f16, f128)] +#![allow(unconstructable_pub_struct)] use std::intrinsics::is_val_statically_known; diff --git a/tests/codegen-llvm/simd/extract-insert-dyn.rs b/tests/codegen-llvm/simd/extract-insert-dyn.rs index e634841fae79d..7d84a16a74791 100644 --- a/tests/codegen-llvm/simd/extract-insert-dyn.rs +++ b/tests/codegen-llvm/simd/extract-insert-dyn.rs @@ -10,6 +10,7 @@ #![no_std] #![crate_type = "lib"] #![allow(non_camel_case_types)] +#![allow(unconstructable_pub_struct)] // Test that `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}` // lower to an LLVM extractelement or insertelement operation. diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index deebb9cd35116..a676ceda11865 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -2,6 +2,7 @@ #![deny(dead_code)] #![crate_type = "lib"] +#![allow(unconstructable_pub_struct)] struct Struct { x: T, diff --git a/tests/codegen-units/item-collection/overloaded-operators.rs b/tests/codegen-units/item-collection/overloaded-operators.rs index a4db80bc8fc51..263f9460d2e8f 100644 --- a/tests/codegen-units/item-collection/overloaded-operators.rs +++ b/tests/codegen-units/item-collection/overloaded-operators.rs @@ -2,6 +2,7 @@ #![deny(dead_code)] #![crate_type = "lib"] +#![allow(unconstructable_pub_struct)] use std::ops::{Add, Deref, Index, IndexMut}; diff --git a/tests/crashes/130797.rs b/tests/crashes/130797.rs index e9c877d92a6e9..ed92c11593301 100644 --- a/tests/crashes/130797.rs +++ b/tests/crashes/130797.rs @@ -1,4 +1,5 @@ //@ known-bug: #130797 +#![allow(unconstructable_pub_struct)] trait Transform { type Output<'a>; diff --git a/tests/crashes/98322.rs b/tests/crashes/98322.rs index 57b349160294b..b5e2287defb55 100644 --- a/tests/crashes/98322.rs +++ b/tests/crashes/98322.rs @@ -1,6 +1,7 @@ //@ known-bug: #98322 #![feature(generic_const_exprs)] +#![allow(unconstructable_pub_struct)] // Main function seems irrelevant fn main() {} diff --git a/tests/incremental/auxiliary/issue-79661.rs b/tests/incremental/auxiliary/issue-79661.rs index cd32a52ebfd21..16f006c023fca 100644 --- a/tests/incremental/auxiliary/issue-79661.rs +++ b/tests/incremental/auxiliary/issue-79661.rs @@ -1,4 +1,5 @@ #![feature(rustc_attrs)] +#![allow(unconstructable_pub_struct)] #[cfg_attr(any(rpass2, rpass3), doc = "Some comment")] pub struct Foo; diff --git a/tests/incremental/hashes/struct_constructors.rs b/tests/incremental/hashes/struct_constructors.rs index da7abe049d982..e924f6a293281 100644 --- a/tests/incremental/hashes/struct_constructors.rs +++ b/tests/incremental/hashes/struct_constructors.rs @@ -13,6 +13,8 @@ //@ [cfail3]compile-flags: -Zincremental-ignore-spans //@ ignore-backends: gcc +#![allow(unconstructable_pub_struct)] + #![allow(warnings)] #![feature(rustc_attrs)] #![crate_type="rlib"] diff --git a/tests/incremental/incremental_proc_macro.rs b/tests/incremental/incremental_proc_macro.rs index 19ae746fc2729..8c7176cbe03b3 100644 --- a/tests/incremental/incremental_proc_macro.rs +++ b/tests/incremental/incremental_proc_macro.rs @@ -6,6 +6,8 @@ // This test makes sure that we still find the proc-macro registrar function // when we compile proc-macros incrementally (see #47292). +#![allow(unconstructable_pub_struct)] + #![crate_type = "rlib"] #[macro_use] diff --git a/tests/incremental/issue-108481-feed-eval-always.rs b/tests/incremental/issue-108481-feed-eval-always.rs index e2229eeed0f1f..2bc1ac7e63689 100644 --- a/tests/incremental/issue-108481-feed-eval-always.rs +++ b/tests/incremental/issue-108481-feed-eval-always.rs @@ -1,6 +1,8 @@ //@ revisions: cpass1 cpass2 //@ ignore-backends: gcc +#![allow(unconstructable_pub_struct)] + #![crate_type = "rlib"] use std::fmt::Debug; diff --git a/tests/incremental/issue-79661-missing-def-path-hash.rs b/tests/incremental/issue-79661-missing-def-path-hash.rs index f26f680c67e80..4925ab1e2acc2 100644 --- a/tests/incremental/issue-79661-missing-def-path-hash.rs +++ b/tests/incremental/issue-79661-missing-def-path-hash.rs @@ -8,6 +8,8 @@ // when we ended up forcing a query. As a result, a subsequent // unchanged incremental run would crash due to the missing mapping +#![allow(unconstructable_pub_struct)] + extern crate issue_79661; use issue_79661::Wrapper; diff --git a/tests/incremental/overlapping-impls-in-new-solver-issue-135514.rs b/tests/incremental/overlapping-impls-in-new-solver-issue-135514.rs index 8fcc913fa3719..366b8cf03c8cb 100644 --- a/tests/incremental/overlapping-impls-in-new-solver-issue-135514.rs +++ b/tests/incremental/overlapping-impls-in-new-solver-issue-135514.rs @@ -7,6 +7,8 @@ //@ revisions: cpass1 cfail2 //@ compile-flags: -Znext-solver +#![allow(unconstructable_pub_struct)] + pub trait Trait {} pub struct S0(T); diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.rs b/tests/mir-opt/pre-codegen/derived_ord_debug.rs index 1d6a884cee443..15476b12ad857 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.rs +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.rs @@ -1,6 +1,7 @@ //@ compile-flags: -Copt-level=0 -Zmir-opt-level=1 -Cdebuginfo=limited // EMIT_MIR_FOR_EACH_PANIC_STRATEGY +#![allow(unconstructable_pub_struct)] #![crate_type = "lib"] #[derive(PartialOrd, Ord, PartialEq, Eq)] diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir index 9fc8da3a11204..3ddc975c606ae 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-abort.mir @@ -1,6 +1,6 @@ -// MIR for `::partial_cmp` after PreCodegen +// MIR for `::partial_cmp` after PreCodegen -fn ::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option { +fn ::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option { debug self => _1; debug other => _2; let mut _0: std::option::Option; diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir index 29cc54150764d..771fdfb35b2d3 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#0}-partial_cmp.PreCodegen.after.panic-unwind.mir @@ -1,6 +1,6 @@ -// MIR for `::partial_cmp` after PreCodegen +// MIR for `::partial_cmp` after PreCodegen -fn ::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option { +fn ::partial_cmp(_1: &MultiField, _2: &MultiField) -> Option { debug self => _1; debug other => _2; let mut _0: std::option::Option; diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir index 66d96021aa9be..6e3a0f3f0d3c2 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-abort.mir @@ -1,6 +1,6 @@ -// MIR for `::cmp` after PreCodegen +// MIR for `::cmp` after PreCodegen -fn ::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { +fn ::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { debug self => _1; debug other => _2; let mut _0: std::cmp::Ordering; diff --git a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir index 2dcba6195f713..2b45fc8ea5cc4 100644 --- a/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir +++ b/tests/mir-opt/pre-codegen/derived_ord_debug.{impl#1}-cmp.PreCodegen.after.panic-unwind.mir @@ -1,6 +1,6 @@ -// MIR for `::cmp` after PreCodegen +// MIR for `::cmp` after PreCodegen -fn ::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { +fn ::cmp(_1: &MultiField, _2: &MultiField) -> std::cmp::Ordering { debug self => _1; debug other => _2; let mut _0: std::cmp::Ordering; diff --git a/tests/pretty/issue-4264.pp b/tests/pretty/issue-4264.pp index 4eee6655cf6fb..9163fb602ed96 100644 --- a/tests/pretty/issue-4264.pp +++ b/tests/pretty/issue-4264.pp @@ -1,13 +1,15 @@ -#[attr = MacroUse {arguments: UseAll}] -extern crate std; -#[prelude_import] -use ::std::prelude::rust_2015::*; //@ pretty-compare-only //@ pretty-mode:hir,typed //@ pp-exact:issue-4264.pp // #4264 fixed-length vector types +#![allow(unconstructable_pub_struct)] +#[attr = MacroUse {arguments: UseAll}] +extern crate std; +#[prelude_import] +use ::std::prelude::rust_2015::*; + fn foo(_: [i32; (3 as usize)]) ({ } as ()) fn bar() ({ diff --git a/tests/pretty/issue-4264.rs b/tests/pretty/issue-4264.rs index 09840234b8c0c..0f2dc01f968d0 100644 --- a/tests/pretty/issue-4264.rs +++ b/tests/pretty/issue-4264.rs @@ -4,6 +4,8 @@ // #4264 fixed-length vector types +#![allow(unconstructable_pub_struct)] + pub fn foo(_: [i32; 3]) {} pub fn bar() { diff --git a/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs index acfc418f9f1d6..b28e23de6b60b 100644 --- a/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs +++ b/tests/rustdoc/inline_cross/auxiliary/issue-46727.rs @@ -1,5 +1,7 @@ //@ compile-flags: -Cmetadata=aux +#![allow(unconstructable_pub_struct)] + pub trait Foo {} pub struct Bar { x: T } diff --git a/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs b/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs index f0662fd82f191..e7c7ddd9ea32a 100644 --- a/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs +++ b/tests/rustdoc/intra-doc/auxiliary/extern-builtin-type-impl-dep.rs @@ -4,6 +4,8 @@ #![crate_type = "rlib"] #![no_std] +#![allow(unconstructable_pub_struct)] + pub struct DerefsToF64(f64); impl core::ops::Deref for DerefsToF64 { diff --git a/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs b/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs index 7f8e346c8beac..db1cd17bbb789 100644 --- a/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs +++ b/tests/rustdoc/reexport/auxiliary/wrap-unnamable-type.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + pub trait Assoc { type Ty; } diff --git a/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs index 3607612c27ae5..7312495b26587 100644 --- a/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs +++ b/tests/rustdoc/type-alias/auxiliary/parent-crate-115718.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + pub struct MyStruct(T); pub trait MyTrait1 { diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed index 14ac4a9ff5d0a..8dfb936c03567 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.fixed @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + #![allow(unused_mut)] #![allow(dead_code)] diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs index b0e0d8aeb5638..4db617ff9d552 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.rs @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + #![allow(unused_mut)] #![allow(dead_code)] diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 60ff010193fd2..4d38f3f512f61 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `**layer` as mutable, as it is behind a `&` reference - --> $DIR/issue-115259-suggest-iter-mut.rs:15:65 + --> $DIR/issue-115259-suggest-iter-mut.rs:17:65 | LL | self.layers.iter().fold(0, |result, mut layer| result + layer.process()) | ^^^^^ `layer` is a `&` reference, so it cannot be borrowed as mutable diff --git a/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs index 5157a3bf36b52..b3632b7d2a7b6 100644 --- a/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs +++ b/tests/ui/borrowck/struct-with-reference-to-trait-5708.rs @@ -1,5 +1,7 @@ // https://github.com/rust-lang/rust/issues/5708 //@ run-pass +#![allow(unconstructable_pub_struct)] + #![allow(unused_variables)] /* # ICE when returning struct with reference to trait diff --git a/tests/ui/coherence/auxiliary/coherence_copy_like_lib.rs b/tests/ui/coherence/auxiliary/coherence_copy_like_lib.rs index b5b4802c112de..d7b73d77d5431 100644 --- a/tests/ui/coherence/auxiliary/coherence_copy_like_lib.rs +++ b/tests/ui/coherence/auxiliary/coherence_copy_like_lib.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![crate_type = "rlib"] #![feature(fundamental)] diff --git a/tests/ui/coherence/auxiliary/coherence_lib.rs b/tests/ui/coherence/auxiliary/coherence_lib.rs index c22819831ab24..9ef4a6ffe73c8 100644 --- a/tests/ui/coherence/auxiliary/coherence_lib.rs +++ b/tests/ui/coherence/auxiliary/coherence_lib.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![crate_type="lib"] pub trait Remote { diff --git a/tests/ui/coherence/impl-foreign-for-foreign.rs b/tests/ui/coherence/impl-foreign-for-foreign.rs index 7f8cb9fcb0eb6..8e4c5efef041d 100644 --- a/tests/ui/coherence/impl-foreign-for-foreign.rs +++ b/tests/ui/coherence/impl-foreign-for-foreign.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign-for-foreign.stderr b/tests/ui/coherence/impl-foreign-for-foreign.stderr index 4ff965290c883..3960de91f8ed0 100644 --- a/tests/ui/coherence/impl-foreign-for-foreign.stderr +++ b/tests/ui/coherence/impl-foreign-for-foreign.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign-for-foreign.rs:10:1 + --> $DIR/impl-foreign-for-foreign.rs:12:1 | LL | impl Remote for i32 { | ^^^^^^^^^^^^^^^^--- diff --git a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].rs b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].rs index 983ae336a0b78..464816ccf96b1 100644 --- a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].rs +++ b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr index 596f8436567ae..a90ed9f381a89 100644 --- a/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr +++ b/tests/ui/coherence/impl-foreign-for-fundamental[foreign].stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl-foreign-for-fundamental[foreign].rs:10:1 + --> $DIR/impl-foreign-for-fundamental[foreign].rs:12:1 | LL | impl Remote for Box { | ^^^^^------^^^^^-------- @@ -12,7 +12,7 @@ LL | impl Remote for Box { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl-foreign-for-fundamental[foreign].rs:14:1 + --> $DIR/impl-foreign-for-fundamental[foreign].rs:16:1 | LL | impl Remote for Box> { | ^^^^^^^^------^^^^^---------- diff --git a/tests/ui/coherence/impl-foreign-for-fundamental[local].rs b/tests/ui/coherence/impl-foreign-for-fundamental[local].rs index faad0700e566a..09e3d9db9d95e 100644 --- a/tests/ui/coherence/impl-foreign-for-fundamental[local].rs +++ b/tests/ui/coherence/impl-foreign-for-fundamental[local].rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign-for-local.rs b/tests/ui/coherence/impl-foreign-for-local.rs index d12929244e964..955906605f844 100644 --- a/tests/ui/coherence/impl-foreign-for-local.rs +++ b/tests/ui/coherence/impl-foreign-for-local.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental.rs b/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental.rs index 0f66314e884dd..ebf0e5289cc58 100644 --- a/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental.rs +++ b/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![feature(fundamental)] //@ compile-flags:--crate-name=test diff --git a/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental[foreign].rs b/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental[foreign].rs index a3286777c4ee2..702e02918b7df 100644 --- a/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental[foreign].rs +++ b/tests/ui/coherence/impl-foreign-for-locally-defined-fundamental[foreign].rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![feature(fundamental)] //@ compile-flags:--crate-name=test diff --git a/tests/ui/coherence/impl-foreign[foreign]-for-local.rs b/tests/ui/coherence/impl-foreign[foreign]-for-local.rs index 3f671a4944e4c..a652c45266a3e 100644 --- a/tests/ui/coherence/impl-foreign[foreign]-for-local.rs +++ b/tests/ui/coherence/impl-foreign[foreign]-for-local.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs index 379beca50aed3..30fd3399c46b4 100644 --- a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs +++ b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr index 91f1886142cf6..7abb3184c95b2 100644 --- a/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr +++ b/tests/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:11:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:13:1 | LL | impl Remote1> for i32 { | ^^^^^--------------------^^^^^--- @@ -13,7 +13,7 @@ LL | impl Remote1> for i32 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:15:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:17:1 | LL | impl Remote1>> for f64 { | ^^^^^---------------------^^^^^--- @@ -27,7 +27,7 @@ LL | impl Remote1>> for f64 { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for primitive types - --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:19:1 + --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:21:1 | LL | impl Remote1>> for f32 { | ^^^^^^^^-------------------^^^^^--- diff --git a/tests/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs b/tests/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs index 95e3a0a9b8394..8d5e34716b837 100644 --- a/tests/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs +++ b/tests/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].rs b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].rs index 8703cc6a81975..38e7f274b51d3 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].rs +++ b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr index 306a5d1610d70..7b751e848e0cb 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign-for-foreign[t].stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl[t]-foreign-for-foreign[t].rs:11:1 + --> $DIR/impl[t]-foreign-for-foreign[t].rs:13:1 | LL | impl Remote for Rc { | ^^^^^^^^^^^^^^^^--------- @@ -11,7 +11,7 @@ LL | impl Remote for Rc { = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/impl[t]-foreign-for-foreign[t].rs:16:1 + --> $DIR/impl[t]-foreign-for-foreign[t].rs:18:1 | LL | impl Remote for Arc { | ^^^^^^^^^^^^^^^^^^^------ diff --git a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs index d9616b9adda79..be021e28c85f6 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr index 12d9a807f492d..4a85c1eced35c 100644 --- a/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign-for-fundamental[t].rs:10:6 + --> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:6 | LL | impl Remote for Box { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs index f1b9a08b44a7b..04f486724b814 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs @@ -2,6 +2,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs index 9d4440ba4866a..bdb3b9b8e674c 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr index 95a20cc5b0f5c..45866ec92a56c 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-fundamental[t].stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:10:6 + --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:12:6 | LL | impl Remote1 for Box { | ^ type parameter `T` must be used as the type parameter for some local type @@ -8,7 +8,7 @@ LL | impl Remote1 for Box { = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:14:10 + --> $DIR/impl[t]-foreign[foreign]-for-fundamental[t].rs:16:10 | LL | impl<'a, T> Remote1 for &'a T { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs index 533f0892b98fe..724a73f93c300 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr index 6ca3ccd05febc..540886edf8825 100644 --- a/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr +++ b/tests/ui/coherence/impl[t]-foreign[foreign]-for-t.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[foreign]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[foreign]-for-t.rs:12:6 | LL | impl Remote1 for T { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs index 02731052a6a96..a8570f54d3594 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr index 73b1e2c6ed248..2923333175f77 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-foreign.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:12:6 | LL | impl Remote1> for u32 { | ^ type parameter `T` must be used as the type parameter for some local type @@ -8,7 +8,7 @@ LL | impl Remote1> for u32 { = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:14:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-foreign.rs:16:10 | LL | impl<'a, T> Remote1<&'a T> for u32 { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs index 7c94fd80af2f2..b088833e654a9 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr index 5f89a7aa469c1..79f854b1b8ae8 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-fundamental[t].stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:10:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:12:10 | LL | impl<'a, T> Remote1> for &'a T { | ^ type parameter `T` must be used as the type parameter for some local type @@ -8,7 +8,7 @@ LL | impl<'a, T> Remote1> for &'a T { = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:13:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-fundamental[t].rs:15:10 | LL | impl<'a, T> Remote1<&'a T> for Box { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs index d368b870f25a1..44e64d5cbe173 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-local.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs index d998731687c4f..8a37e82647530 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr index 45559d8b62d37..42448841789cc 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]]-for-t.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:12:6 | LL | impl Remote1> for T { | ^ type parameter `T` must be used as the type parameter for some local type @@ -8,7 +8,7 @@ LL | impl Remote1> for T { = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:13:10 + --> $DIR/impl[t]-foreign[fundamental[t]]-for-t.rs:15:10 | LL | impl<'a, T> Remote1<&'a T> for T { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs index fdda2e0133d0b..701f432aa2ff6 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr index f94f04c8df5c1..fe0e2800c4ebd 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr +++ b/tests/ui/coherence/impl[t]-foreign[fundamental[t]_local]-for-foreign.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:12:6 | LL | impl Remote2, Local> for u32 { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) @@ -8,7 +8,7 @@ LL | impl Remote2, Local> for u32 { = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:14:10 + --> $DIR/impl[t]-foreign[fundamental[t]_local]-for-foreign.rs:16:10 | LL | impl<'a, T> Remote2<&'a T, Local> for u32 { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) diff --git a/tests/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs b/tests/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs index 4dd1ee381d557..1ff104bcb725c 100644 --- a/tests/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[local]-for-foreign.rs index d9b03971b1ca8..8f6f59614f74a 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-foreign.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs b/tests/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs index de9af310556aa..e0bef9f2b11b1 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs index 497bfe9a84ae4..2d31c1c56471b 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs index 4dd810cdcfc5b..34bd9ed522da2 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr index e68f2fe585637..5b382ee731d8a 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-fundamental[t].stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:10:6 + --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:12:6 | LL | impl Remote1 for Box { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) @@ -8,7 +8,7 @@ LL | impl Remote1 for Box { = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait for T0`, where `T0` is the first and `Tn` is the last error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:14:6 + --> $DIR/impl[t]-foreign[local]-for-fundamental[t].rs:16:6 | LL | impl Remote1 for &T { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-local.rs b/tests/ui/coherence/impl[t]-foreign[local]-for-local.rs index 9c2b20527d7d7..94287e386e2c7 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-local.rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-local.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[local]-for-t.rs index 85322ecac4c1e..a275c30de46e0 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-t.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr index 1f3463e88371b..818fdf24c016a 100644 --- a/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr +++ b/tests/ui/coherence/impl[t]-foreign[local]-for-t.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be covered by another type when it appears before the first local type (`Local`) - --> $DIR/impl[t]-foreign[local]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[local]-for-t.rs:12:6 | LL | impl Remote1 for T { | ^ type parameter `T` must be covered by another type when it appears before the first local type (`Local`) diff --git a/tests/ui/coherence/impl[t]-foreign[local_fundamental[t]]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[local_fundamental[t]]-for-foreign.rs index 466e2f1665ec0..4e7dcd6221ac5 100644 --- a/tests/ui/coherence/impl[t]-foreign[local_fundamental[t]]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[local_fundamental[t]]-for-foreign.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs index c23a2d87a695c..ddd7e2f5c7c25 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr index a1f3936497e65..afcc9bc0d9083 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-foreign.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-foreign.rs:10:6 + --> $DIR/impl[t]-foreign[t]-for-foreign.rs:12:6 | LL | impl Remote1 for u32 { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs index e9426e5127a04..f5f4096095b16 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr index 80fb5dbec8662..d9871e8b00d8e 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-fundamental.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:10:6 + --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:12:6 | LL | impl Remote1 for Box { | ^ type parameter `T` must be used as the type parameter for some local type @@ -8,7 +8,7 @@ LL | impl Remote1 for Box { = note: only traits defined in the current crate can be implemented for a type parameter error[E0210]: type parameter `B` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:14:13 + --> $DIR/impl[t]-foreign[t]-for-fundamental.rs:16:13 | LL | impl<'a, A, B> Remote1 for &'a B { | ^ type parameter `B` must be used as the type parameter for some local type diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-local.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-local.rs index 2976df3d41e66..71dfbe1715924 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-local.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-local.rs @@ -2,6 +2,8 @@ //@ aux-build:coherence_lib.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs b/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs index 9c3e82ad762f0..0eaf840291e9f 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-t.rs @@ -1,6 +1,8 @@ //@ compile-flags:--crate-name=test //@ aux-build:coherence_lib.rs +#![allow(unconstructable_pub_struct)] + extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; diff --git a/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr b/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr index acd84f7115f57..f20ca06d82f84 100644 --- a/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr +++ b/tests/ui/coherence/impl[t]-foreign[t]-for-t.stderr @@ -1,5 +1,5 @@ error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) - --> $DIR/impl[t]-foreign[t]-for-t.rs:10:6 + --> $DIR/impl[t]-foreign[t]-for-t.rs:12:6 | LL | impl Remote1 for T { | ^ type parameter `T` must be used as the type parameter for some local type diff --git a/tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs b/tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs index 1bfd7c3465613..22855a6b4559d 100644 --- a/tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs +++ b/tests/ui/const-generics/adt_const_params/auxiliary/unsized_const_param.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![feature(adt_const_params, unsized_const_params)] #[derive(std::marker::ConstParamTy, Eq, PartialEq)] diff --git a/tests/ui/const-generics/adt_const_params/unsized_field-1.rs b/tests/ui/const-generics/adt_const_params/unsized_field-1.rs index 5db031cb900fc..5db50a0b1c0dc 100644 --- a/tests/ui/const-generics/adt_const_params/unsized_field-1.rs +++ b/tests/ui/const-generics/adt_const_params/unsized_field-1.rs @@ -1,4 +1,6 @@ //@ aux-build:unsized_const_param.rs +#![allow(unconstructable_pub_struct)] + #![feature(adt_const_params)] extern crate unsized_const_param; diff --git a/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr b/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr index 134dbba0d63ab..fb7f229e3f5e2 100644 --- a/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr +++ b/tests/ui/const-generics/adt_const_params/unsized_field-1.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type - --> $DIR/unsized_field-1.rs:8:10 + --> $DIR/unsized_field-1.rs:10:10 | LL | #[derive(ConstParamTy, Eq, PartialEq)] | ^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | struct A([u8]); | ---- this field does not implement `ConstParamTy_` | note: the `ConstParamTy_` impl for `[u8]` requires that `feature(unsized_const_params) is enabled` - --> $DIR/unsized_field-1.rs:10:10 + --> $DIR/unsized_field-1.rs:12:10 | LL | struct A([u8]); | ^^^^ error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type - --> $DIR/unsized_field-1.rs:12:10 + --> $DIR/unsized_field-1.rs:14:10 | LL | #[derive(ConstParamTy, Eq, PartialEq)] | ^^^^^^^^^^^^ @@ -23,13 +23,13 @@ LL | struct B(&'static [u8]); | ------------- this field does not implement `ConstParamTy_` | note: the `ConstParamTy_` impl for `&'static [u8]` requires that `feature(unsized_const_params) is enabled` - --> $DIR/unsized_field-1.rs:14:10 + --> $DIR/unsized_field-1.rs:16:10 | LL | struct B(&'static [u8]); | ^^^^^^^^^^^^^ error[E0204]: the trait `ConstParamTy_` cannot be implemented for this type - --> $DIR/unsized_field-1.rs:19:10 + --> $DIR/unsized_field-1.rs:21:10 | LL | #[derive(std::marker::ConstParamTy, Eq, PartialEq)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>); | ---------------------------------------------------------- this field does not implement `ConstParamTy_` | note: the `ConstParamTy_` impl for `GenericNotUnsizedParam<&'static [u8]>` requires that `feature(unsized_const_params) is enabled` - --> $DIR/unsized_field-1.rs:21:10 + --> $DIR/unsized_field-1.rs:23:10 | LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/const-generics/auxiliary/generics_of_parent.rs b/tests/ui/const-generics/auxiliary/generics_of_parent.rs index 5009fe4698534..d28775187692f 100644 --- a/tests/ui/const-generics/auxiliary/generics_of_parent.rs +++ b/tests/ui/const-generics/auxiliary/generics_of_parent.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![feature(generic_const_exprs)] // library portion of regression test for #87674 diff --git a/tests/ui/const-generics/defaults/auxiliary/trait_object_lt_defaults_lib.rs b/tests/ui/const-generics/defaults/auxiliary/trait_object_lt_defaults_lib.rs index 26a2c47ffb26d..42fc4a8c0a573 100644 --- a/tests/ui/const-generics/defaults/auxiliary/trait_object_lt_defaults_lib.rs +++ b/tests/ui/const-generics/defaults/auxiliary/trait_object_lt_defaults_lib.rs @@ -1 +1,3 @@ +#![allow(unconstructable_pub_struct)] + pub struct Foo<'a, const N: usize, T: 'a + ?Sized>(pub &'a T, [(); N]); diff --git a/tests/ui/const-generics/defaults/trait_object_lt_defaults.rs b/tests/ui/const-generics/defaults/trait_object_lt_defaults.rs index da25c0146c543..a6565ca34e134 100644 --- a/tests/ui/const-generics/defaults/trait_object_lt_defaults.rs +++ b/tests/ui/const-generics/defaults/trait_object_lt_defaults.rs @@ -1,5 +1,7 @@ //@ aux-build:trait_object_lt_defaults_lib.rs //@ run-pass +#![allow(unconstructable_pub_struct)] + #![allow(dead_code, unused)] extern crate trait_object_lt_defaults_lib; diff --git a/tests/ui/const-generics/generic_const_exprs/associated-consts.rs b/tests/ui/const-generics/generic_const_exprs/associated-consts.rs index 5d2198f50ad92..230e95d87bcab 100644 --- a/tests/ui/const-generics/generic_const_exprs/associated-consts.rs +++ b/tests/ui/const-generics/generic_const_exprs/associated-consts.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(unconstructable_pub_struct)] + #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/const-generics/parent_generics_of_encoding.rs b/tests/ui/const-generics/parent_generics_of_encoding.rs index 1f9c8c5bc75a1..78b9e7b2fe9c3 100644 --- a/tests/ui/const-generics/parent_generics_of_encoding.rs +++ b/tests/ui/const-generics/parent_generics_of_encoding.rs @@ -1,5 +1,7 @@ //@ aux-build:generics_of_parent.rs //@ check-pass +#![allow(unconstructable_pub_struct)] + #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs b/tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs index 4f8b3508398f2..8d7ac83a5ed7a 100644 --- a/tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs +++ b/tests/ui/cross-crate/auxiliary/xcrate_unit_struct.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![crate_type = "lib"] // used by the rpass test diff --git a/tests/ui/cross-crate/unit-struct-2.rs b/tests/ui/cross-crate/unit-struct-2.rs index 2177a8800db1a..18da7c9cf30e3 100644 --- a/tests/ui/cross-crate/unit-struct-2.rs +++ b/tests/ui/cross-crate/unit-struct-2.rs @@ -1,5 +1,7 @@ //@ run-pass //@ aux-build:xcrate_unit_struct.rs +#![allow(unconstructable_pub_struct)] + #![allow(non_upper_case_globals)] extern crate xcrate_unit_struct; diff --git a/tests/ui/cross-crate/unit-struct.rs b/tests/ui/cross-crate/unit-struct.rs index 1517f843eff31..a37db234ca324 100644 --- a/tests/ui/cross-crate/unit-struct.rs +++ b/tests/ui/cross-crate/unit-struct.rs @@ -3,6 +3,8 @@ // Make sure that when we have cross-crate unit structs we don't accidentally // make values out of cross-crate structs that aren't unit. +#![allow(unconstructable_pub_struct)] + extern crate xcrate_unit_struct; fn main() { diff --git a/tests/ui/cross-crate/unit-struct.stderr b/tests/ui/cross-crate/unit-struct.stderr index a7e3e4685a997..090416a1025dd 100644 --- a/tests/ui/cross-crate/unit-struct.stderr +++ b/tests/ui/cross-crate/unit-struct.stderr @@ -1,21 +1,21 @@ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields` - --> $DIR/unit-struct.rs:9:13 + --> $DIR/unit-struct.rs:11:13 | LL | let _ = xcrate_unit_struct::StructWithFields; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }` | - ::: $DIR/auxiliary/xcrate_unit_struct.rs:20:1 + ::: $DIR/auxiliary/xcrate_unit_struct.rs:22:1 | LL | pub struct StructWithFields { | --------------------------- `xcrate_unit_struct::StructWithFields` defined here error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithPrivFields` - --> $DIR/unit-struct.rs:11:13 + --> $DIR/unit-struct.rs:13:13 | LL | let _ = xcrate_unit_struct::StructWithPrivFields; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - ::: $DIR/auxiliary/xcrate_unit_struct.rs:25:1 + ::: $DIR/auxiliary/xcrate_unit_struct.rs:27:1 | LL | pub struct StructWithPrivFields { | ------------------------------- `xcrate_unit_struct::StructWithPrivFields` defined here diff --git a/tests/ui/deriving/issue-58319.rs b/tests/ui/deriving/issue-58319.rs index 0e847a5b54d4e..44ac19d46fbd4 100644 --- a/tests/ui/deriving/issue-58319.rs +++ b/tests/ui/deriving/issue-58319.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(unconstructable_pub_struct)] + fn main() {} #[derive(Clone)] pub struct Little; diff --git a/tests/ui/extern/auxiliary/fat_drop.rs b/tests/ui/extern/auxiliary/fat_drop.rs index 768d29876b971..0764e613fd4af 100644 --- a/tests/ui/extern/auxiliary/fat_drop.rs +++ b/tests/ui/extern/auxiliary/fat_drop.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + pub static mut DROPPED: bool = false; pub struct S { diff --git a/tests/ui/extern/extern_fat_drop.rs b/tests/ui/extern/extern_fat_drop.rs index 9691f562d8992..40b38c44adb0a 100644 --- a/tests/ui/extern/extern_fat_drop.rs +++ b/tests/ui/extern/extern_fat_drop.rs @@ -1,6 +1,8 @@ //@ run-pass //@ aux-build:fat_drop.rs +#![allow(unconstructable_pub_struct)] + extern crate fat_drop; fn main() { diff --git a/tests/ui/issues/auxiliary/issue-31702-2.rs b/tests/ui/issues/auxiliary/issue-31702-2.rs index 16300b0f5d530..61bf15808f960 100644 --- a/tests/ui/issues/auxiliary/issue-31702-2.rs +++ b/tests/ui/issues/auxiliary/issue-31702-2.rs @@ -1,5 +1,7 @@ //@ compile-flags: -g +#![allow(unconstructable_pub_struct)] + extern crate issue_31702_1; use std::collections::HashMap; diff --git a/tests/ui/issues/issue-31702.rs b/tests/ui/issues/issue-31702.rs index 1cf01f7f04ecc..f788a20c902d8 100644 --- a/tests/ui/issues/issue-31702.rs +++ b/tests/ui/issues/issue-31702.rs @@ -4,6 +4,8 @@ // this test is actually entirely in the linked library crates +#![allow(unconstructable_pub_struct)] + extern crate issue_31702_1; extern crate issue_31702_2; diff --git a/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr b/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr index 77c8d1eab5845..506791fd17269 100644 --- a/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr +++ b/tests/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr @@ -413,3 +413,21 @@ note: the lint level is defined here LL | #![forbid(forbidden_lint_groups)] | ^^^^^^^^^^^^^^^^^^^^^ +Future breakage diagnostic: +error: warn(unused) incompatible with previous forbid + --> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:22:13 + | +LL | #![forbid(unused)] + | ------ `forbid` level set here +LL | #![deny(unused)] +LL | #![warn(unused)] + | ^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 +note: the lint level is defined here + --> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11 + | +LL | #![forbid(forbidden_lint_groups)] + | ^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/lint/outer-forbid.stderr b/tests/ui/lint/outer-forbid.stderr index 64a1077462abe..7810ca223f8ad 100644 --- a/tests/ui/lint/outer-forbid.stderr +++ b/tests/ui/lint/outer-forbid.stderr @@ -453,3 +453,21 @@ note: the lint level is defined here LL | #![forbid(forbidden_lint_groups)] | ^^^^^^^^^^^^^^^^^^^^^ +Future breakage diagnostic: +error: allow(unused) incompatible with previous forbid + --> $DIR/outer-forbid.rs:25:9 + | +LL | #![forbid(unused, non_snake_case)] + | ------ `forbid` level set here +... +LL | #[allow(unused)] + | ^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 +note: the lint level is defined here + --> $DIR/outer-forbid.rs:18:11 + | +LL | #![forbid(forbidden_lint_groups)] + | ^^^^^^^^^^^^^^^^^^^^^ + diff --git a/tests/ui/packed/auxiliary/packed.rs b/tests/ui/packed/auxiliary/packed.rs index cba166facf4f2..bea79a520ecce 100644 --- a/tests/ui/packed/auxiliary/packed.rs +++ b/tests/ui/packed/auxiliary/packed.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #[repr(packed)] pub struct P1S5 { a: u8, diff --git a/tests/ui/packed/packed-struct-size-xc.rs b/tests/ui/packed/packed-struct-size-xc.rs index a9c95d73d561f..30bfc26536a2b 100644 --- a/tests/ui/packed/packed-struct-size-xc.rs +++ b/tests/ui/packed/packed-struct-size-xc.rs @@ -2,6 +2,8 @@ //@ aux-build:packed.rs +#![allow(unconstructable_pub_struct)] + extern crate packed; use std::mem; diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed index 40028307a8cb1..4e35a07d95758 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed @@ -1,6 +1,8 @@ // Regression test for issues #100790 and #106439. //@ run-rustfix +#![allow(unconstructable_pub_struct)] + #![allow(dead_code)] pub struct Example(usize) diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs index d8dbb4238d206..643e96009cae1 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs @@ -1,6 +1,8 @@ // Regression test for issues #100790 and #106439. //@ run-rustfix +#![allow(unconstructable_pub_struct)] + #![allow(dead_code)] pub struct Example diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr index 66dadd9fd4c24..4865b69cd1d27 100644 --- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr +++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr @@ -1,5 +1,5 @@ error: where clauses are not allowed before tuple struct bodies - --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:7:1 + --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:9:1 | LL | pub struct Example | ------- while parsing this tuple struct @@ -17,7 +17,7 @@ LL ~ (): Sized; | error: where clauses are not allowed before tuple struct bodies - --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:13:1 + --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:15:1 | LL | struct _Demo | ----- while parsing this tuple struct diff --git a/tests/ui/pattern/usefulness/auxiliary/empty.rs b/tests/ui/pattern/usefulness/auxiliary/empty.rs index 29a03c9e8b50c..f800192c42ac3 100644 --- a/tests/ui/pattern/usefulness/auxiliary/empty.rs +++ b/tests/ui/pattern/usefulness/auxiliary/empty.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![crate_type = "rlib"] pub enum EmptyForeignEnum {} diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr index 4a435bcc8bad9..aef7b9b291187 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.exhaustive_patterns.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:17:9 + --> $DIR/empty-match-check-notes.rs:19:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-match-check-notes.rs:7:9 + --> $DIR/empty-match-check-notes.rs:9:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:22:9 + --> $DIR/empty-match-check-notes.rs:24:9 | LL | _ if false => {} | ^--------------- @@ -26,7 +26,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:31:9 + --> $DIR/empty-match-check-notes.rs:33:9 | LL | _ => {} | ^------ @@ -37,7 +37,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:36:9 + --> $DIR/empty-match-check-notes.rs:38:9 | LL | _ if false => {} | ^--------------- @@ -48,7 +48,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:43:9 + --> $DIR/empty-match-check-notes.rs:45:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -63,7 +63,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:53:11 + --> $DIR/empty-match-check-notes.rs:55:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr index 4a435bcc8bad9..aef7b9b291187 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.normal.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:17:9 + --> $DIR/empty-match-check-notes.rs:19:9 | LL | _ => {} | ^------ @@ -9,13 +9,13 @@ LL | _ => {} | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/empty-match-check-notes.rs:7:9 + --> $DIR/empty-match-check-notes.rs:9:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:22:9 + --> $DIR/empty-match-check-notes.rs:24:9 | LL | _ if false => {} | ^--------------- @@ -26,7 +26,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:31:9 + --> $DIR/empty-match-check-notes.rs:33:9 | LL | _ => {} | ^------ @@ -37,7 +37,7 @@ LL | _ => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/empty-match-check-notes.rs:36:9 + --> $DIR/empty-match-check-notes.rs:38:9 | LL | _ if false => {} | ^--------------- @@ -48,7 +48,7 @@ LL | _ if false => {} = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error[E0005]: refutable pattern in local binding - --> $DIR/empty-match-check-notes.rs:43:9 + --> $DIR/empty-match-check-notes.rs:45:9 | LL | let None = *x; | ^^^^ pattern `Some(_)` not covered @@ -63,7 +63,7 @@ LL | if let None = *x { todo!() }; | ++ +++++++++++ error[E0004]: non-exhaustive patterns: `0_u8..=u8::MAX` not covered - --> $DIR/empty-match-check-notes.rs:53:11 + --> $DIR/empty-match-check-notes.rs:55:11 | LL | match 0u8 { | ^^^ pattern `0_u8..=u8::MAX` not covered diff --git a/tests/ui/pattern/usefulness/empty-match-check-notes.rs b/tests/ui/pattern/usefulness/empty-match-check-notes.rs index 48d20fd2d5c1b..105a53cb92171 100644 --- a/tests/ui/pattern/usefulness/empty-match-check-notes.rs +++ b/tests/ui/pattern/usefulness/empty-match-check-notes.rs @@ -2,6 +2,8 @@ //@ revisions: normal exhaustive_patterns // // This tests a match with no arms on various types, and checks NOTEs. +#![allow(unconstructable_pub_struct)] + #![feature(never_type)] #![cfg_attr(exhaustive_patterns, feature(exhaustive_patterns))] #![deny(unreachable_patterns)] diff --git a/tests/ui/pattern/usefulness/uninhabited.rs b/tests/ui/pattern/usefulness/uninhabited.rs index 2e2c7cae65cbc..6e12c5c16f2b8 100644 --- a/tests/ui/pattern/usefulness/uninhabited.rs +++ b/tests/ui/pattern/usefulness/uninhabited.rs @@ -4,6 +4,8 @@ // // This tests plays with matching and uninhabited types. This also serves as a test for the // `Ty::is_inhabited_from` function. +#![allow(unconstructable_pub_struct)] + #![feature(never_type)] #![deny(unreachable_patterns)] diff --git a/tests/ui/privacy/auxiliary/privacy_tuple_struct.rs b/tests/ui/privacy/auxiliary/privacy_tuple_struct.rs index 223cda4b23628..b913de05133e5 100644 --- a/tests/ui/privacy/auxiliary/privacy_tuple_struct.rs +++ b/tests/ui/privacy/auxiliary/privacy_tuple_struct.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + pub struct A(()); pub struct B(isize); pub struct C(pub isize, isize); diff --git a/tests/ui/privacy/auxiliary/private-inferred-type.rs b/tests/ui/privacy/auxiliary/private-inferred-type.rs index 7ac913f5b5bd5..adeb9411ac997 100644 --- a/tests/ui/privacy/auxiliary/private-inferred-type.rs +++ b/tests/ui/privacy/auxiliary/private-inferred-type.rs @@ -1,4 +1,5 @@ #![feature(decl_macro)] +#![allow(unconstructable_pub_struct)] fn priv_fn() {} static PRIV_STATIC: u8 = 0; diff --git a/tests/ui/privacy/privacy5.stderr b/tests/ui/privacy/privacy5.stderr index ec3abe9b81629..7c769d18fa55e 100644 --- a/tests/ui/privacy/privacy5.stderr +++ b/tests/ui/privacy/privacy5.stderr @@ -460,13 +460,13 @@ error[E0603]: tuple struct constructor `A` is private LL | let a = other::A(()); | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -477,13 +477,13 @@ error[E0603]: tuple struct constructor `B` is private LL | let b = other::B(2); | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -494,13 +494,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let c = other::C(2, 3); | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -511,13 +511,13 @@ error[E0603]: tuple struct constructor `A` is private LL | let other::A(()) = a; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -528,13 +528,13 @@ error[E0603]: tuple struct constructor `A` is private LL | let other::A(_) = a; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -545,13 +545,13 @@ error[E0603]: tuple struct constructor `A` is private LL | match a { other::A(()) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -562,13 +562,13 @@ error[E0603]: tuple struct constructor `A` is private LL | match a { other::A(_) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -579,13 +579,13 @@ error[E0603]: tuple struct constructor `B` is private LL | let other::B(_) = b; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -596,13 +596,13 @@ error[E0603]: tuple struct constructor `B` is private LL | let other::B(_b) = b; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -613,13 +613,13 @@ error[E0603]: tuple struct constructor `B` is private LL | match b { other::B(_) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -630,13 +630,13 @@ error[E0603]: tuple struct constructor `B` is private LL | match b { other::B(_b) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -647,13 +647,13 @@ error[E0603]: tuple struct constructor `B` is private LL | match b { other::B(1) => {} | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -664,13 +664,13 @@ error[E0603]: tuple struct constructor `B` is private LL | other::B(_) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -681,13 +681,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let other::C(_, _) = c; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -698,13 +698,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let other::C(_a, _) = c; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -715,13 +715,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let other::C(_, _b) = c; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -732,13 +732,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let other::C(_a, _b) = c; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -749,13 +749,13 @@ error[E0603]: tuple struct constructor `C` is private LL | match c { other::C(_, _) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -766,13 +766,13 @@ error[E0603]: tuple struct constructor `C` is private LL | match c { other::C(_a, _) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -783,13 +783,13 @@ error[E0603]: tuple struct constructor `C` is private LL | match c { other::C(_, _b) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -800,13 +800,13 @@ error[E0603]: tuple struct constructor `C` is private LL | match c { other::C(_a, _b) => {} } | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ @@ -817,13 +817,13 @@ error[E0603]: tuple struct constructor `A` is private LL | let a2 = other::A; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:1:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 | LL | pub struct A(()); | -- a constructor is private if any of the fields is private | note: the tuple struct constructor `A` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:1:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 | LL | pub struct A(()); | ^^^^^^^^^^^^ @@ -834,13 +834,13 @@ error[E0603]: tuple struct constructor `B` is private LL | let b2 = other::B; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:2:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:4:14 | LL | pub struct B(isize); | ----- a constructor is private if any of the fields is private | note: the tuple struct constructor `B` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:2:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:4:1 | LL | pub struct B(isize); | ^^^^^^^^^^^^ @@ -851,13 +851,13 @@ error[E0603]: tuple struct constructor `C` is private LL | let c2 = other::C; | ^ private tuple struct constructor | - ::: $DIR/auxiliary/privacy_tuple_struct.rs:3:14 + ::: $DIR/auxiliary/privacy_tuple_struct.rs:5:14 | LL | pub struct C(pub isize, isize); | ---------------- a constructor is private if any of the fields is private | note: the tuple struct constructor `C` is defined here - --> $DIR/auxiliary/privacy_tuple_struct.rs:3:1 + --> $DIR/auxiliary/privacy_tuple_struct.rs:5:1 | LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^ diff --git a/tests/ui/pub/pub-ident-struct-4.fixed b/tests/ui/pub/pub-ident-struct-4.fixed index 5fedbb7243749..f721137642210 100644 --- a/tests/ui/pub/pub-ident-struct-4.fixed +++ b/tests/ui/pub/pub-ident-struct-4.fixed @@ -1,5 +1,7 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + pub struct T(#[allow(dead_code)] String); //~^ ERROR missing `struct` for struct definition diff --git a/tests/ui/pub/pub-ident-struct-4.rs b/tests/ui/pub/pub-ident-struct-4.rs index 5c721c25a7815..eef5823225f09 100644 --- a/tests/ui/pub/pub-ident-struct-4.rs +++ b/tests/ui/pub/pub-ident-struct-4.rs @@ -1,5 +1,7 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + pub T(#[allow(dead_code)] String); //~^ ERROR missing `struct` for struct definition diff --git a/tests/ui/pub/pub-ident-struct-4.stderr b/tests/ui/pub/pub-ident-struct-4.stderr index 04965a1a73720..bd502cebb7cc0 100644 --- a/tests/ui/pub/pub-ident-struct-4.stderr +++ b/tests/ui/pub/pub-ident-struct-4.stderr @@ -1,5 +1,5 @@ error: missing `struct` for struct definition - --> $DIR/pub-ident-struct-4.rs:3:1 + --> $DIR/pub-ident-struct-4.rs:5:1 | LL | pub T(#[allow(dead_code)] String); | ^^^^^ diff --git a/tests/ui/reachable/auxiliary/foreign-priv-aux.rs b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs index 10dc086146139..fdb1db8def660 100644 --- a/tests/ui/reachable/auxiliary/foreign-priv-aux.rs +++ b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + trait PrivTrait { fn priv_fn(&self); } diff --git a/tests/ui/reachable/foreign-priv.rs b/tests/ui/reachable/foreign-priv.rs index 438d480a0b652..c7181e8c773cf 100644 --- a/tests/ui/reachable/foreign-priv.rs +++ b/tests/ui/reachable/foreign-priv.rs @@ -1,6 +1,8 @@ //@ aux-build:foreign-priv-aux.rs //@ build-pass +#![allow(unconstructable_pub_struct)] + #![crate_type = "lib"] extern crate foreign_priv_aux; diff --git a/tests/ui/regions/regions-issue-21422.rs b/tests/ui/regions/regions-issue-21422.rs index 25f5d0f50139f..ff6445900381e 100644 --- a/tests/ui/regions/regions-issue-21422.rs +++ b/tests/ui/regions/regions-issue-21422.rs @@ -4,6 +4,8 @@ // should outlive the binary operation itself. +#![allow(unconstructable_pub_struct)] + pub struct P<'a> { _ptr: *const &'a u8, } diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs index e1799761b6961..c943b9a644dfb 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/auxiliary/uninhabited.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![crate_type = "rlib"] #![feature(never_type)] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs index 4804d34a920ca..0d6ee901c120c 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr index c209caab5ecb6..91f183efc5d8d 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/coercions.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coercions.rs:23:5 + --> $DIR/coercions.rs:25:5 | LL | fn cannot_coerce_empty_enum_to_anything(x: UninhabitedEnum) -> A { | - expected `A` because of return type @@ -7,7 +7,7 @@ LL | x | ^ expected `A`, found `UninhabitedEnum` error[E0308]: mismatched types - --> $DIR/coercions.rs:27:5 + --> $DIR/coercions.rs:29:5 | LL | fn cannot_coerce_empty_tuple_struct_to_anything(x: UninhabitedTupleStruct) -> A { | - expected `A` because of return type @@ -15,7 +15,7 @@ LL | x | ^ expected `A`, found `UninhabitedTupleStruct` error[E0308]: mismatched types - --> $DIR/coercions.rs:31:5 + --> $DIR/coercions.rs:33:5 | LL | fn cannot_coerce_empty_struct_to_anything(x: UninhabitedStruct) -> A { | - expected `A` because of return type @@ -23,7 +23,7 @@ LL | x | ^ expected `A`, found `UninhabitedStruct` error[E0308]: mismatched types - --> $DIR/coercions.rs:35:5 + --> $DIR/coercions.rs:37:5 | LL | fn cannot_coerce_enum_with_empty_variants_to_anything(x: UninhabitedVariants) -> A { | - expected `A` because of return type diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs index c7a7c927c0c23..b191718f702a1 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr index f332e6deeb82c..c0862ee1fb1ae 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty - --> $DIR/indirect_match.rs:19:11 + --> $DIR/indirect_match.rs:21:11 | LL | match x {} | ^ | note: `IndirectUninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:32:1 + --> $DIR/auxiliary/uninhabited.rs:34:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty - --> $DIR/indirect_match.rs:23:11 + --> $DIR/indirect_match.rs:25:11 | LL | match x {} | ^ | note: `IndirectUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:34:1 + --> $DIR/auxiliary/uninhabited.rs:36:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty - --> $DIR/indirect_match.rs:27:11 + --> $DIR/indirect_match.rs:29:11 | LL | match x {} | ^ | note: `IndirectUninhabitedTupleStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:36:1 + --> $DIR/auxiliary/uninhabited.rs:38:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,13 +56,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty - --> $DIR/indirect_match.rs:33:11 + --> $DIR/indirect_match.rs:35:11 | LL | match x {} | ^ | note: `IndirectUninhabitedVariants` defined here - --> $DIR/auxiliary/uninhabited.rs:38:1 + --> $DIR/auxiliary/uninhabited.rs:40:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs index dd9a570522a26..867dba101d38f 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![deny(unreachable_patterns)] #![feature(never_type)] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr index 48f3857bfa7f8..9bf8823d002ce 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/indirect_match_with_exhaustive_patterns.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedEnum` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:22:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:24:11 | LL | match x {} | ^ | note: `IndirectUninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:32:1 + --> $DIR/auxiliary/uninhabited.rs:34:1 | LL | pub struct IndirectUninhabitedEnum(UninhabitedEnum); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedStruct` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:26:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:28:11 | LL | match x {} | ^ | note: `IndirectUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:34:1 + --> $DIR/auxiliary/uninhabited.rs:36:1 | LL | pub struct IndirectUninhabitedStruct(UninhabitedStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,13 +37,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedTupleStruct` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:30:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:32:11 | LL | match x {} | ^ | note: `IndirectUninhabitedTupleStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:36:1 + --> $DIR/auxiliary/uninhabited.rs:38:1 | LL | pub struct IndirectUninhabitedTupleStruct(UninhabitedTupleStruct); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -56,13 +56,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `IndirectUninhabitedVariants` is non-empty - --> $DIR/indirect_match_with_exhaustive_patterns.rs:36:11 + --> $DIR/indirect_match_with_exhaustive_patterns.rs:38:11 | LL | match x {} | ^ | note: `IndirectUninhabitedVariants` defined here - --> $DIR/auxiliary/uninhabited.rs:38:1 + --> $DIR/auxiliary/uninhabited.rs:40:1 | LL | pub struct IndirectUninhabitedVariants(UninhabitedVariants); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs index ca7c528715420..105640c3908da 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![deny(unreachable_patterns)] #![feature(never_type)] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr index 86df9ef9b564c..dead69dea2d99 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/issue-65157-repeated-match-arm.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/issue-65157-repeated-match-arm.rs:15:9 + --> $DIR/issue-65157-repeated-match-arm.rs:17:9 | LL | PartiallyInhabitedVariants::Struct { .. } => {} | ----------------------------------------- matches all the relevant values @@ -7,7 +7,7 @@ LL | PartiallyInhabitedVariants::Struct { .. } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this | note: the lint level is defined here - --> $DIR/issue-65157-repeated-match-arm.rs:2:9 + --> $DIR/issue-65157-repeated-match-arm.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs index 58d7bbd2c1730..1557ff06f7bb7 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![feature(never_type)] extern crate uninhabited; diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr index 0232e7106aab7..b8af903cff5ec 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `uninhabited::UninhabitedEnum` is non-empty - --> $DIR/match.rs:14:11 + --> $DIR/match.rs:16:11 | LL | match x {} | ^ | note: `uninhabited::UninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:5:1 + --> $DIR/auxiliary/uninhabited.rs:7:1 | LL | pub enum UninhabitedEnum { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -18,13 +18,13 @@ LL ~ } | error[E0004]: non-exhaustive patterns: type `uninhabited::PrivatelyUninhabitedStruct` is non-empty - --> $DIR/match.rs:22:11 + --> $DIR/match.rs:24:11 | LL | match x {} | ^ | note: `uninhabited::PrivatelyUninhabitedStruct` defined here - --> $DIR/auxiliary/uninhabited.rs:15:1 + --> $DIR/auxiliary/uninhabited.rs:17:1 | LL | pub struct PrivatelyUninhabitedStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs index c214581549cd7..f9a0367d27fe6 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![deny(unreachable_patterns)] #![feature(never_type)] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr index d6f0bc724a98d..5492cdd7f740b 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/match_with_exhaustive_patterns.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: type `UninhabitedEnum` is non-empty - --> $DIR/match_with_exhaustive_patterns.rs:17:11 + --> $DIR/match_with_exhaustive_patterns.rs:19:11 | LL | match x {} | ^ | note: `UninhabitedEnum` defined here - --> $DIR/auxiliary/uninhabited.rs:5:1 + --> $DIR/auxiliary/uninhabited.rs:7:1 | LL | pub enum UninhabitedEnum { | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs index 088331b0e7f72..976b191fb8fa7 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.rs @@ -1,4 +1,6 @@ //@ aux-build:uninhabited.rs +#![allow(unconstructable_pub_struct)] + #![feature(exhaustive_patterns)] #![deny(unreachable_patterns)] diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.stderr index 1bb07fd06713c..4af883ca6f057 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/uninhabited/patterns.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/patterns.rs:42:9 + --> $DIR/patterns.rs:44:9 | LL | Some(_x) => (), | ^^^^^^^^------- @@ -9,13 +9,13 @@ LL | Some(_x) => (), | = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types note: the lint level is defined here - --> $DIR/patterns.rs:3:9 + --> $DIR/patterns.rs:5:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/patterns.rs:47:15 + --> $DIR/patterns.rs:49:15 | LL | while let PartiallyInhabitedVariants::Struct { x, .. } = partially_inhabited_variant() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ matches no values because `!` is uninhabited @@ -23,7 +23,7 @@ LL | while let PartiallyInhabitedVariants::Struct { x, .. } = partially_inha = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/patterns.rs:49:15 + --> $DIR/patterns.rs:51:15 | LL | while let Some(_x) = uninhabited_struct() { | ^^^^^^^^ matches no values because `UninhabitedStruct` is uninhabited @@ -31,7 +31,7 @@ LL | while let Some(_x) = uninhabited_struct() { = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types error: unreachable pattern - --> $DIR/patterns.rs:52:15 + --> $DIR/patterns.rs:54:15 | LL | while let Some(_x) = uninhabited_tuple_struct() { | ^^^^^^^^ matches no values because `UninhabitedTupleStruct` is uninhabited diff --git a/tests/ui/rfcs/rfc-2093-infer-outlives/privacy.rs b/tests/ui/rfcs/rfc-2093-infer-outlives/privacy.rs index c6ce001806d1b..f0fece0cd4c5d 100644 --- a/tests/ui/rfcs/rfc-2093-infer-outlives/privacy.rs +++ b/tests/ui/rfcs/rfc-2093-infer-outlives/privacy.rs @@ -5,6 +5,8 @@ // //@ run-pass +#![allow(unconstructable_pub_struct)] + #![allow(dead_code)] pub struct Foo<'a> { diff --git a/tests/ui/static/auxiliary/nested_item.rs b/tests/ui/static/auxiliary/nested_item.rs index 9db9d19d6f610..a573101eeb673 100644 --- a/tests/ui/static/auxiliary/nested_item.rs +++ b/tests/ui/static/auxiliary/nested_item.rs @@ -1,4 +1,6 @@ // original problem +#![allow(unconstructable_pub_struct)] + pub fn foo() -> isize { { static foo: isize = 2; diff --git a/tests/ui/static/nested_item_main.rs b/tests/ui/static/nested_item_main.rs index 6793d8eae1b2f..0a69d446d73fa 100644 --- a/tests/ui/static/nested_item_main.rs +++ b/tests/ui/static/nested_item_main.rs @@ -2,6 +2,8 @@ //@ aux-build:nested_item.rs +#![allow(unconstructable_pub_struct)] + extern crate nested_item; pub fn main() { diff --git a/tests/ui/structs-enums/newtype-struct-with-dtor.rs b/tests/ui/structs-enums/newtype-struct-with-dtor.rs index 35476c5ed2d6b..0d24c3fe4c9ca 100644 --- a/tests/ui/structs-enums/newtype-struct-with-dtor.rs +++ b/tests/ui/structs-enums/newtype-struct-with-dtor.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(unconstructable_pub_struct)] + #![allow(unused_unsafe)] #![allow(unused_variables)] diff --git a/tests/ui/structs-enums/uninstantiable-struct.rs b/tests/ui/structs-enums/uninstantiable-struct.rs index 97bc7d8414e7f..e3233199ee69e 100644 --- a/tests/ui/structs-enums/uninstantiable-struct.rs +++ b/tests/ui/structs-enums/uninstantiable-struct.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(unconstructable_pub_struct)] + pub struct Z(#[allow(dead_code)] &'static Z); pub fn main() {} diff --git a/tests/ui/structs/auxiliary/struct_field_privacy.rs b/tests/ui/structs/auxiliary/struct_field_privacy.rs index 9765af1a7f652..45520aeaac186 100644 --- a/tests/ui/structs/auxiliary/struct_field_privacy.rs +++ b/tests/ui/structs/auxiliary/struct_field_privacy.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + pub struct A { a: isize, pub b: isize, diff --git a/tests/ui/structs/auxiliary/struct_variant_privacy.rs b/tests/ui/structs/auxiliary/struct_variant_privacy.rs index 425ec0e96d338..06d8c0112fb78 100644 --- a/tests/ui/structs/auxiliary/struct_variant_privacy.rs +++ b/tests/ui/structs/auxiliary/struct_variant_privacy.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + enum Bar { Baz { a: isize } } diff --git a/tests/ui/structs/struct-field-privacy.rs b/tests/ui/structs/struct-field-privacy.rs index d70dd5c700500..a2f7d2d3ad9a8 100644 --- a/tests/ui/structs/struct-field-privacy.rs +++ b/tests/ui/structs/struct-field-privacy.rs @@ -1,5 +1,7 @@ //@ aux-build:struct_field_privacy.rs +#![allow(unconstructable_pub_struct)] + extern crate struct_field_privacy as xc; struct A { diff --git a/tests/ui/structs/struct-field-privacy.stderr b/tests/ui/structs/struct-field-privacy.stderr index ee83e0d6c2de7..858975dfa3c8e 100644 --- a/tests/ui/structs/struct-field-privacy.stderr +++ b/tests/ui/structs/struct-field-privacy.stderr @@ -1,29 +1,29 @@ error[E0616]: field `a` of struct `inner::A` is private - --> $DIR/struct-field-privacy.rs:23:7 + --> $DIR/struct-field-privacy.rs:25:7 | LL | b.a; | ^ private field error[E0616]: field `b` of struct `inner::B` is private - --> $DIR/struct-field-privacy.rs:26:7 + --> $DIR/struct-field-privacy.rs:28:7 | LL | c.b; | ^ private field error[E0616]: field `a` of struct `xc::A` is private - --> $DIR/struct-field-privacy.rs:28:7 + --> $DIR/struct-field-privacy.rs:30:7 | LL | d.a; | ^ private field error[E0616]: field `b` of struct `xc::B` is private - --> $DIR/struct-field-privacy.rs:32:7 + --> $DIR/struct-field-privacy.rs:34:7 | LL | e.b; | ^ private field error[E0616]: field `1` of struct `Z` is private - --> $DIR/struct-field-privacy.rs:35:7 + --> $DIR/struct-field-privacy.rs:37:7 | LL | z.1; | ^ private field diff --git a/tests/ui/structs/struct-variant-privacy-xc.stderr b/tests/ui/structs/struct-variant-privacy-xc.stderr index 7a1c84badeff2..d2c4ac42726b0 100644 --- a/tests/ui/structs/struct-variant-privacy-xc.stderr +++ b/tests/ui/structs/struct-variant-privacy-xc.stderr @@ -5,7 +5,7 @@ LL | fn f(b: struct_variant_privacy::Bar) { | ^^^ private enum | note: the enum `Bar` is defined here - --> $DIR/auxiliary/struct_variant_privacy.rs:1:1 + --> $DIR/auxiliary/struct_variant_privacy.rs:3:1 | LL | enum Bar { | ^^^^^^^^ @@ -19,7 +19,7 @@ LL | struct_variant_privacy::Bar::Baz { a: _a } => {} | private enum | note: the enum `Bar` is defined here - --> $DIR/auxiliary/struct_variant_privacy.rs:1:1 + --> $DIR/auxiliary/struct_variant_privacy.rs:3:1 | LL | enum Bar { | ^^^^^^^^ diff --git a/tests/ui/structs/suggest-private-fields.rs b/tests/ui/structs/suggest-private-fields.rs index b3bae58a6e413..865b7ff125722 100644 --- a/tests/ui/structs/suggest-private-fields.rs +++ b/tests/ui/structs/suggest-private-fields.rs @@ -1,5 +1,7 @@ //@ aux-build:struct_field_privacy.rs +#![allow(unconstructable_pub_struct)] + extern crate struct_field_privacy as xc; use xc::B; diff --git a/tests/ui/structs/suggest-private-fields.stderr b/tests/ui/structs/suggest-private-fields.stderr index adf90f0e1fd65..7b3bbb58d1115 100644 --- a/tests/ui/structs/suggest-private-fields.stderr +++ b/tests/ui/structs/suggest-private-fields.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `B` has no field named `aa` - --> $DIR/suggest-private-fields.rs:15:9 + --> $DIR/suggest-private-fields.rs:17:9 | LL | aa: 20, | ^^ unknown field @@ -11,7 +11,7 @@ LL + a: 20, | error[E0560]: struct `B` has no field named `bb` - --> $DIR/suggest-private-fields.rs:17:9 + --> $DIR/suggest-private-fields.rs:19:9 | LL | bb: 20, | ^^ `B` does not have this field @@ -19,7 +19,7 @@ LL | bb: 20, = note: available fields are: `a` error[E0560]: struct `A` has no field named `aa` - --> $DIR/suggest-private-fields.rs:22:9 + --> $DIR/suggest-private-fields.rs:24:9 | LL | aa: 20, | ^^ unknown field @@ -31,7 +31,7 @@ LL + a: 20, | error[E0560]: struct `A` has no field named `bb` - --> $DIR/suggest-private-fields.rs:24:9 + --> $DIR/suggest-private-fields.rs:26:9 | LL | bb: 20, | ^^ unknown field diff --git a/tests/ui/suggestions/derive-clone-for-eq.fixed b/tests/ui/suggestions/derive-clone-for-eq.fixed index 4dc362f947875..885a8b78b2b32 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.fixed +++ b/tests/ui/suggestions/derive-clone-for-eq.fixed @@ -1,6 +1,8 @@ //@ run-rustfix // https://github.com/rust-lang/rust/issues/79076 +#![allow(unconstructable_pub_struct)] + #[derive(Clone, Eq)] //~ ERROR [E0277] pub struct Struct(T); diff --git a/tests/ui/suggestions/derive-clone-for-eq.rs b/tests/ui/suggestions/derive-clone-for-eq.rs index b3635000f1658..7e0be58f13ccb 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.rs +++ b/tests/ui/suggestions/derive-clone-for-eq.rs @@ -1,6 +1,8 @@ //@ run-rustfix // https://github.com/rust-lang/rust/issues/79076 +#![allow(unconstructable_pub_struct)] + #[derive(Clone, Eq)] //~ ERROR [E0277] pub struct Struct(T); diff --git a/tests/ui/suggestions/derive-clone-for-eq.stderr b/tests/ui/suggestions/derive-clone-for-eq.stderr index eb0355853daac..f2a357cee1f06 100644 --- a/tests/ui/suggestions/derive-clone-for-eq.stderr +++ b/tests/ui/suggestions/derive-clone-for-eq.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: Clone` is not satisfied - --> $DIR/derive-clone-for-eq.rs:4:17 + --> $DIR/derive-clone-for-eq.rs:6:17 | LL | #[derive(Clone, Eq)] | ^^ the trait `Clone` is not implemented for `T` | note: required for `Struct` to implement `PartialEq` - --> $DIR/derive-clone-for-eq.rs:7:19 + --> $DIR/derive-clone-for-eq.rs:9:19 | LL | impl PartialEq for Struct | ----- ^^^^^^^^^^^^ ^^^^^^^^^ diff --git a/tests/ui/suggestions/option-content-move.fixed b/tests/ui/suggestions/option-content-move.fixed index 4a5a9483c20c8..0857d515a3f8f 100644 --- a/tests/ui/suggestions/option-content-move.fixed +++ b/tests/ui/suggestions/option-content-move.fixed @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + pub struct LipogramCorpora { selections: Vec<(char, Option)>, } diff --git a/tests/ui/suggestions/option-content-move.rs b/tests/ui/suggestions/option-content-move.rs index 90d05c7439970..56a8b14700562 100644 --- a/tests/ui/suggestions/option-content-move.rs +++ b/tests/ui/suggestions/option-content-move.rs @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(unconstructable_pub_struct)] + pub struct LipogramCorpora { selections: Vec<(char, Option)>, } diff --git a/tests/ui/suggestions/option-content-move.stderr b/tests/ui/suggestions/option-content-move.stderr index a382a04344aeb..3a913a6fe724e 100644 --- a/tests/ui/suggestions/option-content-move.stderr +++ b/tests/ui/suggestions/option-content-move.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of `selection.1` which is behind a shared reference - --> $DIR/option-content-move.rs:10:20 + --> $DIR/option-content-move.rs:12:20 | LL | if selection.1.unwrap().contains(selection.0) { | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call @@ -19,7 +19,7 @@ LL | if selection.1.clone().unwrap().contains(selection.0) { | ++++++++ error[E0507]: cannot move out of `selection.1` which is behind a shared reference - --> $DIR/option-content-move.rs:28:20 + --> $DIR/option-content-move.rs:30:20 | LL | if selection.1.unwrap().contains(selection.0) { | ^^^^^^^^^^^ -------- `selection.1` moved due to this method call diff --git a/tests/ui/traits/object/generics.rs b/tests/ui/traits/object/generics.rs index 462b0bc5bb77f..c7bd3c8abc245 100644 --- a/tests/ui/traits/object/generics.rs +++ b/tests/ui/traits/object/generics.rs @@ -1,6 +1,8 @@ //@ run-pass // test for #8664 +#![allow(unconstructable_pub_struct)] + use std::marker; pub trait Trait2 { diff --git a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs index 3c823d3e5d279..eaaa451f19b70 100644 --- a/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs +++ b/tests/ui/type-alias-impl-trait/auxiliary/drop-shim-relates-opaque-aux.rs @@ -1,6 +1,7 @@ // crate foo #![feature(type_alias_impl_trait)] +#![allow(unconstructable_pub_struct)] type Tait = impl Sized; #[define_opaque(Tait)] diff --git a/tests/ui/typeck/auxiliary/tdticc_coherence_lib.rs b/tests/ui/typeck/auxiliary/tdticc_coherence_lib.rs index ef2cd415fcaaa..46994688d541d 100644 --- a/tests/ui/typeck/auxiliary/tdticc_coherence_lib.rs +++ b/tests/ui/typeck/auxiliary/tdticc_coherence_lib.rs @@ -1,3 +1,5 @@ +#![allow(unconstructable_pub_struct)] + #![feature(auto_traits, core)] #![crate_type = "rlib"] diff --git a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs index ce0b60b64119f..591a99a78c37f 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs +++ b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs @@ -3,6 +3,8 @@ // Test that we do not consider associated types to be sendable without // some applicable trait bound (and we don't ICE). +#![allow(unconstructable_pub_struct)] + #![feature(negative_impls)] extern crate tdticc_coherence_lib as lib; diff --git a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr index c7d714dcb1adb..77b35ea491e38 100644 --- a/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr +++ b/tests/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr @@ -1,5 +1,5 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:15:1 | LL | impl DefaultedTrait for (A,) {} | ^^^^^^^^^^^^^^^^^^^^^^^^---- @@ -11,7 +11,7 @@ LL | impl DefaultedTrait for (A,) {} = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:18:1 | LL | impl !DefaultedTrait for (B,) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^---- @@ -23,13 +23,13 @@ LL | impl !DefaultedTrait for (B,) {} = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:20:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:22:1 | LL | impl DefaultedTrait for Box {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate error[E0117]: only traits defined in the current crate can be implemented for types defined outside of the crate - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:23:1 | LL | impl DefaultedTrait for lib::Something {} | ^^^^^^^^^^^^^^^^^^^^^^^^-----------------