stabilize -Znext-solver=coherence

This commit is contained in:
lcnr 2024-09-21 07:02:51 +00:00
parent 88f311479d
commit 1a9d2d82a5
68 changed files with 347 additions and 329 deletions

View File

@ -666,7 +666,7 @@ fn check_incompatible_features(sess: &Session, features: &Features) {
} }
fn check_new_solver_banned_features(sess: &Session, features: &Features) { fn check_new_solver_banned_features(sess: &Session, features: &Features) {
if !sess.opts.unstable_opts.next_solver.is_some_and(|n| n.globally) { if !sess.opts.unstable_opts.next_solver.globally {
return; return;
} }

View File

@ -810,7 +810,7 @@ macro_rules! tracked {
tracked!(mir_opt_level, Some(4)); tracked!(mir_opt_level, Some(4));
tracked!(move_size_limit, Some(4096)); tracked!(move_size_limit, Some(4096));
tracked!(mutable_noalias, false); tracked!(mutable_noalias, false);
tracked!(next_solver, Some(NextSolverConfig { coherence: true, globally: false })); tracked!(next_solver, NextSolverConfig { coherence: true, globally: true });
tracked!(no_generate_arange_section, true); tracked!(no_generate_arange_section, true);
tracked!(no_jump_tables, true); tracked!(no_jump_tables, true);
tracked!(no_link, true); tracked!(no_link, true);

View File

@ -3128,11 +3128,11 @@ pub fn intrinsic(self, def_id: impl IntoQueryParam<DefId> + Copy) -> Option<ty::
} }
pub fn next_trait_solver_globally(self) -> bool { pub fn next_trait_solver_globally(self) -> bool {
self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally) self.sess.opts.unstable_opts.next_solver.globally
} }
pub fn next_trait_solver_in_coherence(self) -> bool { pub fn next_trait_solver_in_coherence(self) -> bool {
self.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.coherence) self.sess.opts.unstable_opts.next_solver.coherence
} }
pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool { pub fn is_impl_trait_in_trait(self, def_id: DefId) -> bool {

View File

@ -842,6 +842,11 @@ pub struct NextSolverConfig {
/// This is only `true` if `coherence` is also enabled. /// This is only `true` if `coherence` is also enabled.
pub globally: bool, pub globally: bool,
} }
impl Default for NextSolverConfig {
fn default() -> Self {
NextSolverConfig { coherence: true, globally: false }
}
}
#[derive(Clone)] #[derive(Clone)]
pub enum Input { pub enum Input {

View File

@ -403,7 +403,7 @@ mod desc {
pub(crate) const parse_unpretty: &str = "`string` or `string=string`"; pub(crate) const parse_unpretty: &str = "`string` or `string=string`";
pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number"; pub(crate) const parse_treat_err_as_bug: &str = "either no value or a non-negative number";
pub(crate) const parse_next_solver_config: &str = pub(crate) const parse_next_solver_config: &str =
"a comma separated list of solver configurations: `globally` (default), and `coherence`"; "either `globally` (when used without an argument), `coherence` (default) or `no`";
pub(crate) const parse_lto: &str = pub(crate) const parse_lto: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted"; "either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, `fat`, or omitted";
pub(crate) const parse_linker_plugin_lto: &str = pub(crate) const parse_linker_plugin_lto: &str =
@ -1123,27 +1123,16 @@ pub(crate) fn parse_treat_err_as_bug(
} }
} }
pub(crate) fn parse_next_solver_config( pub(crate) fn parse_next_solver_config(slot: &mut NextSolverConfig, v: Option<&str>) -> bool {
slot: &mut Option<NextSolverConfig>,
v: Option<&str>,
) -> bool {
if let Some(config) = v { if let Some(config) = v {
let mut coherence = false; *slot = match config {
let mut globally = true; "no" => NextSolverConfig { coherence: false, globally: false },
for c in config.split(',') { "coherence" => NextSolverConfig { coherence: true, globally: false },
match c { "globally" => NextSolverConfig { coherence: true, globally: true },
"globally" => globally = true, _ => return false,
"coherence" => { };
globally = false;
coherence = true;
}
_ => return false,
}
}
*slot = Some(NextSolverConfig { coherence: coherence || globally, globally });
} else { } else {
*slot = Some(NextSolverConfig { coherence: true, globally: true }); *slot = NextSolverConfig { coherence: true, globally: true };
} }
true true
@ -1914,7 +1903,7 @@ pub(crate) fn parse_mir_include_spans(slot: &mut MirIncludeSpans, v: Option<&str
"the size at which the `large_assignments` lint starts to be emitted"), "the size at which the `large_assignments` lint starts to be emitted"),
mutable_noalias: bool = (true, parse_bool, [TRACKED], mutable_noalias: bool = (true, parse_bool, [TRACKED],
"emit noalias metadata for mutable references (default: yes)"), "emit noalias metadata for mutable references (default: yes)"),
next_solver: Option<NextSolverConfig> = (None, parse_next_solver_config, [TRACKED], next_solver: NextSolverConfig = (NextSolverConfig::default(), parse_next_solver_config, [TRACKED],
"enable and configure the next generation trait solver used by rustc"), "enable and configure the next generation trait solver used by rustc"),
nll_facts: bool = (false, parse_bool, [UNTRACKED], nll_facts: bool = (false, parse_bool, [UNTRACKED],
"dump facts from NLL analysis into side files (default: no)"), "dump facts from NLL analysis into side files (default: no)"),

View File

@ -36,10 +36,8 @@ fn new(infcx: &InferCtxt<'tcx>) -> Box<Self> {
if infcx.next_trait_solver() { if infcx.next_trait_solver() {
Box::new(NextFulfillmentCtxt::new(infcx)) Box::new(NextFulfillmentCtxt::new(infcx))
} else { } else {
let new_solver_globally =
infcx.tcx.sess.opts.unstable_opts.next_solver.map_or(false, |c| c.globally);
assert!( assert!(
!new_solver_globally, !infcx.tcx.next_trait_solver_globally(),
"using old solver even though new solver is enabled globally" "using old solver even though new solver is enabled globally"
); );
Box::new(FulfillmentContext::new(infcx)) Box::new(FulfillmentContext::new(infcx))

View File

@ -1,20 +1,20 @@
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>` error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `<_ as ToOwned>::Owned`
--> $DIR/associated-types-coherence-failure.rs:21:1 --> $DIR/associated-types-coherence-failure.rs:21:1
| |
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned { LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
| ----------------------------------------------------------------------------- first implementation here | ----------------------------------------------------------------------------- first implementation here
... ...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as ToOwned>::Owned`
error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_` error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `<_ as ToOwned>::Owned`
--> $DIR/associated-types-coherence-failure.rs:28:1 --> $DIR/associated-types-coherence-failure.rs:28:1
| |
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned { LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
| ----------------------------------------------------------------------------- first implementation here | ----------------------------------------------------------------------------- first implementation here
... ...
LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned { LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<_ as ToOwned>::Owned`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,30 +0,0 @@
//! used to ICE: #119272
//@ check-pass
#![feature(type_alias_impl_trait)]
mod defining_scope {
use super::*;
pub type Alias<T> = impl Sized;
pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
x
}
}
struct Container<T: Trait<U>, U> {
x: <T as Trait<U>>::Assoc,
}
trait Trait<T> {
type Assoc;
}
impl<T> Trait<T> for T {
type Assoc = Box<u32>;
}
impl<T> Trait<T> for defining_scope::Alias<T> {
type Assoc = usize;
}
fn main() {}

View File

@ -5,6 +5,8 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
| ---------------------------------------------- first implementation here | ---------------------------------------------- first implementation here
LL | impl<'a, T> MyTrait<'a> for &'a T {} LL | impl<'a, T> MyTrait<'a> for &'a T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -5,6 +5,8 @@ LL | impl<'a, T: MyPredicate<'a>> MyTrait<'a> for T {}
| ---------------------------------------------- first implementation here | ---------------------------------------------- first implementation here
LL | impl<'a, T> MyTrait<'a> for &'a T {} LL | impl<'a, T> MyTrait<'a> for &'a T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `MyPredicate<'_>` for type `&_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -5,6 +5,8 @@ LL | impl<T: DerefMut> Foo for T {}
| --------------------------- first implementation here | --------------------------- first implementation here
LL | impl<U> Foo for &U {} LL | impl<U> Foo for &U {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -12,7 +12,6 @@ LL | impl<T> Trait for Box<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>` | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
| |
= note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>` = note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>`
= note: downstream crates may implement trait `WhereBound` for type `<std::boxed::Box<_> as WithAssoc<'a>>::Assoc`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -12,7 +12,7 @@ LL | impl<T> Trait for Box<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>` | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
| |
= note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>` = note: downstream crates may implement trait `WithAssoc<'a>` for type `std::boxed::Box<_>`
= note: downstream crates may implement trait `WhereBound` for type `std::boxed::Box<<std::boxed::Box<_> as WithAssoc<'a>>::Assoc>` = note: downstream crates may implement trait `WhereBound` for type `std::boxed::Box<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -5,6 +5,8 @@ LL | impl<T> Bar for T where T: Foo {}
| ------------------------------ first implementation here | ------------------------------ first implementation here
LL | impl<T> Bar for Box<T> {} LL | impl<T> Bar for Box<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>` | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Box<_>`
|
= note: downstream crates may implement trait `Foo` for type `std::boxed::Box<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -6,6 +6,8 @@ LL | impl<T> Bar for T where T: Foo {}
... ...
LL | impl<T> Bar for &T {} LL | impl<T> Bar for &T {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `Foo` for type `&_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -8,6 +8,7 @@ LL | impl<T: ?Sized> FnMarker for fn(&T) {}
| |
= warning: the behavior may change in a future release = warning: the behavior may change in a future release
= note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105> = note: for more information, see issue #56105 <https://github.com/rust-lang/rust/issues/56105>
= note: downstream crates may implement trait `Marker` for type `&_`
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
note: the lint level is defined here note: the lint level is defined here
--> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11 --> $DIR/negative-coherence-placeholder-region-constraints-on-unification.rs:4:11

View File

@ -1,12 +1,13 @@
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, _)` error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, <_ as Iterator>::Item)`
--> $DIR/normalize-for-errors.rs:17:1 --> $DIR/normalize-for-errors.rs:17:1
| |
LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {} LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {}
| ------------------------------------------------------ first implementation here | ------------------------------------------------------ first implementation here
LL | LL |
LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {} LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, _)` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, <_ as Iterator>::Item)`
| |
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `(MyType,)` in future versions
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions = note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -1,7 +1,3 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
struct MyType; struct MyType;
trait MyTrait<S> {} trait MyTrait<S> {}
@ -18,6 +14,6 @@ impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
//~^ ERROR conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, //~^ ERROR conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>,
//~| NOTE conflicting implementation for `(Box<(MyType,)>, //~| NOTE conflicting implementation for `(Box<(MyType,)>,
//~| NOTE upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions //~| NOTE upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
//[next]~| NOTE upstream crates may add a new impl of trait `std::clone::Clone` for type `std::boxed::Box<(MyType,)>` in future versions //~| NOTE upstream crates may add a new impl of trait `std::clone::Clone` for type `std::boxed::Box<(MyType,)>` in future versions
fn main() {} fn main() {}

View File

@ -0,0 +1,15 @@
error[E0119]: conflicting implementations of trait `MyTrait<_>` for type `(Box<(MyType,)>, <_ as Iterator>::Item)`
--> $DIR/normalize-for-errors.rs:13:1
|
LL | impl<T: Copy, S: Iterator> MyTrait<S> for (T, S::Item) {}
| ------------------------------------------------------ first implementation here
LL |
LL | impl<S: Iterator> MyTrait<S> for (Box<<(MyType,) as Mirror>::Assoc>, S::Item) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(Box<(MyType,)>, <_ as Iterator>::Item)`
|
= note: upstream crates may add a new impl of trait `std::clone::Clone` for type `std::boxed::Box<(MyType,)>` in future versions
= note: upstream crates may add a new impl of trait `std::marker::Copy` for type `std::boxed::Box<(MyType,)>` in future versions
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,12 +1,8 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, !2_0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. } error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)`
--> $DIR/associated-type.rs:31:1 --> $DIR/associated-type.rs:31:1
| |
LL | impl<T> Overlap<T> for T { LL | impl<T> Overlap<T> for T {
@ -16,7 +12,7 @@ LL | / impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T
LL | | LL | |
LL | | where LL | | where
LL | | for<'a> *const T: ToUnit<'a>, LL | | for<'a> *const T: ToUnit<'a>,
| |_________________________________^ conflicting implementation for `for<'a> fn(&'a (), _)` | |_________________________________^ conflicting implementation for `for<'a> fn(&'a (), ())`
| |
= note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details

View File

@ -0,0 +1,12 @@
error[E0119]: conflicting implementations of trait `Trait<_>`
--> $DIR/opaques.rs:27:1
|
LL | impl<T> Trait<T> for T {
| ---------------------- first implementation here
...
LL | impl<T> Trait<T> for defining_scope::Alias<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Trait<_>` error[E0119]: conflicting implementations of trait `Trait<_>`
--> $DIR/opaques.rs:30:1 --> $DIR/opaques.rs:27:1
| |
LL | impl<T> Trait<T> for T { LL | impl<T> Trait<T> for T {
| ---------------------- first implementation here | ---------------------- first implementation here
@ -8,7 +8,7 @@ LL | impl<T> Trait<T> for defining_scope::Alias<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0282]: type annotations needed error[E0282]: type annotations needed
--> $DIR/opaques.rs:13:23 --> $DIR/opaques.rs:10:23
| |
LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> { LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
| ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ^^^^^^^^^^^^^^^^^^^^^^ cannot infer type

View File

@ -1,10 +1,7 @@
//@revisions: old next //@revisions: current next
//@[next] compile-flags: -Znext-solver //@[next] compile-flags: -Znext-solver
// A regression test for #105787 // A regression test for #105787
//@[old] known-bug: #105787
//@[old] check-pass
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
mod defining_scope { mod defining_scope {
use super::*; use super::*;
@ -28,7 +25,7 @@ impl<T> Trait<T> for T {
type Assoc = Box<u32>; type Assoc = Box<u32>;
} }
impl<T> Trait<T> for defining_scope::Alias<T> { impl<T> Trait<T> for defining_scope::Alias<T> {
//[next]~^ ERROR conflicting implementations of trait //~^ ERROR conflicting implementations of trait
type Assoc = usize; type Assoc = usize;
} }

View File

@ -9,19 +9,6 @@ help: indicate the anonymous lifetime
LL | impl<T> ToUnit<'_> for T {} LL | impl<T> ToUnit<'_> for T {}
| ++++ | ++++
error[E0277]: the trait bound `for<'a> (): ToUnit<'a>` is not satisfied error: aborting due to 1 previous error
--> $DIR/skip-reporting-if-references-err.rs:15:29
|
LL | impl Overlap for for<'a> fn(<() as ToUnit<'a>>::Unit) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `()`
error[E0277]: the trait bound `for<'a> (): ToUnit<'a>` is not satisfied For more information about this error, try `rustc --explain E0726`.
--> $DIR/skip-reporting-if-references-err.rs:15:18
|
LL | impl Overlap for for<'a> fn(<() as ToUnit<'a>>::Unit) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `()`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0277, E0726.
For more information about an error, try `rustc --explain E0277`.

View File

@ -1,8 +1,4 @@
// Regression test for #121006. // Regression test for #121006.
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
trait ToUnit<'a> { trait ToUnit<'a> {
type Unit; type Unit;
} }
@ -13,7 +9,5 @@ impl<T> ToUnit for T {}
trait Overlap {} trait Overlap {}
impl<U> Overlap for fn(U) {} impl<U> Overlap for fn(U) {}
impl Overlap for for<'a> fn(<() as ToUnit<'a>>::Unit) {} impl Overlap for for<'a> fn(<() as ToUnit<'a>>::Unit) {}
//[current]~^ ERROR the trait bound `for<'a> (): ToUnit<'a>` is not satisfied
//[current]~| ERROR the trait bound `for<'a> (): ToUnit<'a>` is not satisfied
fn main() {} fn main() {}

View File

@ -0,0 +1,14 @@
error[E0726]: implicit elided lifetime not allowed here
--> $DIR/skip-reporting-if-references-err.rs:6:9
|
LL | impl<T> ToUnit for T {}
| ^^^^^^ expected lifetime parameter
|
help: indicate the anonymous lifetime
|
LL | impl<T> ToUnit<'_> for T {}
| ++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0726`.

View File

@ -1,13 +0,0 @@
error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()`
--> $DIR/super-trait-knowable-1.rs:16:1
|
LL | impl<T, U: Sub<T>> Overlap<T> for U {}
| ----------------------------------- first implementation here
LL | impl<T> Overlap<T> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: downstream crates may implement trait `Sub<_>` for type `()`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -3,10 +3,7 @@
// We therefore elaborate super trait bounds in the implicit negative // We therefore elaborate super trait bounds in the implicit negative
// overlap check. // overlap check.
//@ revisions: current next //@ check-pass
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
trait Super {} trait Super {}
trait Sub<T>: Super {} trait Sub<T>: Super {}
@ -14,6 +11,5 @@ trait Sub<T>: Super {}
trait Overlap<T> {} trait Overlap<T> {}
impl<T, U: Sub<T>> Overlap<T> for U {} impl<T, U: Sub<T>> Overlap<T> for U {}
impl<T> Overlap<T> for () {} impl<T> Overlap<T> for () {}
//[current]~^ ERROR conflicting implementations
fn main() {} fn main() {}

View File

@ -1,13 +0,0 @@
error[E0119]: conflicting implementations of trait `Overlap<_>` for type `()`
--> $DIR/super-trait-knowable-3.rs:19:1
|
LL | impl<T, U: Bound<W<T>>> Overlap<T> for U {}
| ---------------------------------------- first implementation here
LL | impl<T> Overlap<T> for () {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
|
= note: downstream crates may implement trait `Sub<_>` for type `()`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -2,10 +2,7 @@
// super trait bound is in a nested goal so this would not // super trait bound is in a nested goal so this would not
// compile if we were to only elaborate root goals. // compile if we were to only elaborate root goals.
//@ revisions: current next //@ check-pass
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
trait Super {} trait Super {}
trait Sub<T>: Super {} trait Sub<T>: Super {}
@ -17,6 +14,5 @@ impl<T: Sub<U>, U> Bound<W<U>> for T {}
trait Overlap<T> {} trait Overlap<T> {}
impl<T, U: Bound<W<T>>> Overlap<T> for U {} impl<T, U: Bound<W<T>>> Overlap<T> for U {}
impl<T> Overlap<T> for () {} impl<T> Overlap<T> for () {}
//[current]~^ ERROR conflicting implementations of trait `Overlap<_>` for type `()`
fn main() {} fn main() {}

View File

@ -22,6 +22,7 @@ pub struct v17<const v10: usize, const v7: v11> {
impl v17<512, v0> { impl v17<512, v0> {
pub const fn v21() -> v18 {} pub const fn v21() -> v18 {}
//~^ ERROR cannot find type `v18` in this scope //~^ ERROR cannot find type `v18` in this scope
//~| ERROR duplicate definitions with name `v21`
} }
impl<const v10: usize> v17<v10, v2> { impl<const v10: usize> v17<v10, v2> {

View File

@ -1,5 +1,5 @@
error[E0432]: unresolved import `v20::v13` error[E0432]: unresolved import `v20::v13`
--> $DIR/unevaluated-const-ice-119731.rs:37:15 --> $DIR/unevaluated-const-ice-119731.rs:38:15
| |
LL | pub use v20::{v13, v17}; LL | pub use v20::{v13, v17};
| ^^^ | ^^^
@ -23,7 +23,7 @@ LL | pub const fn v21() -> v18 {}
| ^^^ help: a type alias with a similar name exists: `v11` | ^^^ help: a type alias with a similar name exists: `v11`
error[E0412]: cannot find type `v18` in this scope error[E0412]: cannot find type `v18` in this scope
--> $DIR/unevaluated-const-ice-119731.rs:30:31 --> $DIR/unevaluated-const-ice-119731.rs:31:31
| |
LL | pub type v11 = [[usize; v4]; v4]; LL | pub type v11 = [[usize; v4]; v4];
| --------------------------------- similarly named type alias `v11` defined here | --------------------------------- similarly named type alias `v11` defined here
@ -32,7 +32,7 @@ LL | pub const fn v21() -> v18 {
| ^^^ help: a type alias with a similar name exists: `v11` | ^^^ help: a type alias with a similar name exists: `v11`
error[E0422]: cannot find struct, variant or union type `v18` in this scope error[E0422]: cannot find struct, variant or union type `v18` in this scope
--> $DIR/unevaluated-const-ice-119731.rs:32:13 --> $DIR/unevaluated-const-ice-119731.rs:33:13
| |
LL | pub type v11 = [[usize; v4]; v4]; LL | pub type v11 = [[usize; v4]; v4];
| --------------------------------- similarly named type alias `v11` defined here | --------------------------------- similarly named type alias `v11` defined here
@ -73,20 +73,29 @@ LL + #![feature(adt_const_params)]
| |
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
--> $DIR/unevaluated-const-ice-119731.rs:27:37 --> $DIR/unevaluated-const-ice-119731.rs:28:37
| |
LL | impl<const v10: usize> v17<v10, v2> { LL | impl<const v10: usize> v17<v10, v2> {
| ^^ | ^^
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0} error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
--> $DIR/unevaluated-const-ice-119731.rs:27:37 --> $DIR/unevaluated-const-ice-119731.rs:28:37
| |
LL | impl<const v10: usize> v17<v10, v2> { LL | impl<const v10: usize> v17<v10, v2> {
| ^^ | ^^
| |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 9 previous errors; 2 warnings emitted error[E0592]: duplicate definitions with name `v21`
--> $DIR/unevaluated-const-ice-119731.rs:23:9
|
LL | pub const fn v21() -> v18 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `v21`
...
LL | pub const fn v21() -> v18 {
| ------------------------- other definition for `v21`
Some errors have detailed explanations: E0412, E0422, E0425, E0432. error: aborting due to 10 previous errors; 2 warnings emitted
Some errors have detailed explanations: E0412, E0422, E0425, E0432, E0592.
For more information about an error, try `rustc --explain E0412`. For more information about an error, try `rustc --explain E0412`.

View File

@ -10,6 +10,5 @@ trait Trait {}
impl<const N: u32> Trait for A<N> {} impl<const N: u32> Trait for A<N> {}
impl<const N: u32> Trait for A<N> {} impl<const N: u32> Trait for A<N> {}
//~^ ERROR conflicting implementations of trait `Trait` for type `A<_>`
pub fn main() {} pub fn main() {}

View File

@ -4,16 +4,6 @@ error[E0423]: expected value, found builtin type `u8`
LL | struct A<const N: u32 = 1, const M: u32 = u8>; LL | struct A<const N: u32 = 1, const M: u32 = u8>;
| ^^ not a value | ^^ not a value
error[E0119]: conflicting implementations of trait `Trait` for type `A<_>` error: aborting due to 1 previous error
--> $DIR/unknown-alias-defkind-anonconst-ice-116710.rs:12:1
|
LL | impl<const N: u32> Trait for A<N> {}
| --------------------------------- first implementation here
LL |
LL | impl<const N: u32> Trait for A<N> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `A<_>`
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0423`.
Some errors have detailed explanations: E0119, E0423.
For more information about an error, try `rustc --explain E0119`.

View File

@ -1,4 +1,4 @@
error[E0119]: conflicting implementations of trait `LolFrom<&[_]>` for type `LocalType<_>` error[E0119]: conflicting implementations of trait `LolFrom<&[u8]>` for type `LocalType<u8>`
--> $DIR/issue-23563.rs:13:1 --> $DIR/issue-23563.rs:13:1
| |
LL | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> { LL | impl<'a, T> LolFrom<&'a [T]> for LocalType<T> {

View File

@ -6,6 +6,8 @@ LL | impl<T: std::ops::DerefMut> Foo for T { }
LL | LL |
LL | impl<T> Foo for &T { } LL | impl<T> Foo for &T { }
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_` | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
|
= note: downstream crates may implement trait `std::ops::DerefMut` for type `&_`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -11,7 +11,6 @@ trait Overlap<T> {}
impl<T> Overlap<T> for T {} impl<T> Overlap<T> for T {}
impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
//~^ ERROR 13:17: 13:49: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277] //~^ ERROR conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>`
//~| ERROR 13:36: 13:48: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied [E0277]
fn main() {} fn main() {}

View File

@ -1,27 +1,18 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, !2_0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
--> $DIR/structually-relate-aliases.rs:13:36 WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), _)>` for type `for<'a> fn(&'a (), _)`
--> $DIR/structually-relate-aliases.rs:13:1
| |
LL | impl<T> Overlap<T> for T {}
| ------------------------ first implementation here
LL |
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {} LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a (), _)`
| |
help: consider restricting type parameter `T` = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details
|
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ++++++++++++++++++++
error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied error: aborting due to 1 previous error
--> $DIR/structually-relate-aliases.rs:13:17
|
LL | impl<T> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `T`
|
help: consider restricting type parameter `T`
|
LL | impl<T: for<'a> ToUnit<'a>> Overlap<for<'a> fn(&'a (), Assoc<'a, T>)> for T {}
| ++++++++++++++++++++
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0119`.
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,11 +1,11 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/auto-trait-coherence.rs:24:1 --> $DIR/auto-trait-coherence.rs:24:1
| |
LL | impl<T: Send> AnotherTrait for T {} LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here | -------------------------------- first implementation here
... ...
LL | impl AnotherTrait for D<OpaqueType> { LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -1,6 +1,3 @@
//@ revisions: old next
//@[next] compile-flags: -Znext-solver
// Tests that type alias impls traits do not leak auto-traits for // Tests that type alias impls traits do not leak auto-traits for
// the purposes of coherence checking // the purposes of coherence checking
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
@ -22,8 +19,7 @@ impl<T: Send> AnotherTrait for T {}
// (We treat opaque types as "foreign types" that could grow more impls // (We treat opaque types as "foreign types" that could grow more impls
// in the future.) // in the future.)
impl AnotherTrait for D<OpaqueType> { impl AnotherTrait for D<OpaqueType> {
//[old]~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<_>`
//[next]~^^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<_>`
} }
fn main() {} fn main() {}

View File

@ -0,0 +1,12 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/auto-trait-coherence.rs:21:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -5,7 +5,7 @@
struct Foo; struct Foo;
impl Into<T> for Foo { impl Into<T> for Foo {
//~^ ERROR conflicting implementations of trait `Into<T>` for type `Foo` //~^ ERROR conflicting implementations of trait `Into<_>` for type `Foo`
fn into(self) -> T { fn into(self) -> T {
Foo Foo
} }

View File

@ -1,4 +1,4 @@
error[E0119]: conflicting implementations of trait `Into<T>` for type `Foo` error[E0119]: conflicting implementations of trait `Into<_>` for type `Foo`
--> $DIR/coherence-treats-tait-ambig.rs:7:1 --> $DIR/coherence-treats-tait-ambig.rs:7:1
| |
LL | impl Into<T> for Foo { LL | impl Into<T> for Foo {

View File

@ -17,7 +17,7 @@ impl<T: std::fmt::Debug> AnotherTrait for T {}
// This is in error, because we cannot assume that `OpaqueType: !Debug` // This is in error, because we cannot assume that `OpaqueType: !Debug`
impl AnotherTrait for D<OpaqueType> { impl AnotherTrait for D<OpaqueType> {
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` //~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<_>`
} }
fn main() {} fn main() {}

View File

@ -1,13 +1,11 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/negative-reasoning.rs:19:1 --> $DIR/negative-reasoning.rs:19:1
| |
LL | impl<T: std::fmt::Debug> AnotherTrait for T {} LL | impl<T: std::fmt::Debug> AnotherTrait for T {}
| ------------------------------------------- first implementation here | ------------------------------------------- first implementation here
... ...
LL | impl AnotherTrait for D<OpaqueType> { LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
|
= note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `OpaqueType` in future versions
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -1,34 +1,35 @@
//~ ERROR overflow evaluating the requirement `([isize; 0], _): Sized
trait Foo<A> { trait Foo<A> {
fn get(&self, A: &A) { } fn get(&self, A: &A) {}
} }
trait Bar { trait Bar {
type Out; type Out;
} }
impl<T> Foo<T> for [isize;0] { impl<T> Foo<T> for [isize; 0] {
// OK, T is used in `Foo<T>`. // OK, T is used in `Foo<T>`.
} }
impl<T,U> Foo<T> for [isize;1] { impl<T, U> Foo<T> for [isize; 1] {
//~^ ERROR the type parameter `U` is not constrained //~^ ERROR the type parameter `U` is not constrained
} }
impl<T,U> Foo<T> for [isize;2] where T : Bar<Out=U> { impl<T, U> Foo<T> for [isize; 2]
where
T: Bar<Out = U>,
{
// OK, `U` is now constrained by the output type parameter. // OK, `U` is now constrained by the output type parameter.
} }
impl<T:Bar<Out=U>,U> Foo<T> for [isize;3] { impl<T: Bar<Out = U>, U> Foo<T> for [isize; 3] {
// OK, same as above but written differently. // OK, same as above but written differently.
} }
impl<T,U> Foo<T> for U { impl<T, U> Foo<T> for U {
//~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]` //~^ ERROR conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
} }
impl<T,U> Bar for T { impl<T, U> Bar for T {
//~^ ERROR the type parameter `U` is not constrained //~^ ERROR the type parameter `U` is not constrained
type Out = U; type Out = U;
@ -36,28 +37,33 @@ impl<T,U> Bar for T {
// Using `U` in an associated type within the impl is not good enough! // Using `U` in an associated type within the impl is not good enough!
} }
impl<T,U> Bar for T impl<T, U> Bar for T
where T : Bar<Out=U> where
T: Bar<Out = U>,
{ {
//~^^^ ERROR the type parameter `U` is not constrained //~^^^^ ERROR the type parameter `U` is not constrained by the impl trait, self type, or predicates
//~| ERROR conflicting implementations of trait `Bar`
// This crafty self-referential attempt is still no good. // This crafty self-referential attempt is still no good.
} }
impl<T,U,V> Foo<T> for T impl<T, U, V> Foo<T> for T
where (T,U): Bar<Out=V> where
(T, U): Bar<Out = V>,
{ {
//~^^^ ERROR the type parameter `U` is not constrained //~^^^^ ERROR the type parameter `U` is not constrained
//~| ERROR the type parameter `V` is not constrained //~| ERROR the type parameter `V` is not constrained
//~| ERROR conflicting implementations of trait `Foo<[isize; 0]>` for type `[isize; 0]`
// Here, `V` is bound by an output type parameter, but the inputs // Here, `V` is bound by an output type parameter, but the inputs
// are not themselves constrained. // are not themselves constrained.
} }
impl<T,U,V> Foo<(T,U)> for T impl<T, U, V> Foo<(T, U)> for T
where (T,U): Bar<Out=V> where
(T, U): Bar<Out = V>,
{ {
//~^^^^ ERROR conflicting implementations of trait `Foo<([isize; 0], _)>` for type `[isize; 0]`
// As above, but both T and U ARE constrained. // As above, but both T and U ARE constrained.
} }
fn main() { } fn main() {}

View File

@ -1,56 +1,76 @@
error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]` error[E0119]: conflicting implementations of trait `Foo<_>` for type `[isize; 0]`
--> $DIR/impl-unused-tps.rs:27:1 --> $DIR/impl-unused-tps.rs:28:1
| |
LL | impl<T> Foo<T> for [isize;0] { LL | impl<T> Foo<T> for [isize; 0] {
| ---------------------------- first implementation here | ----------------------------- first implementation here
... ...
LL | impl<T,U> Foo<T> for U { LL | impl<T, U> Foo<T> for U {
| ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]` | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `[isize; 0]`
error[E0275]: overflow evaluating the requirement `([isize; 0], _): Sized` error[E0119]: conflicting implementations of trait `Bar`
--> $DIR/impl-unused-tps.rs:40:1
| |
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`impl_unused_tps`) LL | impl<T, U> Bar for T {
note: required for `([isize; 0], _)` to implement `Bar` | -------------------- first implementation here
--> $DIR/impl-unused-tps.rs:31:11 ...
LL | / impl<T, U> Bar for T
LL | | where
LL | | T: Bar<Out = U>,
| |____________________^ conflicting implementation
error[E0119]: conflicting implementations of trait `Foo<[isize; 0]>` for type `[isize; 0]`
--> $DIR/impl-unused-tps.rs:49:1
| |
LL | impl<T,U> Bar for T { LL | impl<T> Foo<T> for [isize; 0] {
| - ^^^ ^ | ----------------------------- first implementation here
| | ...
| unsatisfied trait bound introduced here LL | / impl<T, U, V> Foo<T> for T
= note: 126 redundant requirements hidden LL | | where
= note: required for `([isize; 0], _)` to implement `Bar` LL | | (T, U): Bar<Out = V>,
| |_________________________^ conflicting implementation for `[isize; 0]`
error[E0119]: conflicting implementations of trait `Foo<([isize; 0], _)>` for type `[isize; 0]`
--> $DIR/impl-unused-tps.rs:61:1
|
LL | impl<T> Foo<T> for [isize; 0] {
| ----------------------------- first implementation here
...
LL | / impl<T, U, V> Foo<(T, U)> for T
LL | | where
LL | | (T, U): Bar<Out = V>,
| |_________________________^ conflicting implementation for `[isize; 0]`
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
--> $DIR/impl-unused-tps.rs:15:8 --> $DIR/impl-unused-tps.rs:13:9
| |
LL | impl<T,U> Foo<T> for [isize;1] { LL | impl<T, U> Foo<T> for [isize; 1] {
| ^ unconstrained type parameter | ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
--> $DIR/impl-unused-tps.rs:31:8 --> $DIR/impl-unused-tps.rs:32:9
| |
LL | impl<T,U> Bar for T { LL | impl<T, U> Bar for T {
| ^ unconstrained type parameter | ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
--> $DIR/impl-unused-tps.rs:39:8 --> $DIR/impl-unused-tps.rs:40:9
| |
LL | impl<T,U> Bar for T LL | impl<T, U> Bar for T
| ^ unconstrained type parameter | ^ unconstrained type parameter
error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
--> $DIR/impl-unused-tps.rs:47:8 --> $DIR/impl-unused-tps.rs:49:9
| |
LL | impl<T,U,V> Foo<T> for T LL | impl<T, U, V> Foo<T> for T
| ^ unconstrained type parameter | ^ unconstrained type parameter
error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates
--> $DIR/impl-unused-tps.rs:47:10 --> $DIR/impl-unused-tps.rs:49:12
| |
LL | impl<T,U,V> Foo<T> for T LL | impl<T, U, V> Foo<T> for T
| ^ unconstrained type parameter | ^ unconstrained type parameter
error: aborting due to 7 previous errors error: aborting due to 9 previous errors
Some errors have detailed explanations: E0119, E0207, E0275. Some errors have detailed explanations: E0119, E0207.
For more information about an error, try `rustc --explain E0119`. For more information about an error, try `rustc --explain E0119`.

View File

@ -1,12 +1,8 @@
// Regression test for #48728, an ICE that occurred computing // Regression test for #48728, an ICE that occurred computing
// coherence "help" information. // coherence "help" information.
//@ revisions: current next //@ check-pass
//@ ignore-compare-mode-next-solver (explicit revisions) #[derive(Clone)]
//@[next] compile-flags: -Znext-solver
//@[next] check-pass
#[derive(Clone)] //[current]~ ERROR conflicting implementations of trait `Clone`
struct Node<T: ?Sized>(Box<T>); struct Node<T: ?Sized>(Box<T>);
impl<T: Clone + ?Sized> Clone for Node<[T]> { impl<T: Clone + ?Sized> Clone for Node<[T]> {

View File

@ -71,7 +71,8 @@ fn redundant(&self) {}
} }
default impl Redundant for i32 { default impl Redundant for i32 {
fn redundant(&self) {} //~ ERROR E0520 fn redundant(&self) {}
//~^ ERROR `redundant` specializes an item from a parent `impl`, but that item is not marked `default`
} }
fn main() {} fn main() {}

View File

@ -0,0 +1,12 @@
error[E0119]: conflicting implementations of trait `Overlap` for type `u32`
--> $DIR/specialization-default-items-drop-coherence.rs:26:1
|
LL | impl Overlap for u32 {
| -------------------- first implementation here
...
LL | impl Overlap for <u32 as Default>::Id {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,5 +1,5 @@
error[E0119]: conflicting implementations of trait `Overlap` for type `u32` error[E0119]: conflicting implementations of trait `Overlap` for type `u32`
--> $DIR/specialization-default-items-drop-coherence.rs:29:1 --> $DIR/specialization-default-items-drop-coherence.rs:26:1
| |
LL | impl Overlap for u32 { LL | impl Overlap for u32 {
| -------------------- first implementation here | -------------------- first implementation here

View File

@ -1,8 +1,5 @@
//@ revisions: classic coherence next //@ revisions: current next
//@[next] compile-flags: -Znext-solver //@[next] compile-flags: -Znext-solver
//@[coherence] compile-flags: -Znext-solver=coherence
//@[classic] check-pass
//@[classic] known-bug: #105782
// Should fail. Default items completely drop candidates instead of ambiguity, // Should fail. Default items completely drop candidates instead of ambiguity,
// which is unsound during coherence, since coherence requires completeness. // which is unsound during coherence, since coherence requires completeness.
@ -27,8 +24,7 @@ impl Overlap for u32 {
} }
impl Overlap for <u32 as Default>::Id { impl Overlap for <u32 as Default>::Id {
//[coherence]~^ ERROR conflicting implementations of trait `Overlap` for type `u32` //~^ ERROR conflicting implementations of trait `Overlap` for type `u32`
//[next]~^^ ERROR conflicting implementations of trait `Overlap` for type `u32`
type Assoc = Box<usize>; type Assoc = Box<usize>;
} }

View File

@ -1,5 +1,5 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap-projection.rs:10:12 --> $DIR/specialization-overlap-projection.rs:4:12
| |
LL | #![feature(specialization)] LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -8,5 +8,23 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete = help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:19:1
|
LL | impl Foo for u32 {}
| ---------------- first implementation here
LL | impl Foo for <u8 as Assoc>::Output {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:21:1
|
LL | impl Foo for u32 {}
| ---------------- first implementation here
...
LL | impl Foo for <u16 as Assoc>::Output {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,5 +1,5 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap-projection.rs:10:12 --> $DIR/specialization-overlap-projection.rs:4:12
| |
LL | #![feature(specialization)] LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^
@ -9,7 +9,7 @@ LL | #![feature(specialization)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
error[E0119]: conflicting implementations of trait `Foo` for type `u32` error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:25:1 --> $DIR/specialization-overlap-projection.rs:19:1
| |
LL | impl Foo for u32 {} LL | impl Foo for u32 {}
| ---------------- first implementation here | ---------------- first implementation here
@ -17,7 +17,7 @@ LL | impl Foo for <u8 as Assoc>::Output {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error[E0119]: conflicting implementations of trait `Foo` for type `u32` error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:27:1 --> $DIR/specialization-overlap-projection.rs:21:1
| |
LL | impl Foo for u32 {} LL | impl Foo for u32 {}
| ---------------- first implementation here | ---------------- first implementation here

View File

@ -1,13 +1,8 @@
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver
//@[current] check-pass
// Test that impls on projected self types can resolve overlap, even when the // Test that impls on projected self types can resolve overlap, even when the
// projections involve specialization, so long as the associated type is // projections involve specialization, so long as the associated type is
// provided by the most specialized impl. // provided by the most specialized impl.
#![feature(specialization)]
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete //~^ WARN the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
trait Assoc { trait Assoc {
type Output; type Output;
@ -23,8 +18,8 @@ impl<T> Assoc for T {
trait Foo {} trait Foo {}
impl Foo for u32 {} impl Foo for u32 {}
impl Foo for <u8 as Assoc>::Output {} impl Foo for <u8 as Assoc>::Output {}
//[next]~^ ERROR conflicting implementations of trait `Foo` for type `u32` //~^ ERROR conflicting implementations of trait `Foo` for type `u32`
impl Foo for <u16 as Assoc>::Output {} impl Foo for <u16 as Assoc>::Output {}
//[next]~^ ERROR conflicting implementations of trait `Foo` for type `u32` //~^ ERROR conflicting implementations of trait `Foo` for type `u32`
fn main() {} fn main() {}

View File

@ -0,0 +1,30 @@
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/specialization-overlap-projection.rs:4:12
|
LL | #![feature(specialization)]
| ^^^^^^^^^^^^^^
|
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:20:1
|
LL | impl Foo for u32 {}
| ---------------- first implementation here
LL | impl Foo for <u8 as Assoc>::Output {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error[E0119]: conflicting implementations of trait `Foo` for type `u32`
--> $DIR/specialization-overlap-projection.rs:22:1
|
LL | impl Foo for u32 {}
| ---------------- first implementation here
...
LL | impl Foo for <u16 as Assoc>::Output {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u32`
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0119`.

View File

@ -8,5 +8,5 @@ fn mk_opaque() -> OpaqueType {
trait AnotherTrait {} trait AnotherTrait {}
impl<T: Send> AnotherTrait for T {} impl<T: Send> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {} impl AnotherTrait for OpaqueType {}
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `OpaqueType` //~^ ERROR conflicting implementations of trait `AnotherTrait`
fn main() {} fn main() {}

View File

@ -1,10 +1,10 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` error[E0119]: conflicting implementations of trait `AnotherTrait`
--> $DIR/issue-83613.rs:10:1 --> $DIR/issue-83613.rs:10:1
| |
LL | impl<T: Send> AnotherTrait for T {} LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here | -------------------------------- first implementation here
LL | impl AnotherTrait for OpaqueType {} LL | impl AnotherTrait for OpaqueType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -1,4 +1,3 @@
//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
struct A<T>(B<T>); struct A<T>(B<T>);
//~^ ERROR recursive types `A` and `B` have infinite size //~^ ERROR recursive types `A` and `B` have infinite size
//~| ERROR `T` is only used recursively //~| ERROR `T` is only used recursively
@ -7,5 +6,5 @@
trait Foo {} trait Foo {}
impl<T> Foo for T where T: Send {} impl<T> Foo for T where T: Send {}
impl Foo for B<u8> {} impl Foo for B<u8> {}
//~^ ERROR conflicting implementations of trait `Foo` for type `B<u8>`
fn main() {} fn main() {}

View File

@ -1,5 +1,5 @@
error[E0072]: recursive types `A` and `B` have infinite size error[E0072]: recursive types `A` and `B` have infinite size
--> $DIR/issue-105231.rs:2:1 --> $DIR/issue-105231.rs:1:1
| |
LL | struct A<T>(B<T>); LL | struct A<T>(B<T>);
| ^^^^^^^^^^^ ---- recursive without indirection | ^^^^^^^^^^^ ---- recursive without indirection
@ -16,7 +16,7 @@ LL ~ struct B<T>(Box<A<A<T>>>);
| |
error: type parameter `T` is only used recursively error: type parameter `T` is only used recursively
--> $DIR/issue-105231.rs:2:15 --> $DIR/issue-105231.rs:1:15
| |
LL | struct A<T>(B<T>); LL | struct A<T>(B<T>);
| - ^ | - ^
@ -27,7 +27,7 @@ LL | struct A<T>(B<T>);
= note: all type parameters must be used in a non-recursive way in order to constrain their variance = note: all type parameters must be used in a non-recursive way in order to constrain their variance
error: type parameter `T` is only used recursively error: type parameter `T` is only used recursively
--> $DIR/issue-105231.rs:5:17 --> $DIR/issue-105231.rs:4:17
| |
LL | struct B<T>(A<A<T>>); LL | struct B<T>(A<A<T>>);
| - ^ | - ^
@ -37,16 +37,18 @@ LL | struct B<T>(A<A<T>>);
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
= note: all type parameters must be used in a non-recursive way in order to constrain their variance = note: all type parameters must be used in a non-recursive way in order to constrain their variance
error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send` error[E0119]: conflicting implementations of trait `Foo` for type `B<u8>`
--> $DIR/issue-105231.rs:8:1
| |
LL | impl<T> Foo for T where T: Send {}
| ------------------------------- first implementation here
LL | impl Foo for B<u8> {}
| ^^^^^^^^^^^^^^^^^^ conflicting implementation for `B<u8>`
|
= note: overflow evaluating the requirement `B<u8>: Send`
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`) = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
--> $DIR/issue-105231.rs:5:8
|
LL | struct B<T>(A<A<T>>);
| ^
error: aborting due to 4 previous errors error: aborting due to 4 previous errors
Some errors have detailed explanations: E0072, E0275. Some errors have detailed explanations: E0072, E0119.
For more information about an error, try `rustc --explain E0072`. For more information about an error, try `rustc --explain E0072`.

View File

@ -1,7 +1,7 @@
// This must fail coherence. // This must fail coherence.
// //
// Getting this to pass was fairly difficult, so here's an explanation // Getting this to pass was fairly difficult, so here's an explanation
// of what's happening: // of what was previously happening for this to compile:
// //
// Normalizing projections currently tries to replace them with inference variables // Normalizing projections currently tries to replace them with inference variables
// while emitting a nested `Projection` obligation. This cannot be done if the projection // while emitting a nested `Projection` obligation. This cannot be done if the projection
@ -17,12 +17,6 @@
// that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails, // that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails,
// causing coherence to consider these two impls distinct. // causing coherence to consider these two impls distinct.
//@ revisions: classic next
//@[next] compile-flags: -Znext-solver
//@[classic] known-bug: #102048
//@[classic] check-pass
pub trait Trait<T> {} pub trait Trait<T> {}
pub trait WithAssoc1<'a> { pub trait WithAssoc1<'a> {
@ -42,7 +36,7 @@ impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>:
// impl 2 // impl 2
impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
U: for<'a> WithAssoc1<'a> //[next]~^ ERROR conflicting implementations of trait U: for<'a> WithAssoc1<'a> //~^ ERROR conflicting implementations of trait
{ {
} }

View File

@ -0,0 +1,16 @@
error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
--> $DIR/issue-102048.rs:38:1
|
LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
LL | | where
LL | | T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
LL | | U: for<'a> WithAssoc2<'a>,
| |______________________________- first implementation here
...
LL | / impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
LL | | U: for<'a> WithAssoc1<'a>
| |_____________________________^ conflicting implementation for `(_, _)`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,4 +1,3 @@
//~ ERROR overflow
// A regression test for #111729 checking that we correctly // A regression test for #111729 checking that we correctly
// track recursion depth for obligations returned by confirmation. // track recursion depth for obligations returned by confirmation.
use std::panic::RefUnwindSafe; use std::panic::RefUnwindSafe;
@ -18,6 +17,7 @@ impl<T: RefUnwindSafe> Database for T {
type Storage = SalsaStorage; type Storage = SalsaStorage;
} }
impl Database for RootDatabase { impl Database for RootDatabase {
//~^ ERROR conflicting implementations of trait `Database` for type `RootDatabase`
type Storage = SalsaStorage; type Storage = SalsaStorage;
} }

View File

@ -1,24 +1,12 @@
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe` error[E0119]: conflicting implementations of trait `Database` for type `RootDatabase`
| --> $DIR/cycle-via-builtin-auto-trait-impl.rs:19:1
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
note: required because it appears within the type `RootDatabase`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
|
LL | struct RootDatabase {
| ^^^^^^^^^^^^
note: required for `RootDatabase` to implement `Database`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
| |
LL | impl<T: RefUnwindSafe> Database for T { LL | impl<T: RefUnwindSafe> Database for T {
| ------------- ^^^^^^^^ ^ | ------------------------------------- first implementation here
| | ...
| unsatisfied trait bound introduced here LL | impl Database for RootDatabase {
note: required because it appears within the type `Runtime<RootDatabase>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `RootDatabase`
--> $DIR/cycle-via-builtin-auto-trait-impl.rs:24:8
|
LL | struct Runtime<DB: Database> {
| ^^^^^^^
error: aborting due to 1 previous error error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0275`. For more information about this error, try `rustc --explain E0119`.

View File

@ -15,8 +15,6 @@ LL | impl Bop for Bar<()> {}
... ...
LL | impl Bop for Barr {} LL | impl Bop for Barr {}
| ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>` | ^^^^^^^^^^^^^^^^^ conflicting implementation for `Bar<()>`
|
= note: upstream crates may add a new impl of trait `std::marker::FnPtr` for type `Barr` in future versions
error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>` error[E0119]: conflicting implementations of trait `Bop` for type `Bar<()>`
--> $DIR/impl_trait_for_same_tait.rs:30:1 --> $DIR/impl_trait_for_same_tait.rs:30:1

View File

@ -1,11 +1,11 @@
error[E0119]: conflicting implementations of trait `Yay` for type `Alias` error[E0119]: conflicting implementations of trait `Yay` for type `<() as HideIt>::Assoc`
--> $DIR/implied_lifetime_wf_check.rs:26:1 --> $DIR/implied_lifetime_wf_check.rs:26:1
| |
LL | impl Yay for <() as HideIt>::Assoc {} LL | impl Yay for <() as HideIt>::Assoc {}
| ---------------------------------- first implementation here | ---------------------------------- first implementation here
LL | #[cfg(error)] LL | #[cfg(error)]
LL | impl Yay for i32 {} LL | impl Yay for i32 {}
| ^^^^^^^^^^^^^^^^ conflicting implementation for `Alias` | ^^^^^^^^^^^^^^^^ conflicting implementation for `<() as HideIt>::Assoc`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -14,6 +14,6 @@ fn mk_opaque() -> OpaqueType {
trait AnotherTrait {} trait AnotherTrait {}
impl<T: Send> AnotherTrait for T {} impl<T: Send> AnotherTrait for T {}
impl AnotherTrait for OpaqueType {} impl AnotherTrait for OpaqueType {}
//[stock]~^ conflicting implementations of trait `AnotherTrait` for type `OpaqueType` //[stock]~^ conflicting implementations of trait `AnotherTrait`
fn main() {} fn main() {}

View File

@ -1,10 +1,10 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType` error[E0119]: conflicting implementations of trait `AnotherTrait`
--> $DIR/issue-104817.rs:16:1 --> $DIR/issue-104817.rs:16:1
| |
LL | impl<T: Send> AnotherTrait for T {} LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here | -------------------------------- first implementation here
LL | impl AnotherTrait for OpaqueType {} LL | impl AnotherTrait for OpaqueType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to 1 previous error error: aborting due to 1 previous error