Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 702badc

Browse files
authoredMar 9, 2025··
Unrolled build for rust-lang#136968
Rollup merge of rust-lang#136968 - oli-obk:bye-bye, r=compiler-errors Turn order dependent trait objects future incompat warning into a hard error fixes rust-lang#56484 r? ``@ghost`` will FCP when we have a crater result
2 parents 4f52199 + 8f6b184 commit 702badc

File tree

13 files changed

+38
-330
lines changed

13 files changed

+38
-330
lines changed
 

‎compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ declare_lint_pass! {
7373
NEVER_TYPE_FALLBACK_FLOWING_INTO_UNSAFE,
7474
NON_CONTIGUOUS_RANGE_ENDPOINTS,
7575
NON_EXHAUSTIVE_OMITTED_PATTERNS,
76-
ORDER_DEPENDENT_TRAIT_OBJECTS,
7776
OUT_OF_SCOPE_MACRO_CALLS,
7877
OVERLAPPING_RANGE_ENDPOINTS,
7978
PATTERNS_IN_FNS_WITHOUT_BODY,
@@ -1501,42 +1500,6 @@ declare_lint! {
15011500
};
15021501
}
15031502

1504-
declare_lint! {
1505-
/// The `order_dependent_trait_objects` lint detects a trait coherency
1506-
/// violation that would allow creating two trait impls for the same
1507-
/// dynamic trait object involving marker traits.
1508-
///
1509-
/// ### Example
1510-
///
1511-
/// ```rust,compile_fail
1512-
/// pub trait Trait {}
1513-
///
1514-
/// impl Trait for dyn Send + Sync { }
1515-
/// impl Trait for dyn Sync + Send { }
1516-
/// ```
1517-
///
1518-
/// {{produces}}
1519-
///
1520-
/// ### Explanation
1521-
///
1522-
/// A previous bug caused the compiler to interpret traits with different
1523-
/// orders (such as `Send + Sync` and `Sync + Send`) as distinct types
1524-
/// when they were intended to be treated the same. This allowed code to
1525-
/// define separate trait implementations when there should be a coherence
1526-
/// error. This is a [future-incompatible] lint to transition this to a
1527-
/// hard error in the future. See [issue #56484] for more details.
1528-
///
1529-
/// [issue #56484]: https://github.com/rust-lang/rust/issues/56484
1530-
/// [future-incompatible]: ../index.md#future-incompatible-lints
1531-
pub ORDER_DEPENDENT_TRAIT_OBJECTS,
1532-
Deny,
1533-
"trait-object types were treated as different depending on marker-trait order",
1534-
@future_incompatible = FutureIncompatibleInfo {
1535-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps,
1536-
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
1537-
};
1538-
}
1539-
15401503
declare_lint! {
15411504
/// The `coherence_leak_check` lint detects conflicting implementations of
15421505
/// a trait that are only distinguished by the old leak-check code.

‎compiler/rustc_middle/src/query/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -999,12 +999,6 @@ rustc_queries! {
999999
separate_provide_extern
10001000
}
10011001

1002-
query self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
1003-
key: DefId
1004-
) -> Option<ty::EarlyBinder<'tcx, ty::Ty<'tcx>>> {
1005-
desc { |tcx| "computing self type wrt issue #33140 `{}`", tcx.def_path_str(key) }
1006-
}
1007-
10081002
/// Maps a `DefId` of a type to a list of its inherent impls.
10091003
/// Contains implementations of methods that are inherent to a type.
10101004
/// Methods in these implementations don't need to be exported.

