@@ -157,7 +157,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
157157 } ;
158158 let target = tree:: Target :: from_cli ( targets) ;
159159
160- let ( edge_kinds, no_proc_macro) = parse_edge_kinds ( gctx, args) ?;
160+ let ( edge_kinds, no_proc_macro, public ) = parse_edge_kinds ( gctx, args) ?;
161161 let graph_features = edge_kinds. contains ( & EdgeKind :: Feature ) ;
162162
163163 let pkgs_to_prune = args. _values_of ( "prune" ) ;
@@ -230,6 +230,7 @@ subtree of the package given to -p.\n\
230230 graph_features,
231231 display_depth,
232232 no_proc_macro,
233+ public,
233234 } ;
234235
235236 if opts. graph_features && opts. duplicates {
@@ -246,9 +247,10 @@ subtree of the package given to -p.\n\
246247fn parse_edge_kinds (
247248 gctx : & GlobalContext ,
248249 args : & ArgMatches ,
249- ) -> CargoResult < ( HashSet < EdgeKind > , bool ) > {
250- let ( kinds, no_proc_macro) = {
250+ ) -> CargoResult < ( HashSet < EdgeKind > , bool , bool ) > {
251+ let ( kinds, no_proc_macro, public ) = {
251252 let mut no_proc_macro = false ;
253+ let mut public = false ;
252254 let mut kinds = args. get_many :: < String > ( "edges" ) . map_or_else (
253255 || Vec :: new ( ) ,
254256 |es| {
@@ -257,6 +259,9 @@ fn parse_edge_kinds(
257259 if * e == "no-proc-macro" {
258260 no_proc_macro = true ;
259261 false
262+ } else if * e == "public" {
263+ public = true ;
264+ false
260265 } else {
261266 true
262267 }
@@ -275,7 +280,11 @@ fn parse_edge_kinds(
275280 kinds. extend ( & [ "normal" , "build" , "dev" ] ) ;
276281 }
277282
278- ( kinds, no_proc_macro)
283+ if public && !gctx. cli_unstable ( ) . unstable_options {
284+ anyhow:: bail!( "`--edges public` requires `-Zunstable-options`" ) ;
285+ }
286+
287+ ( kinds, no_proc_macro, public)
279288 } ;
280289
281290 let mut result = HashSet :: new ( ) ;
@@ -312,7 +321,7 @@ fn parse_edge_kinds(
312321 k => return unknown ( k) ,
313322 } ;
314323 }
315- return Ok ( ( result, no_proc_macro) ) ;
324+ return Ok ( ( result, no_proc_macro, public ) ) ;
316325 }
317326 for kind in & kinds {
318327 match * kind {
@@ -338,5 +347,5 @@ fn parse_edge_kinds(
338347 if kinds. len ( ) == 1 && kinds[ 0 ] == "features" {
339348 insert_defaults ( & mut result) ;
340349 }
341- Ok ( ( result, no_proc_macro) )
350+ Ok ( ( result, no_proc_macro, public ) )
342351}
0 commit comments