Skip to content

Instantly share code, notes, and snippets.

@lqd
Last active June 29, 2018 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lqd/e962785da3090718e0a64666cf237a27 to your computer and use it in GitHub Desktop.
Save lqd/e962785da3090718e0a64666cf237a27 to your computer and use it in GitHub Desktop.
- liballoc: 4 errors
error[E0311]: the parameter type `K` may not live long enough
--> liballoc/btree/map.rs:158:19
|
158 | match node.force() {
| ^^^^
|
= help: consider adding an explicit lifetime bound for `K`
note: the parameter type `K` must be valid for the anonymous lifetime #1 defined on the function body at 152:9...
--> liballoc/btree/map.rs:152:9
|
152 | / fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153 | | K,
154 | | V,
155 | | marker::LeafOrInternal>)
... |
213 | | }
214 | | }
| |_________^
error[E0311]: the parameter type `V` may not live long enough
--> liballoc/btree/map.rs:158:19
|
158 | match node.force() {
| ^^^^
|
= help: consider adding an explicit lifetime bound for `V`
note: the parameter type `V` must be valid for the anonymous lifetime #1 defined on the function body at 152:9...
--> liballoc/btree/map.rs:152:9
|
152 | / fn clone_subtree<K: Clone, V: Clone>(node: node::NodeRef<marker::Immut,
153 | | K,
154 | | V,
155 | | marker::LeafOrInternal>)
... |
213 | | }
214 | | }
| |_________^
error[E0311]: the parameter type `K` may not live long enough
--> liballoc/btree/map.rs:1077:37
|
1077 | if let Internal(node) = node.force() {
| ^^^^
|
= help: consider adding an explicit lifetime bound for `K`
note: the parameter type `K` must be valid for the anonymous lifetime #1 defined on the function body at 1074:9...
--> liballoc/btree/map.rs:1074:9
|
1074 | / fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
1075 | | let mut res = node.len();
1076 | |
1077 | | if let Internal(node) = node.force() {
... |
1092 | | res
1093 | | }
| |_________^
error[E0311]: the parameter type `V` may not live long enough
--> liballoc/btree/map.rs:1077:37
|
1077 | if let Internal(node) = node.force() {
| ^^^^
|
= help: consider adding an explicit lifetime bound for `V`
note: the parameter type `V` must be valid for the anonymous lifetime #1 defined on the function body at 1074:9...
--> liballoc/btree/map.rs:1074:9
|
1074 | / fn dfs<K, V>(node: NodeRef<marker::Immut, K, V, marker::LeafOrInternal>) -> usize {
1075 | | let mut res = node.len();
1076 | |
1077 | | if let Internal(node) = node.force() {
... |
1092 | | res
1093 | | }
| |_________^
error: aborting due to 4 previous errors
error: Could not compile `alloc`.
-> TODO: find out more about these; they might be related to temporary lifetimes since there's a reference in the terminal expression ?
(and also interact with anonymous lifetimes).
Naively extracting most of this code doesn't seem to reproduce the error so I must have been doing it wrong
already tracked as https://github.com/rust-lang/rust/issues/48224 where niko said he might have a fix
- liballoc_jemalloc: seems ok
- liballoc_system: seems ok
- libarena: ok
- submodule libcompiler_builtins: untested
- libcore: ICE
thread 'rustc' panicked at 'region_obligations not empty: [
(
NodeId(
13959
),
RegionObligation(sub_region='_#1r, sup_type=T)
)
]', librustc/infer/mod.rs:1057:9
-> ICE seems like known issue https://github.com/rust-lang/rust/issues/51649
https://github.com/rust-lang/rust/pull/51460#issuecomment-396698469
https://github.com/rust-lang/rust/issues/51649#issuecomment-400799282
-> after updating to latest rev removing some of the ICEs: 4 denied "unused mut" warnings
error: variable does not need to be mutable
--> libcore/iter/mod.rs:1792:13
|
1792 | let mut count = self.count;
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> libcore/iter/mod.rs:1821:13
|
1821 | let mut count = self.count + self.iter.len();
| ----^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> libcore/iter/mod.rs:1834:13
|
1834 | let mut count = self.count + self.iter.len();
| ----^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> libcore/iter/mod.rs:2324:13
|
2324 | let mut n = self.len();
| ----^
| |
| help: remove this `mut`
error: aborting due to 4 previous errors
error: Could not compile `core`.
-> those 4 incorrect warnings are the ones we hit elsewhere, a known issue about this lint & move closures
- libfmt_macros: ok
- libgraphviz: ok
- submodule liblibc: untested
- libpanic_abort: ok
- libpanic_unwind: ok
- libproc_macro: ok
- libprofiler_builtins: ok
- librustc: 5 denied warnings
error: variable does not need to be mutable
--> librustc/hir/lowering.rs:1057:44
|
1057 | guard: arm.guard.as_ref().map(|ref x| P(self.lower_expr(x))),
| ----^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc/hir/lowering.rs:2769:21
|
2769 | let mut ret_def = defs.next().unwrap_or(Def::Err);
| ----^^^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc/traits/error_reporting.rs:451:79
|
451 | let normalize = |candidate| self.tcx.global_tcx().infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc/ty/mod.rs:2106:13
|
2106 | let mut prev_discr = None::<Discr<'tcx>>;
| ----^^^^^^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc/util/ppaux.rs:351:29
|
351 | let mut types = substs.types().rev().skip(child_types);
| ----^^^^^
| |
| help: remove this `mut`
error: aborting due to 5 previous errors
error: Could not compile `rustc`.
-> 1st warning: common incorrect warning on closures, eg repro in the summary of crate "librustc_lint"
-> 2nd warning: correct, the "mut" can be removed, "now correctly warned by MIR borrowck"
-> 3rd warning: common incorrect warning on closures
-> 4th warning: incorrect warning, "prev_discr" is assigned inside the closure, removing the "mut" will fail to compile
minimized repro https://play.rust-lang.org/?gist=bad0f50fef757aa9ba1499254b104fa2&version=nightly&mode=debug
note: when the closure is not "move", there is no incorrect "unused mut" warning
seems to be already tracked:
https://github.com/rust-lang/rust/issues/51801
https://github.com/rust-lang/rust/issues/51830
https://github.com/rust-lang/rust/issues/50897
-> 5th warning: correct, the "mut" can be removed, "now correctly warned by MIR borrowck"
- librustc_allocator: ok
- librustc_apfloat: ok
- librustc_asan: ok
- librustc_borrowck: ok
- librustc_codegen_llvm: ok
- librustc_codegen_utils: ok
- librustc_cratesio_shim: ok, but does this actually check the 2 extern crates?
- librustc_data_structures: ICE
thread 'rustc' panicked at 'region_obligations not empty: [
(
NodeId(
2018
),
RegionObligation(sub_region='_#1r, sup_type=accumulate_vec::AccumulateVec<A>)
)
]', librustc/infer/mod.rs:1057:9
query stack during panic:
#0 [mir_borrowck] processing `<small_vec::SmallVec<A> as std::ops::Deref>::deref`
end of query stack
-> ICE seems like known issue https://github.com/rust-lang/rust/issues/51649
w/ minimized comment https://github.com/rust-lang/rust/pull/51460#issuecomment-396698469
and possibly even more minimized (and here it's also a Deref like this SmallVec ICE) https://github.com/rust-lang/rust/issues/51649#issuecomment-400799282
-> after updating to rev which removes this ICE: 2 denied warnings
error: variable does not need to be mutable
--> librustc_data_structures/bitvec.rs:385:13
|
385 | let mut bits = self.bits;
| ----^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_data_structures/sorted_map.rs:59:21
|
59 | let mut slot = unsafe {
| ----^^^^
| |
| help: remove this `mut`
error: aborting due to 2 previous errors
error: Could not compile `rustc_data_structures`.
-> 1st warning: common incorrect unused mut warning with move closures
-> 2nd warning: correct, "mut" can be removed, "now correctly warned by MIR borrowck"
- librustc_driver: 2 denied warnings
error: variable does not need to be mutable
--> librustc_driver/pretty.rs:894:9
|
894 | let mut rdr = &*src;
| ----^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_driver/pretty.rs:950:9
|
950 | let mut rdr = &src[..];
| ----^^^
| |
| help: remove this `mut`
error: aborting due to 2 previous errors
error: Could not compile `rustc_driver`.
-> 2 warnings: incorrect, a "&mut rdr" is done inside a move closure, seems like a similar case to the one seen in
librustc "prev_discr" (w/ minimized repro there) — removing the "mut" will fail to compile;
Looks like the fact that the closure is "move" is part of the problem for the lint.
- librustc_errors: ok
- librustc_incremental: ok
- librustc_lint: 2 denied warnings
error: variable does not need to be mutable
--> librustc_lint/builtin.rs:696:48
|
696 | let has_hints = list.as_ref().map(|ref list| !list.is_empty()).unwrap_or(false);
| ----^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_lint/unused.rs:136:25
|
136 | let mut msg = format!("unused {}`{}` which must be used",
| ----^^^
| |
| help: remove this `mut`
error: aborting due to 2 previous errors
error: Could not compile `rustc_lint`.
-> 1st warning: common incorrect warning on closures, minimized https://play.rust-lang.org/?gist=96e87e9946fca3db5273c6ac87008af9&version=nightly&mode=debug
also seems to be tracked as https://github.com/rust-lang/rust/issues/51830
-> 2nd warning: correct, "mut" can be removed, "now correctly warned by MIR borrowck"
- librustc_llvm: ok
- librustc_lsan: ok
- librustc_metadata: ok
- librustc_mir: 2 denied warnings + ICE
error: variable does not need to be mutable
--> librustc_mir/borrow_check/nll/region_infer/mod.rs:527:17
|
527 | let mut head = &mut map[constraint.sub];
| ----^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_mir/build/matches/test.rs:262:21
|
262 | let mut val = Operand::Copy(place.clone());
| ----^^^
| |
| help: remove this `mut`
thread 'rustc' panicked at 'region_obligations not empty: [
(
NodeId(
38075
),
RegionObligation(sub_region='_#3r, sup_type=dataflow::DataflowState<BD>)
)
]', librustc/infer/mod.rs:1057:9
-> 1st warning: correct, the "mut" can be removed, "now correctly warned by MIR borrowck"
-> 2nd warning: correct, the "mut" can be removed, "now correctly warned by MIR borrowck"
-> ICE seems like the same as librustc_data_structures and others, https://github.com/rust-lang/rust/issues/51649
after updating to more recent rust rev removing this ICE: 3 denied warnings
error: variable does not need to be mutable
--> librustc_mir/borrow_check/nll/region_infer/mod.rs:524:17
|
524 | let mut head = &mut map[constraint.sub];
| ----^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_mir/transform/promote_consts.rs:423:13
|
423 | let mut promoter = Promoter {
| ----^^^^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc_mir/monomorphize/partitioning.rs:356:23
|
356 | let (linkage, mut visibility) = match mono_item.explicit_linkage(tcx) {
| ----^^^^^^^^^^
| |
| help: remove this `mut`
error: aborting due to 3 previous errors
error: Could not compile `rustc_mir`.
-> 3 warnings seem correct, the "mut" can be removed, "now correctly warned by MIR borrowck"
- librustc_msan: ok
- librustc_passes: 1 error
error[E0502]: cannot borrow `*self.tables` as immutable because it is also borrowed as mutable
--> librustc_passes/rvalue_promotion.rs:206:76
|
206 | euv::ExprUseVisitor::new(self, tcx, param_env, &region_scope_tree, self.tables, None)
| -------------------------------------------------------------------^^^^^^^^^^^-------
| | | |
| | | immutable borrow occurs here
| | mutable borrow occurs here
| borrow later used here
error: aborting due to previous error
error: Could not compile `rustc_passes`.
-> the error is interesting, AST borrowck accepts this; feels correct to reject right now but maybe not in the future
repro: https://play.rust-lang.org/?gist=9b797f941b3aa419991e15fd5a2d07a0&version=nightly&mode=debug
(we may already be tracking this in our "fixed by NLL" category, and might want to accept this with expansions to 2-phase borrows)
- librustc_platform_intrinsics: ok
- librustc_plugin: ok
- librustc_privacy: ok
- librustc_resolve: 1 denied warning
error: variable does not need to be mutable
--> librustc_resolve/resolve_imports.rs:921:17
|
921 | let mut import = this.import_map.entry(directive.id).or_default();
| ----^^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: aborting due to previous error
error: Could not compile `rustc_resolve`.
-> warning is correct, "mut" can be removed, and seems missed by AST borrowck here, as "import" is an indexable mutable reference
probably no need to document that this is "now correctly warned by MIR borrowck" per se, but will be a new warning
- librustc_save_analysis: 1 denied warning
error: variable does not need to be mutable
--> librustc_save_analysis/lib.rs:427:33
|
427 | let mut trait_id = self.tcx.trait_id_of_impl(impl_id);
| ----^^^^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: aborting due to previous error
error: Could not compile `rustc_save_analysis`.
-> the warning is correct: "mut" can be removed here; "now correctly warned by MIR borrowck"
- librustc_target: ok
- librustc_traits:
error: variable does not need to be mutable
--> librustc_traits/dropck_outlives.rs:29:29
|
29 | tcx.infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_traits/evaluate_obligation.rs:21:29
|
21 | tcx.infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc_traits/normalize_projection_ty.rs:28:29
|
28 | tcx.infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
error: aborting due to 3 previous errors
error: Could not compile `rustc_traits`.
-> 3 warnings: seem the same incorrect one on closures
- librustc_tsan: seems ok
- librustc_typeck: 3 denied warnings + ICE
error: variable does not need to be mutable
--> librustc_typeck/lib.rs:159:29
|
159 | tcx.infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: variable does not need to be mutable
--> librustc_typeck/check/mod.rs:3282:51
|
3282 | let skip_fields = skip_fields.iter().map(|ref x| x.ident.as_str());
| ----^
| |
| help: remove this `mut`
error: variable does not need to be mutable
--> librustc_typeck/check/dropck.rs:84:29
|
84 | tcx.infer_ctxt().enter(|ref infcx| {
| ----^^^^^
| |
| help: remove this `mut`
error: internal compiler error: librustc_mir/borrow_check/nll/universal_regions.rs:825: cannot convert `ReFree(DefId(0/0:1927 ~ rustc_typeck[3cb7]::outlives[0]::inferred_outlives_crate[0]), BrNamed(crate0:DefIndex(1:1303), 'tcx))` to a region vid
-> 3 warnings: seem the same incorrect one on closures
-> ICE: seems like known issue 51351 with repro https://github.com/rust-lang/rust/issues/51351#issuecomment-399038226
- librustdoc: ok
- libserialize: 1 denied warning
error: variable does not need to be mutable
--> libserialize/serialize.rs:227:37
|
227 | fn read_option<T, F>(&mut self, mut f: F) -> Result<T, Self::Error>
| ----^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: aborting due to previous error
error: Could not compile `serialize`.
-> seems like the same unused mut warning with move closures
- libstd: ok
- libstd_unicode: deprecated but what is there is ok
- libsyntax: 1 denied warning
error: variable does not need to be mutable
--> libsyntax/parse/parser.rs:2538:40
|
2538 | mut attrs: ThinVec<Attribute>)
| ----^^^^^
| |
| help: remove this `mut`
|
= note: `-D unused-mut` implied by `-D warnings`
error: aborting due to previous error
error: Could not compile `syntax`.
-> common incorrect unused mut warning with closures which definitely mutate the value
- libsyntax_ext: ICE
error: internal compiler error: broken MIR in DefId(0/0:703 ~ syntax_ext[d609]::register_builtins[0]) (_426 = move _427): bad assignment (for<'cx, 'r, 's> fn(&'cx mut syntax::ext::base::ExtCtxt<'r>, syntax_pos::Span, &'s [syntax::tokenstream::TokenTree]) -> std::boxed::Box<(dyn syntax::ext::base::MacResult + 'cx)> = for<'r, 's, 't0> fn(&'r mut syntax::ext::base::ExtCtxt<'s>, syntax_pos::Span, &'t0 [syntax::tokenstream::TokenTree]) -> std::boxed::Box<dyn syntax::ext::base::MacResult>): NoSolution
--> libsyntax_ext/lib.rs:76:44
|
76 | expander: Box::new($f as MacroExpanderFn),
| ^^^^^^^^^^^^^^^^^^^^^
...
106 | / register! {
107 | | line: expand_line,
108 | | __rust_unstable_column: expand_column_gated,
109 | | column: expand_column,
... |
127 | | assert: assert::expand_assert,
128 | | }
| |_____- in this macro invocation
error: aborting due to previous error
error: Could not compile `syntax_ext`.
-> seems like known issue from previous tries of bootstrap https://github.com/rust-lang/rust/issues/48071
and minimal repro here https://github.com/rust-lang/rust/issues/49250#issuecomment-381363452
- libsyntax_pos: ok
- libterm: ok
- libtest: ok
- libunwind: ok
- rustc: if it is built by x.py build, then it is ok.
- stdsimd: untested, is it built by x.py build ?
- tools: untested, are they built by x.py build ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment