@@ -63,17 +63,181 @@ fn dependency_project() -> Project {
63
63
nightly,
64
64
reason = "-Zfuture-incompat-test requires nightly (permanently)"
65
65
) ]
66
- fn output_on_stable ( ) {
66
+ fn incompat_in_local_crate ( ) {
67
+ // A simple example where a local crate triggers a future-incompatibility warning.
67
68
let p = local_project ( ) ;
68
69
69
70
p. cargo ( "check" )
70
71
. env ( "RUSTFLAGS" , "-Zfuture-incompat-test" )
71
72
. with_stderr_data ( str![ [ r#"
73
+ [CHECKING] foo v0.0.0 ([ROOT]/foo)
74
+ [WARNING] unused variable: `x`
72
75
...
76
+
77
+ [WARNING] `foo` (lib) generated 1 warning
78
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
79
+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 ([ROOT]/foo)
80
+ [NOTE] to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
81
+
82
+ "# ] ] )
83
+ . run ( ) ;
84
+
85
+ p. cargo ( "check --future-incompat-report" )
86
+ . env ( "RUSTFLAGS" , "-Zfuture-incompat-test" )
87
+ . with_stderr_data ( str![ [ r#"
73
88
[WARNING] unused variable: `x`
74
89
...
90
+
91
+ [WARNING] `foo` (lib) generated 1 warning
92
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
93
+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: foo v0.0.0 ([ROOT]/foo)
94
+ [NOTE]
95
+ To solve this problem, you can try the following approaches:
96
+
97
+
98
+ - If the issue is not solved by updating the dependencies, a fix has to be
99
+ implemented by those dependencies. You can help with that by notifying the
100
+ maintainers of this problem (e.g. by creating a bug report) or by proposing a
101
+ fix to the maintainers (e.g. by creating a pull request):
102
+
103
+ - foo@0.0.0
104
+ - Repository: <not found>
105
+ - Detailed warning command: `cargo report future-incompatibilities --id 2 --package foo@0.0.0`
106
+
107
+ - If waiting for an upstream fix is not an option, you can use the `[patch]`
108
+ section in `Cargo.toml` to use your own version of the dependency. For more
109
+ information, see:
110
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
111
+
112
+ [NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
113
+
114
+ "# ] ] )
115
+ . run ( ) ;
116
+
117
+ p. cargo ( "report future-incompatibilities --id 1" )
118
+ . with_stdout_data ( str![ [ r#"
119
+ The following warnings were discovered during the build. These warnings are an
120
+ indication that the packages contain code that will become an error in a
121
+ future release of Rust. These warnings typically cover changes to close
122
+ soundness problems, unintended or undocumented behavior, or critical problems
123
+ that cannot be fixed in a backwards-compatible fashion, and are not expected
124
+ to be in wide use.
125
+
126
+ Each warning should contain a link for more information on what the warning
127
+ means and how to resolve it.
128
+
129
+
130
+ To solve this problem, you can try the following approaches:
131
+
132
+
133
+ - If the issue is not solved by updating the dependencies, a fix has to be
134
+ implemented by those dependencies. You can help with that by notifying the
135
+ maintainers of this problem (e.g. by creating a bug report) or by proposing a
136
+ fix to the maintainers (e.g. by creating a pull request):
137
+
138
+ - foo@0.0.0
139
+ - Repository: <not found>
140
+ - Detailed warning command: `cargo report future-incompatibilities --id 1 --package foo@0.0.0`
141
+
142
+ - If waiting for an upstream fix is not an option, you can use the `[patch]`
143
+ section in `Cargo.toml` to use your own version of the dependency. For more
144
+ information, see:
145
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
146
+
147
+ The package `foo v0.0.0 ([ROOT]/foo)` currently triggers the following future incompatibility lints:
148
+ > [WARNING] unused variable: `x`
149
+ ...
150
+
151
+ "# ] ] )
152
+ . run ( ) ;
153
+ }
154
+
155
+ #[ cargo_test(
156
+ nightly,
157
+ reason = "-Zfuture-incompat-test requires nightly (permanently)"
158
+ ) ]
159
+ fn incompat_in_dependency ( ) {
160
+ // A simple example where a remote dependency triggers a future-incompatibility warning.
161
+ let p = dependency_project ( ) ;
162
+
163
+ p. cargo ( "check" )
164
+ . env ( "RUSTFLAGS" , "-Zfuture-incompat-test" )
165
+ . with_stderr_data ( str![ [ r#"
166
+ [UPDATING] `dummy-registry` index
167
+ [LOCKING] 1 package to latest compatible version
168
+ [DOWNLOADING] crates ...
169
+ [DOWNLOADED] bar v1.0.0 (registry `dummy-registry`)
170
+ [CHECKING] bar v1.0.0
171
+ [CHECKING] foo v1.0.0 ([ROOT]/foo)
172
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
173
+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: bar v1.0.0
75
174
[NOTE] to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
76
175
176
+ "# ] ] )
177
+ . run ( ) ;
178
+
179
+ p. cargo ( "check --future-incompat-report" )
180
+ . env ( "RUSTFLAGS" , "-Zfuture-incompat-test" )
181
+ . with_stderr_data ( str![ [ r#"
182
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
183
+ [WARNING] the following packages contain code that will be rejected by a future version of Rust: bar v1.0.0
184
+ [NOTE]
185
+ To solve this problem, you can try the following approaches:
186
+
187
+
188
+ - If the issue is not solved by updating the dependencies, a fix has to be
189
+ implemented by those dependencies. You can help with that by notifying the
190
+ maintainers of this problem (e.g. by creating a bug report) or by proposing a
191
+ fix to the maintainers (e.g. by creating a pull request):
192
+
193
+ - bar@1.0.0
194
+ - Repository: https://example.com/
195
+ - Detailed warning command: `cargo report future-incompatibilities --id 2 --package bar@1.0.0`
196
+
197
+ - If waiting for an upstream fix is not an option, you can use the `[patch]`
198
+ section in `Cargo.toml` to use your own version of the dependency. For more
199
+ information, see:
200
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
201
+
202
+ [NOTE] this report can be shown with `cargo report future-incompatibilities --id 1`
203
+
204
+ "# ] ] )
205
+ . run ( ) ;
206
+
207
+ p. cargo ( "report future-incompatibilities --id 1" )
208
+ . with_stdout_data ( str![ [ r#"
209
+ The following warnings were discovered during the build. These warnings are an
210
+ indication that the packages contain code that will become an error in a
211
+ future release of Rust. These warnings typically cover changes to close
212
+ soundness problems, unintended or undocumented behavior, or critical problems
213
+ that cannot be fixed in a backwards-compatible fashion, and are not expected
214
+ to be in wide use.
215
+
216
+ Each warning should contain a link for more information on what the warning
217
+ means and how to resolve it.
218
+
219
+
220
+ To solve this problem, you can try the following approaches:
221
+
222
+
223
+ - If the issue is not solved by updating the dependencies, a fix has to be
224
+ implemented by those dependencies. You can help with that by notifying the
225
+ maintainers of this problem (e.g. by creating a bug report) or by proposing a
226
+ fix to the maintainers (e.g. by creating a pull request):
227
+
228
+ - bar@1.0.0
229
+ - Repository: https://example.com/
230
+ - Detailed warning command: `cargo report future-incompatibilities --id 1 --package bar@1.0.0`
231
+
232
+ - If waiting for an upstream fix is not an option, you can use the `[patch]`
233
+ section in `Cargo.toml` to use your own version of the dependency. For more
234
+ information, see:
235
+ https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
236
+
237
+ The package `bar v1.0.0` currently triggers the following future incompatibility lints:
238
+ > [WARNING] unused variable: `x`
239
+ ...
240
+
77
241
"# ] ] )
78
242
. run ( ) ;
79
243
}
0 commit comments