‎compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,39 +1414,6 @@ pub enum ImplOverlapKind {
14141414
/// Whether or not the impl is permitted due to the trait being a `#[marker]` trait
14151415
marker: bool,
14161416
},
1417-
/// These impls are allowed to overlap, but that raises an
1418-
/// issue #33140 future-compatibility warning (tracked in #56484).
1419-
///
1420-
/// Some background: in Rust 1.0, the trait-object types `Send + Sync` (today's
1421-
/// `dyn Send + Sync`) and `Sync + Send` (now `dyn Sync + Send`) were different.
1422-
///
1423-
/// The widely-used version 0.1.0 of the crate `traitobject` had accidentally relied on
1424-
/// that difference, doing what reduces to the following set of impls:
1425-
///
1426-
/// ```compile_fail,(E0119)
1427-
/// trait Trait {}
1428-
/// impl Trait for dyn Send + Sync {}
1429-
/// impl Trait for dyn Sync + Send {}
1430-
/// ```
1431-
///
1432-
/// Obviously, once we made these types be identical, that code causes a coherence
1433-
/// error and a fairly big headache for us. However, luckily for us, the trait
1434-
/// `Trait` used in this case is basically a marker trait, and therefore having
1435-
/// overlapping impls for it is sound.
1436-
///
1437-
/// To handle this, we basically regard the trait as a marker trait, with an additional
1438-
/// future-compatibility warning. To avoid accidentally "stabilizing" this feature,
1439-
/// it has the following restrictions:
1440-
///
1441-
/// 1. The trait must indeed be a marker-like trait (i.e., no items), and must be
1442-
/// positive impls.
1443-
/// 2. The trait-ref of both impls must be equal.
1444-
/// 3. The trait-ref of both impls must be a trait object type consisting only of
1445-
/// marker traits.
1446-
/// 4. Neither of the impls can have any where-clauses.
1447-
///
1448-
/// Once `traitobject` 0.1.0 is no longer an active concern, this hack can be removed.
1449-
FutureCompatOrderDepTraitObjects,
14501417
}
14511418

14521419
/// Useful source information about where a desugared associated type for an
@@ -1624,7 +1591,7 @@ impl<'tcx> TyCtxt<'tcx> {
16241591
})
16251592
}
16261593

1627-
/// Returns `true` if the impls are the same polarity and the trait either
1594+
/// Returns `Some` if the impls are the same polarity and the trait either
16281595
/// has no items or is annotated `#[marker]` and prevents item overrides.
16291596
#[instrument(level = "debug", skip(self), ret)]
16301597
pub fn impls_are_allowed_to_overlap(
@@ -1665,18 +1632,6 @@ impl<'tcx> TyCtxt<'tcx> {
16651632
return Some(ImplOverlapKind::Permitted { marker: true });
16661633
}
16671634

1668-
if let Some(self_ty1) =
1669-
self.self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(def_id1)
1670-
&& let Some(self_ty2) =
1671-
self.self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(def_id2)
1672-
{
1673-
if self_ty1 == self_ty2 {
1674-
return Some(ImplOverlapKind::FutureCompatOrderDepTraitObjects);
1675-
} else {
1676-
debug!("found {self_ty1:?} != {self_ty2:?}");
1677-
}
1678-
}
1679-
16801635
None
16811636
}
16821637

