@@ -31,7 +31,7 @@ use super::{VtableImplData, VtableObjectData, VtableBuiltinData, VtableGenerator
31
31
use super :: util;
32
32
33
33
use dep_graph:: { DepNodeIndex , DepKind } ;
34
- use hir:: def_id:: DefId ;
34
+ use hir:: def_id:: { DefId , LOCAL_CRATE } ;
35
35
use infer;
36
36
use infer:: { InferCtxt , InferOk , TypeFreshener } ;
37
37
use ty:: subst:: { Kind , Subst , Substs } ;
@@ -1069,13 +1069,18 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1069
1069
if !candidate_set. ambiguous && candidate_set. vec . is_empty ( ) {
1070
1070
let trait_ref = stack. obligation . predicate . skip_binder ( ) . trait_ref ;
1071
1071
let self_ty = trait_ref. self_ty ( ) ;
1072
- let cause = IntercrateAmbiguityCause :: UpstreamCrateUpdate {
1073
- trait_desc : trait_ref. to_string ( ) ,
1074
- self_desc : if self_ty. has_concrete_skeleton ( ) {
1075
- Some ( self_ty. to_string ( ) )
1076
- } else {
1077
- None
1078
- } ,
1072
+ let trait_desc = trait_ref. to_string ( ) ;
1073
+ let self_desc = if self_ty. has_concrete_skeleton ( ) {
1074
+ Some ( self_ty. to_string ( ) )
1075
+ } else {
1076
+ None
1077
+ } ;
1078
+ let cause = if
1079
+ trait_ref. def_id . krate != LOCAL_CRATE &&
1080
+ !self . tcx ( ) . has_attr ( trait_ref. def_id , "fundamental" ) {
1081
+ IntercrateAmbiguityCause :: UpstreamCrateUpdate { trait_desc, self_desc }
1082
+ } else {
1083
+ IntercrateAmbiguityCause :: DownstreamCrate { trait_desc, self_desc }
1079
1084
} ;
1080
1085
self . intercrate_ambiguity_causes . push ( cause) ;
1081
1086
}
0 commit comments