-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Make required dependency as future an error, remove RcList #6860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
f0f8565
4590e74
0131d09
df62a57
097dbdf
8cd9b0c
d0c80ec
a473716
35ff555
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,7 +62,7 @@ use crate::util::errors::CargoResult; | |
| use crate::util::profile; | ||
|
|
||
| use self::context::{Activations, Context}; | ||
| use self::types::{Candidate, ConflictMap, ConflictReason, DepsFrame, GraphNode}; | ||
| use self::types::{Candidate, ConflictMap, ConflictReason, DepsFrame}; | ||
| use self::types::{RcVecIter, RegistryQueryer, RemainingDeps, ResolverProgress}; | ||
|
|
||
| pub use self::encode::{EncodableDependency, EncodablePackageId, EncodableResolve}; | ||
|
|
@@ -143,7 +143,7 @@ pub fn resolve( | |
| } | ||
| let resolve = Resolve::new( | ||
| cx.graph(), | ||
| cx.resolve_replacements(), | ||
| cx.resolve_replacements(®istry), | ||
| cx.resolve_features | ||
| .iter() | ||
| .map(|(k, v)| (*k, v.iter().map(|x| x.to_string()).collect())) | ||
|
|
@@ -158,15 +158,8 @@ pub fn resolve( | |
| trace!("resolved: {:?}", resolve); | ||
|
|
||
| // If we have a shell, emit warnings about required deps used as feature. | ||
| if let Some(config) = config { | ||
| if print_warnings { | ||
| let mut shell = config.shell(); | ||
| let mut warnings = &cx.warnings; | ||
| while let Some(ref head) = warnings.head { | ||
| shell.warn(&head.0)?; | ||
| warnings = &head.1; | ||
| } | ||
| } | ||
| if print_warnings && config.is_some() { | ||
| emit_warnings(&cx, &resolve, summaries, config) | ||
| } | ||
|
|
||
| Ok(resolve) | ||
|
|
@@ -613,8 +606,6 @@ fn activate( | |
| let candidate_pid = candidate.summary.package_id(); | ||
| if let Some((parent, dep)) = parent { | ||
| let parent_pid = parent.package_id(); | ||
| cx.resolve_graph | ||
| .push(GraphNode::Link(parent_pid, candidate_pid, dep.clone())); | ||
| Rc::make_mut( | ||
| // add a edge from candidate to parent in the parents graph | ||
| cx.parents.link(candidate_pid, parent_pid), | ||
|
|
@@ -675,8 +666,6 @@ fn activate( | |
|
|
||
| let candidate = match candidate.replace { | ||
| Some(replace) => { | ||
| cx.resolve_replacements | ||
| .push((candidate_pid, replace.package_id())); | ||
| if cx.flag_activated(&replace, method)? && activated { | ||
| return Ok(None); | ||
| } | ||
|
|
@@ -1098,3 +1087,51 @@ fn check_duplicate_pkgs_in_lockfile(resolve: &Resolve) -> CargoResult<()> { | |
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// re-run all used resolve_features so it can print warnings | ||
alexcrichton marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fn emit_warnings( | ||
| cx: &Context, | ||
| resolve: &Resolve, | ||
| summaries: &[(Summary, Method<'_>)], | ||
| config: Option<&Config>, | ||
| ) { | ||
| let mut new_cx = cx.clone(); | ||
| new_cx.resolve_features = im_rc::HashMap::new(); | ||
| let mut features_from_dep = HashMap::new(); | ||
| for (summery, method) in summaries { | ||
alexcrichton marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for (dep, features) in new_cx | ||
| .resolve_features(None, summery, &method, config) | ||
| .expect("can not resolve_features for a required summery") | ||
| { | ||
| features_from_dep.insert((summery.package_id(), dep), features); | ||
| } | ||
| } | ||
| for summery in resolve.sort().iter().rev().map(|id| { | ||
alexcrichton marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| cx.activations | ||
| .get(&id.as_activations_key()) | ||
| .expect("id in dependency graph but not in activations") | ||
| .0 | ||
| .clone() | ||
| }) { | ||
| for (parent, deps) in cx.parents.edges(&summery.package_id()) { | ||
| for dep in deps.iter() { | ||
| let features = features_from_dep | ||
| .remove(&(*parent, dep.clone())) | ||
| .expect("fulfilled a dep that was not needed"); | ||
| let method = Method::Required { | ||
| dev_deps: false, | ||
| features: &features, | ||
| all_features: false, | ||
| uses_default_features: dep.uses_default_features(), | ||
| }; | ||
| for (dep, features) in new_cx | ||
| .resolve_features(None, &summery, &method, config) | ||
|
||
| .expect("can not resolve_features for a used dep") | ||
| { | ||
| features_from_dep.insert((summery.package_id(), dep), features); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| assert_eq!(cx.resolve_features, new_cx.resolve_features); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,7 +114,7 @@ pub fn resolve_with_config_raw( | |
| &mut registry, | ||
| &HashSet::new(), | ||
| config, | ||
| false, | ||
| true, | ||
| true, | ||
| ); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.