‎compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,9 +1925,9 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
19251925
let mut impl_candidate = None;
19261926
for c in impls {
19271927
if let Some(prev) = impl_candidate.replace(c) {
1928-
if self.prefer_lhs_over_victim(has_non_region_infer, c, prev) {
1928+
if self.prefer_lhs_over_victim(has_non_region_infer, c, prev.0) {
19291929
// Ok, prefer `c` over the previous entry
1930-
} else if self.prefer_lhs_over_victim(has_non_region_infer, prev, c) {
1930+
} else if self.prefer_lhs_over_victim(has_non_region_infer, prev, c.0) {
19311931
// Ok, keep `prev` instead of the new entry
19321932
impl_candidate = Some(prev);
19331933
} else {
@@ -1986,7 +1986,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
19861986
&self,
19871987
has_non_region_infer: bool,
19881988
(lhs, lhs_evaluation): (DefId, EvaluationResult),
1989-
(victim, victim_evaluation): (DefId, EvaluationResult),
1989+
victim: DefId,
19901990
) -> bool {
19911991
let tcx = self.tcx();
19921992
// See if we can toss out `victim` based on specialization.
@@ -2002,14 +2002,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
20022002
}
20032003

20042004
match tcx.impls_are_allowed_to_overlap(lhs, victim) {
2005-
// For #33140 the impl headers must be exactly equal, the trait must not have
2006-
// any associated items and there are no where-clauses.
2007-
//
2008-
// We can just arbitrarily drop one of the impls.
2009-
Some(ty::ImplOverlapKind::FutureCompatOrderDepTraitObjects) => {
2010-
assert_eq!(lhs_evaluation, victim_evaluation);
2011-
true
2012-
}
20132005
// For candidates which already reference errors it doesn't really
20142006
// matter what we do 🤷
20152007
Some(ty::ImplOverlapKind::Permitted { marker: false }) => {

‎compiler/rustc_trait_selection/src/traits/specialize/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_middle::bug;
2020
use rustc_middle::query::LocalCrate;
2121
use rustc_middle::ty::print::PrintTraitRefExt as _;
2222
use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt, TypingMode};
23-
use rustc_session::lint::builtin::{COHERENCE_LEAK_CHECK, ORDER_DEPENDENT_TRAIT_OBJECTS};
23+
use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;
2424
use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, sym};
2525
use rustc_type_ir::solve::NoSolution;
2626
use specialization_graph::GraphExt;
@@ -557,13 +557,9 @@ fn report_conflicting_impls<'tcx>(
557557

558558
let msg = || {
559559
format!(
560-
"conflicting implementations of trait `{}`{}{}",
560+
"conflicting implementations of trait `{}`{}",
561561
overlap.trait_ref.print_trait_sugared(),
562562
overlap.self_ty.map_or_else(String::new, |ty| format!(" for type `{ty}`")),
563-
match used_to_be_allowed {
564-
Some(FutureCompatOverlapErrorKind::OrderDepTraitObjects) => ": (E0119)",
565-
_ => "",
566-
}
567563
)
568564
};
569565

@@ -588,7 +584,6 @@ fn report_conflicting_impls<'tcx>(
588584
}
589585
Some(kind) => {
590586
let lint = match kind {
591-
FutureCompatOverlapErrorKind::OrderDepTraitObjects => ORDER_DEPENDENT_TRAIT_OBJECTS,
592587
FutureCompatOverlapErrorKind::LeakCheck => COHERENCE_LEAK_CHECK,
593588
};
594589
tcx.node_span_lint(lint, tcx.local_def_id_to_hir_id(impl_def_id), impl_span, |err| {

‎compiler/rustc_trait_selection/src/traits/specialize/specialization_graph.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::traits;
1212

1313
#[derive(Copy, Clone, Debug)]
1414
pub enum FutureCompatOverlapErrorKind {
15-
OrderDepTraitObjects,
1615
LeakCheck,
1716
}
1817

@@ -151,12 +150,6 @@ impl<'tcx> Children {
151150
{
152151
match overlap_kind {
153152
ty::ImplOverlapKind::Permitted { marker: _ } => {}
154-
ty::ImplOverlapKind::FutureCompatOrderDepTraitObjects => {
155-
*last_lint_mut = Some(FutureCompatOverlapError {
156-
error: create_overlap_error(overlap),
157-
kind: FutureCompatOverlapErrorKind::OrderDepTraitObjects,
158-
});
159-
}
160153
}
161154

162155
return Ok((false, false));

‎compiler/rustc_ty_utils/src/ty.rs

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ use rustc_index::bit_set::DenseBitSet;
66
use rustc_middle::bug;
77
use rustc_middle::query::Providers;
88
use rustc_middle::ty::fold::fold_regions;
9-
use rustc_middle::ty::{
10-
self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, Upcast,
11-
};
9+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, Upcast};
1210
use rustc_span::DUMMY_SP;
1311
use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
1412
use rustc_trait_selection::traits;
15-
use tracing::{debug, instrument};
13+
use tracing::instrument;
1614

1715
#[instrument(level = "debug", skip(tcx), ret)]
1816
fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'tcx>> {
@@ -260,57 +258,6 @@ fn param_env_normalized_for_post_analysis(tcx: TyCtxt<'_>, def_id: DefId) -> ty:
260258
typing_env.with_post_analysis_normalized(tcx).param_env
261259
}
262260

263-
/// If the given trait impl enables exploiting the former order dependence of trait objects,
264-
/// returns its self type; otherwise, returns `None`.
265-
///
266-
/// See [`ty::ImplOverlapKind::FutureCompatOrderDepTraitObjects`] for more details.
267-
#[instrument(level = "debug", skip(tcx))]
268-
fn self_ty_of_trait_impl_enabling_order_dep_trait_object_hack(
269-
tcx: TyCtxt<'_>,
270-
def_id: DefId,
271-
) -> Option<EarlyBinder<'_, Ty<'_>>> {
272-
let impl_ =
273-
tcx.impl_trait_header(def_id).unwrap_or_else(|| bug!("called on inherent impl {def_id:?}"));
274-
275-
let trait_ref = impl_.trait_ref.skip_binder();
276-
debug!(?trait_ref);
277-
278-
let is_marker_like = impl_.polarity == ty::ImplPolarity::Positive
279-
&& tcx.associated_item_def_ids(trait_ref.def_id).is_empty();
280-
281-
// Check whether these impls would be ok for a marker trait.
282-
if !is_marker_like {
283-
debug!("not marker-like!");
284-
return None;
285-
}
286-
287-
// impl must be `impl Trait for dyn Marker1 + Marker2 + ...`
288-
if trait_ref.args.len() != 1 {
289-
debug!("impl has args!");
290-
return None;
291-
}
292-
293-
let predicates = tcx.predicates_of(def_id);
294-
if predicates.parent.is_some() || !predicates.predicates.is_empty() {
295-
debug!(?predicates, "impl has predicates!");
296-
return None;
297-
}
298-
299-
let self_ty = trait_ref.self_ty();
300-
let self_ty_matches = match self_ty.kind() {
301-
ty::Dynamic(data, re, _) if re.is_static() => data.principal().is_none(),
302-
_ => false,
303-
};
304-
305-
if self_ty_matches {
306-
debug!("MATCHES!");
307-
Some(EarlyBinder::bind(self_ty))
308-
} else {
309-
debug!("non-matching self type");
310-
None
311-
}
312-
}
313-
314261
/// Check if a function is async.
315262
fn asyncness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Asyncness {
316263
let node = tcx.hir_node_by_def_id(def_id);
@@ -370,7 +317,6 @@ pub(crate) fn provide(providers: &mut Providers) {
370317
adt_sized_constraint,
371318
param_env,
372319
param_env_normalized_for_post_analysis,
373-
self_ty_of_trait_impl_enabling_order_dep_trait_object_hack,
374320
defaultness,
375321
unsizing_params_for_adt,
376322
..*providers

‎tests/ui/lint/lint-incoherent-auto-trait-objects.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ impl Foo for dyn Send {}
44

55
impl Foo for dyn Send + Send {}
66
//~^ ERROR conflicting implementations
7-
//~| hard error
87

98
impl Foo for dyn Send + Sync {}
109

1110
impl Foo for dyn Sync + Send {}
1211
//~^ ERROR conflicting implementations
13-
//~| hard error
1412

1513
impl Foo for dyn Send + Sync + Send {}
1614
//~^ ERROR conflicting implementations
17-
//~| hard error
1815

1916
fn main() {}
Lines changed: 7 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,30 @@
1-
error: conflicting implementations of trait `Foo` for type `(dyn Send + 'static)`: (E0119)
1+
error[E0119]: conflicting implementations of trait `Foo` for type `(dyn Send + 'static)`
22
--> $DIR/lint-incoherent-auto-trait-objects.rs:5:1
33
|
44
LL | impl Foo for dyn Send {}
55
| --------------------- first implementation here
66
LL |
77
LL | impl Foo for dyn Send + Send {}
88
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
9-
|
10-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
12-
= note: `#[deny(order_dependent_trait_objects)]` on by default
139

14-
error: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`: (E0119)
15-
--> $DIR/lint-incoherent-auto-trait-objects.rs:11:1
10+
error[E0119]: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`
11+
--> $DIR/lint-incoherent-auto-trait-objects.rs:10:1
1612
|
1713
LL | impl Foo for dyn Send + Sync {}
1814
| ---------------------------- first implementation here
1915
LL |
2016
LL | impl Foo for dyn Sync + Send {}
2117
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
22-
|
23-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
24-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
2518

26-
error: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`: (E0119)
27-
--> $DIR/lint-incoherent-auto-trait-objects.rs:15:1
19+
error[E0119]: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`
20+
--> $DIR/lint-incoherent-auto-trait-objects.rs:13:1
2821
|
29-
LL | impl Foo for dyn Sync + Send {}
22+
LL | impl Foo for dyn Send + Sync {}
3023
| ---------------------------- first implementation here
3124
...
3225
LL | impl Foo for dyn Send + Sync + Send {}
3326
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
34-
|
35-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
36-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
3727

3828
error: aborting due to 3 previous errors
3929

40-
Future incompatibility report: Future breakage diagnostic:
41-
error: conflicting implementations of trait `Foo` for type `(dyn Send + 'static)`: (E0119)
42-
--> $DIR/lint-incoherent-auto-trait-objects.rs:5:1
43-
|
44-
LL | impl Foo for dyn Send {}
45-
| --------------------- first implementation here
46-
LL |
47-
LL | impl Foo for dyn Send + Send {}
48-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
49-
|
50-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
51-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
52-
= note: `#[deny(order_dependent_trait_objects)]` on by default
53-
54-
Future breakage diagnostic:
55-
error: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`: (E0119)
56-
--> $DIR/lint-incoherent-auto-trait-objects.rs:11:1
57-
|
58-
LL | impl Foo for dyn Send + Sync {}
59-
| ---------------------------- first implementation here
60-
LL |
61-
LL | impl Foo for dyn Sync + Send {}
62-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
63-
|
64-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
65-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
66-
= note: `#[deny(order_dependent_trait_objects)]` on by default
67-
68-
Future breakage diagnostic:
69-
error: conflicting implementations of trait `Foo` for type `(dyn Send + Sync + 'static)`: (E0119)
70-
--> $DIR/lint-incoherent-auto-trait-objects.rs:15:1
71-
|
72-
LL | impl Foo for dyn Sync + Send {}
73-
| ---------------------------- first implementation here
74-
...
75-
LL | impl Foo for dyn Send + Sync + Send {}
76-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
77-
|
78-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
80-
= note: `#[deny(order_dependent_trait_objects)]` on by default
81-
30+
For more information about this error, try `rustc --explain E0119`.

‎tests/ui/traits/issue-33140-hack-boundaries.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(negative_impls)]
2-
#![allow(order_dependent_trait_objects)]
32

43
// Check that the issue #33140 hack does not allow unintended things.
54

@@ -8,6 +7,7 @@ trait Trait0 {}
87

98
impl Trait0 for dyn Send {}
109
impl Trait0 for dyn Send {}
10+
//~^ ERROR: E0119
1111

1212
// Problem 1: associated types
1313
trait Trait1 {

‎tests/ui/traits/issue-33140-hack-boundaries.stderr

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
error[E0119]: conflicting implementations of trait `Trait0` for type `(dyn Send + 'static)`
2+
--> $DIR/issue-33140-hack-boundaries.rs:9:1
3+
|
4+
LL | impl Trait0 for dyn Send {}
5+
| ------------------------ first implementation here
6+
LL | impl Trait0 for dyn Send {}
7+
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
8+
19
error[E0119]: conflicting implementations of trait `Trait1` for type `(dyn Send + 'static)`
210
--> $DIR/issue-33140-hack-boundaries.rs:18:1
311
|
@@ -62,19 +70,7 @@ LL | impl Trait5 for dyn Send {}
6270
LL | impl Trait5 for dyn Send where u32: Copy {}
6371
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
6472

65-
error: aborting due to 8 previous errors
73+
error: aborting due to 9 previous errors
6674

6775
Some errors have detailed explanations: E0119, E0751.
6876
For more information about an error, try `rustc --explain E0119`.
69-
Future incompatibility report: Future breakage diagnostic:
70-
warning: conflicting implementations of trait `Trait0` for type `(dyn Send + 'static)`: (E0119)
71-
--> $DIR/issue-33140-hack-boundaries.rs:10:1
72-
|
73-
LL | impl Trait0 for dyn Send {}
74-
| ------------------------ first implementation here
75-
LL | impl Trait0 for dyn Send {}
76-
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + 'static)`
77-
|
78-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
79-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
80-

‎tests/ui/traits/object/issue-33140-traitobject-crate.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
//@ check-pass
2-
3-
#![warn(order_dependent_trait_objects)]
41
#![allow(dyn_drop)]
52

63
// Check that traitobject 0.1.0 compiles
@@ -84,15 +81,12 @@ unsafe impl<T> Trait for dyn (::std::iter::Iterator<Item=T>) + Send + Sync { }
8481
unsafe impl Trait for dyn (::std::marker::Send) + Send { }
8582
unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
8683
unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
87-
//~^ WARNING conflicting implementations of trait `Trait` for type
88-
//~| WARNING this was previously accepted by the compiler but is being phased out
84+
//~^ ERROR conflicting implementations of trait `Trait` for type
8985
unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
90-
//~^ WARNING conflicting implementations of trait `Trait` for type
91-
//~| WARNING this was previously accepted by the compiler but is being phased out
86+
//~^ ERROR conflicting implementations of trait `Trait` for type
9287
unsafe impl Trait for dyn (::std::marker::Sync) + Sync { }
9388
unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
94-
//~^ WARNING conflicting implementations of trait `Trait` for type
95-
//~| WARNING this was previously accepted by the compiler but is being phased out
89+
//~^ ERROR conflicting implementations of trait `Trait` for type
9690
unsafe impl Trait for dyn (::std::ops::Drop) + Send { }
9791
unsafe impl Trait for dyn (::std::ops::Drop) + Sync { }
9892
unsafe impl Trait for dyn (::std::ops::Drop) + Send + Sync { }
Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,29 @@
1-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
2-
--> $DIR/issue-33140-traitobject-crate.rs:86:1
1+
error[E0119]: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`
2+
--> $DIR/issue-33140-traitobject-crate.rs:83:1
33
|
44
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
55
| ------------------------------------------------------ first implementation here
66
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
77
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
8-
|
9-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
10-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
11-
note: the lint level is defined here
12-
--> $DIR/issue-33140-traitobject-crate.rs:3:9
13-
|
14-
LL | #![warn(order_dependent_trait_objects)]
15-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16-
17-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
18-
--> $DIR/issue-33140-traitobject-crate.rs:89:1
19-
|
20-
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
21-
| ------------------------------------------------------------- first implementation here
22-
...
23-
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
24-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
25-
|
26-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
28-
29-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
30-
--> $DIR/issue-33140-traitobject-crate.rs:93:1
31-
|
32-
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
33-
| ------------------------------------------------------ first implementation here
34-
...
35-
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
36-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
37-
|
38-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
39-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
40-
41-
warning: 3 warnings emitted
428

43-
Future incompatibility report: Future breakage diagnostic:
44-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
45-
--> $DIR/issue-33140-traitobject-crate.rs:86:1
9+
error[E0119]: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`
10+
--> $DIR/issue-33140-traitobject-crate.rs:85:1
4611
|
4712
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
4813
| ------------------------------------------------------ first implementation here
49-
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
50-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
51-
|
52-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
53-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
54-
note: the lint level is defined here
55-
--> $DIR/issue-33140-traitobject-crate.rs:3:9
56-
|
57-
LL | #![warn(order_dependent_trait_objects)]
58-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59-
60-
Future breakage diagnostic:
61-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
62-
--> $DIR/issue-33140-traitobject-crate.rs:89:1
63-
|
64-
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
65-
| ------------------------------------------------------------- first implementation here
6614
...
6715
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
6816
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
69-
|
70-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
71-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
72-
note: the lint level is defined here
73-
--> $DIR/issue-33140-traitobject-crate.rs:3:9
74-
|
75-
LL | #![warn(order_dependent_trait_objects)]
76-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7717

78-
Future breakage diagnostic:
79-
warning: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`: (E0119)
80-
--> $DIR/issue-33140-traitobject-crate.rs:93:1
18+
error[E0119]: conflicting implementations of trait `Trait` for type `(dyn Send + Sync + 'static)`
19+
--> $DIR/issue-33140-traitobject-crate.rs:88:1
8120
|
82-
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
21+
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
8322
| ------------------------------------------------------ first implementation here
8423
...
8524
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
8625
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Send + Sync + 'static)`
87-
|
88-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
89-
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
90-
note: the lint level is defined here
91-
--> $DIR/issue-33140-traitobject-crate.rs:3:9
92-
|
93-
LL | #![warn(order_dependent_trait_objects)]
94-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9526

27+
error: aborting due to 3 previous errors
28+
29+
For more information about this error, try `rustc --explain E0119`.

0 commit comments

Comments
 (0)
This repository has been archived.