@@ -95,47 +95,6 @@ pub struct SelectionContext<'cx, 'tcx> {
9595 query_mode : TraitQueryMode ,
9696}
9797
98- #[ derive( Clone , Debug ) ]
99- pub enum IntercrateAmbiguityCause {
100- DownstreamCrate { trait_desc : String , self_desc : Option < String > } ,
101- UpstreamCrateUpdate { trait_desc : String , self_desc : Option < String > } ,
102- ReservationImpl { message : String } ,
103- }
104-
105- impl IntercrateAmbiguityCause {
106- /// Emits notes when the overlap is caused by complex intercrate ambiguities.
107- /// See #23980 for details.
108- pub fn add_intercrate_ambiguity_hint ( & self , err : & mut rustc_errors:: DiagnosticBuilder < ' _ > ) {
109- err. note ( & self . intercrate_ambiguity_hint ( ) ) ;
110- }
111-
112- pub fn intercrate_ambiguity_hint ( & self ) -> String {
113- match self {
114- & IntercrateAmbiguityCause :: DownstreamCrate { ref trait_desc, ref self_desc } => {
115- let self_desc = if let & Some ( ref ty) = self_desc {
116- format ! ( " for type `{}`" , ty)
117- } else {
118- String :: new ( )
119- } ;
120- format ! ( "downstream crates may implement trait `{}`{}" , trait_desc, self_desc)
121- }
122- & IntercrateAmbiguityCause :: UpstreamCrateUpdate { ref trait_desc, ref self_desc } => {
123- let self_desc = if let & Some ( ref ty) = self_desc {
124- format ! ( " for type `{}`" , ty)
125- } else {
126- String :: new ( )
127- } ;
128- format ! (
129- "upstream crates may add a new impl of trait `{}`{} \
130- in future versions",
131- trait_desc, self_desc
132- )
133- }
134- & IntercrateAmbiguityCause :: ReservationImpl { ref message } => message. clone ( ) ,
135- }
136- }
137- }
138-
13998// A stack that walks back up the stack frame.
14099struct TraitObligationStack < ' prev , ' tcx > {
141100 obligation : & ' prev TraitObligation < ' tcx > ,
0 commit comments