Skip to content
Permalink
Browse files

Auto merge of #63752 - Centril:rollup-nlxwety, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #62497 (Fix double resolving custom libdir)
 - #63209 (Stabilize `async_await` in Rust 1.39.0)
 - #63746 (Cherry-pick src/test changes with Centril's changes)
 - #63750 (rustc_metadata: replace LazySeq<T> with Lazy<[T]>.)

Failed merges:

r? @ghost
  • Loading branch information...
bors committed Aug 20, 2019
2 parents 5a56e05 + e3e8b7f commit bea0372a1a7a31b81f28cc4d9a83a2dc9a79d008
Showing with 801 additions and 1,139 deletions.
  1. +13 −7 src/bootstrap/builder.rs
  2. +9 −4 src/bootstrap/dist.rs
  3. +0 −2 src/librustc/error_codes.rs
  4. +4 −4 src/librustc_metadata/cstore.rs
  5. +19 −16 src/librustc_metadata/decoder.rs
  6. +195 −196 src/librustc_metadata/encoder.rs
  7. +5 −5 src/librustc_metadata/index.rs
  8. +78 −75 src/librustc_metadata/schema.rs
  9. +0 −2 src/librustc_typeck/check/mod.rs
  10. +2 −5 src/librustc_typeck/error_codes.rs
  11. +0 −2 src/libstd/keyword_docs.rs
  12. +2 −17 src/libsyntax/feature_gate.rs
  13. +0 −3 src/test/codegen/issue-45222.rs
  14. +9 −9 src/test/incremental/hashes/call_expressions.rs
  15. +6 −6 src/test/incremental/hashes/closure_expressions.rs
  16. +6 −6 src/test/incremental/hashes/consts.rs
  17. +8 −8 src/test/incremental/hashes/if_expressions.rs
  18. +7 −7 src/test/incremental/hashes/indexing_expressions.rs
  19. +6 −6 src/test/incremental/hashes/inline_asm.rs
  20. +8 −8 src/test/incremental/hashes/loop_expressions.rs
  21. +9 −9 src/test/incremental/hashes/panic_exprs.rs
  22. +10 −10 src/test/incremental/hashes/statics.rs
  23. +9 −9 src/test/incremental/hashes/struct_constructors.rs
  24. +60 −61 src/test/incremental/hashes/trait_defs.rs
  25. +9 −9 src/test/incremental/hashes/while_let_loops.rs
  26. +9 −9 src/test/incremental/hashes/while_loops.rs
  27. +0 −2 src/test/rustdoc/async-fn.rs
  28. +2 −4 src/test/rustdoc/async-move-doctest.rs
  29. +0 −3 src/test/rustdoc/edition-flag.rs
  30. +0 −1 src/test/ui/async-await/argument-patterns.rs
  31. +0 −2 src/test/ui/async-await/async-await.rs
  32. +0 −2 src/test/ui/async-await/async-block-control-flow-static-semantics.rs
  33. +8 −8 src/test/ui/async-await/async-block-control-flow-static-semantics.stderr
  34. +1 −1 src/test/ui/async-await/async-closure-matches-expr.rs
  35. +1 −1 src/test/ui/async-await/async-closure.rs
  36. +1 −2 src/test/ui/async-await/async-error-span.rs
  37. +2 −2 src/test/ui/async-await/async-error-span.stderr
  38. +0 −2 src/test/ui/async-await/async-fn-elided-impl-lifetime-parameter.rs
  39. +0 −2 src/test/ui/async-await/async-fn-nonsend.rs
  40. +16 −16 src/test/ui/async-await/async-fn-nonsend.stderr
  41. +0 −3 src/test/ui/async-await/async-fn-path-elision.rs
  42. +1 −1 src/test/ui/async-await/async-fn-path-elision.stderr
  43. +0 −2 src/test/ui/async-await/async-fn-send-uses-nonsend.rs
  44. +0 −2 src/test/ui/async-await/async-fn-size-moved-locals.rs
  45. +0 −2 src/test/ui/async-await/async-fn-size.rs
  46. +0 −2 src/test/ui/async-await/async-matches-expr.rs
  47. +0 −2 src/test/ui/async-await/async-unsafe-fn-call-in-safe.rs
  48. +4 −4 src/test/ui/async-await/async-unsafe-fn-call-in-safe.stderr
  49. +0 −2 src/test/ui/async-await/async-with-closure.rs
  50. +0 −1 src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.rs
  51. +11 −11 src/test/ui/async-await/await-keyword/2015-edition-error-various-positions.stderr
  52. +0 −1 src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.rs
  53. +7 −7 src/test/ui/async-await/await-keyword/2018-edition-error-in-non-macro-position.stderr
  54. +0 −2 src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.rs
  55. +35 −35 src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
  56. +0 −2 src/test/ui/async-await/await-unsize.rs
  57. +0 −2 src/test/ui/async-await/bound-normalization.rs
  58. +0 −2 src/test/ui/async-await/conditional-and-guaranteed-initialization.rs
  59. +0 −1 src/test/ui/async-await/dont-print-desugared-async.rs
  60. +1 −1 src/test/ui/async-await/dont-print-desugared-async.stderr
  61. +0 −2 src/test/ui/async-await/dont-suggest-missing-await.rs
  62. +1 −1 src/test/ui/async-await/dont-suggest-missing-await.stderr
  63. +0 −1 src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs
  64. +0 −1 src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs
  65. +0 −2 src/test/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs
  66. +0 −3 src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.rs
  67. +4 −4 src/test/ui/async-await/drop-order/drop-order-locals-are-hidden.stderr
  68. +0 −3 src/test/ui/async-await/drop-order/drop-order-when-cancelled.rs
  69. +0 −2 src/test/ui/async-await/edition-deny-async-fns-2015.rs
  70. +10 −10 src/test/ui/async-await/edition-deny-async-fns-2015.stderr
  71. +0 −2 src/test/ui/async-await/generics-and-bounds.rs
  72. +0 −3 src/test/ui/async-await/issue-60709.rs
  73. +0 −1 src/test/ui/async-await/issue-61452.rs
  74. +2 −2 src/test/ui/async-await/issue-61452.stderr
  75. +0 −3 src/test/ui/async-await/issue-61793.rs
  76. +0 −1 src/test/ui/async-await/issue-61949-self-return-type.rs
  77. +1 −1 src/test/ui/async-await/issue-61949-self-return-type.stderr
  78. +0 −2 src/test/ui/async-await/issue-62658.rs
  79. +0 −2 src/test/ui/async-await/issues/issue-51719.rs
  80. +1 −1 src/test/ui/async-await/issues/issue-51719.stderr
  81. +0 −2 src/test/ui/async-await/issues/issue-51751.rs
  82. +1 −1 src/test/ui/async-await/issues/issue-51751.stderr
  83. +1 −1 src/test/ui/async-await/issues/issue-53249.rs
  84. +0 −3 src/test/ui/async-await/issues/issue-54752-async-block.rs
  85. +0 −2 src/test/ui/async-await/issues/issue-54974.rs
  86. +0 −3 src/test/ui/async-await/issues/issue-55324.rs
  87. +0 −2 src/test/ui/async-await/issues/issue-55809.rs
  88. +0 −2 src/test/ui/async-await/issues/issue-58885.rs
  89. +0 −3 src/test/ui/async-await/issues/issue-59001.rs
  90. +0 −6 src/test/ui/async-await/issues/issue-59972.rs
  91. +0 −2 src/test/ui/async-await/issues/issue-60518.rs
  92. +0 −1 src/test/ui/async-await/issues/issue-60655-latebound-regions.rs
  93. +0 −1 src/test/ui/async-await/issues/issue-60674.rs
  94. +1 −3 src/test/ui/async-await/issues/issue-61187.rs
  95. +1 −1 src/test/ui/async-await/issues/issue-61187.stderr
  96. +0 −2 src/test/ui/async-await/issues/issue-61986.rs
  97. +0 −2 src/test/ui/async-await/issues/issue-62009-1.rs
  98. +6 −6 src/test/ui/async-await/issues/issue-62009-1.stderr
  99. +1 −1 src/test/ui/async-await/issues/issue-62009-2.rs
  100. +0 −2 src/test/ui/async-await/issues/issue-62517-1.rs
  101. +0 −2 src/test/ui/async-await/issues/issue-62517-2.rs
  102. +2 −2 src/test/ui/async-await/issues/issue-63388-1.nll.stderr
  103. +0 −2 src/test/ui/async-await/issues/issue-63388-1.rs
  104. +1 −1 src/test/ui/async-await/issues/issue-63388-1.stderr
  105. +1 −1 src/test/ui/async-await/issues/issue-63388-2.nll.stderr
  106. +0 −2 src/test/ui/async-await/issues/issue-63388-2.rs
  107. +5 −5 src/test/ui/async-await/issues/issue-63388-2.stderr
  108. +0 −2 src/test/ui/async-await/issues/issue-63388-3.rs
  109. +0 −2 src/test/ui/async-await/issues/issue-63388-4.rs
  110. +0 −1 src/test/ui/async-await/issues/non-async-enclosing-span.rs
  111. +1 −1 src/test/ui/async-await/issues/non-async-enclosing-span.stderr
  112. +0 −2 src/test/ui/async-await/move-part-await-return-rest-struct.rs
  113. +0 −2 src/test/ui/async-await/move-part-await-return-rest-tuple.rs
  114. +0 −2 src/test/ui/async-await/multiple-lifetimes/elided.rs
  115. +0 −2 src/test/ui/async-await/multiple-lifetimes/fn-ptr.rs
  116. +0 −3 src/test/ui/async-await/multiple-lifetimes/hrtb.rs
  117. +0 −2 src/test/ui/async-await/multiple-lifetimes/named.rs
  118. +0 −2 src/test/ui/async-await/multiple-lifetimes/partial-relation.rs
  119. +1 −1 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-fg.rs
  120. +0 −2 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-no-fg.rs
  121. +1 −1 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-no-fg.stderr
  122. +1 −1 src/test/ui/async-await/multiple-lifetimes/ret-impl-trait-one.rs
  123. +0 −2 src/test/ui/async-await/multiple-lifetimes/ret-ref.rs
  124. +3 −3 src/test/ui/async-await/multiple-lifetimes/ret-ref.stderr
  125. +0 −3 src/test/ui/async-await/multiple-lifetimes/variance.rs
  126. +0 −2 src/test/ui/async-await/nested-in-impl.rs
  127. +1 −1 src/test/ui/async-await/no-args-non-move-async-closure.rs
  128. +0 −2 src/test/ui/async-await/no-async-const.rs
  129. +1 −1 src/test/ui/async-await/no-async-const.stderr
  130. +0 −2 src/test/ui/async-await/no-const-async.rs
  131. +2 −2 src/test/ui/async-await/no-const-async.stderr
  132. +0 −2 src/test/ui/async-await/no-move-across-await-struct.rs
  133. +1 −1 src/test/ui/async-await/no-move-across-await-struct.stderr
  134. +0 −2 src/test/ui/async-await/no-move-across-await-tuple.rs
  135. +1 −1 src/test/ui/async-await/no-move-across-await-tuple.stderr
  136. +0 −2 src/test/ui/async-await/no-non-guaranteed-initialization.rs
  137. +1 −1 src/test/ui/async-await/no-non-guaranteed-initialization.stderr
  138. +0 −2 src/test/ui/async-await/partial-initialization-across-await.rs
  139. +3 −3 src/test/ui/async-await/partial-initialization-across-await.stderr
  140. +0 −2 src/test/ui/async-await/recursive-async-impl-trait-type.rs
  141. +1 −1 src/test/ui/async-await/recursive-async-impl-trait-type.stderr
  142. +1 −1 src/test/ui/async-await/suggest-missing-await-closure.fixed
  143. +1 −1 src/test/ui/async-await/suggest-missing-await-closure.rs
  144. +0 −2 src/test/ui/async-await/suggest-missing-await.fixed
  145. +0 −2 src/test/ui/async-await/suggest-missing-await.rs
  146. +1 −1 src/test/ui/async-await/suggest-missing-await.stderr
  147. +1 −1 src/test/ui/async-await/unresolved_type_param.rs
  148. +16 −0 src/test/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
  149. +5 −5 src/test/ui/consts/min_const_fn/{min_const_fn_unsafe.stderr → min_const_fn_unsafe_bad.stderr}
  150. +1 −22 src/test/ui/consts/min_const_fn/{min_const_fn_unsafe.rs → min_const_fn_unsafe_ok.rs}
  151. +0 −3 src/test/ui/drop/dynamic-drop-async.rs
  152. +0 −9 src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
  153. +0 −31 src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
  154. +0 −18 src/test/ui/feature-gates/feature-gate-async-await.rs
  155. +0 −45 src/test/ui/feature-gates/feature-gate-async-await.stderr
  156. +1 −1 src/test/ui/generator/issue-61442-stmt-expr-with-drop.rs
  157. +0 −1 src/test/ui/generator/issue-62506-two_awaits.rs
  158. +0 −1 src/test/ui/impl-trait/bound-normalization-fail.rs
  159. +4 −4 src/test/ui/impl-trait/bound-normalization-fail.stderr
  160. +0 −1 src/test/ui/impl-trait/bound-normalization-pass.rs
  161. +1 −1 src/test/ui/impl-trait/bound-normalization-pass.stderr
  162. +2 −1 src/test/ui/impl-trait/issue-55872-2.rs
  163. +2 −2 src/test/ui/impl-trait/issue-55872-2.stderr
  164. +0 −1 src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.rs
  165. +2 −2 src/test/ui/inference/cannot-infer-async-enabled-impl-trait-bindings.stderr
  166. +0 −1 src/test/ui/inference/cannot-infer-async.rs
  167. +1 −1 src/test/ui/inference/cannot-infer-async.stderr
  168. +2 −4 src/test/ui/issues/issue-31776.rs
  169. +2 −4 src/test/ui/issues/issue-50415.rs
  170. +2 −2 src/test/ui/issues/issue-5067.rs
  171. +1 −1 src/test/ui/lint/lint-unused-mut-variables.rs
  172. +1 −1 src/test/ui/lint/lint-unused-variables.rs
  173. +0 −2 src/test/ui/macros/restricted-shadowing-modern.rs
  174. +9 −9 src/test/ui/macros/restricted-shadowing-modern.stderr
  175. +1 −1 src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.nll.stderr
  176. +5 −5 src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.migrate.stderr
  177. +1 −1 src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.nll.stderr
  178. +0 −4 src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
  179. +1 −1 src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs
  180. +0 −2 src/test/ui/self/arbitrary_self_types_pin_lifetime-async.rs
  181. +1 −1 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.nll.stderr
  182. +0 −2 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.rs
  183. +4 −4 src/test/ui/self/arbitrary_self_types_pin_lifetime_impl_trait-async.stderr
  184. +5 −5 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.nll.stderr
  185. +0 −2 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.rs
  186. +3 −3 src/test/ui/self/arbitrary_self_types_pin_lifetime_mismatch-async.stderr
  187. +0 −2 src/test/ui/self/elision/alias-async.rs
  188. +0 −2 src/test/ui/self/elision/assoc-async.rs
  189. +0 −2 src/test/ui/self/elision/lt-alias-async.rs
  190. +0 −2 src/test/ui/self/elision/lt-assoc-async.rs
  191. +12 −12 src/test/ui/self/elision/lt-ref-self-async.nll.stderr
  192. +0 −2 src/test/ui/self/elision/lt-ref-self-async.rs
  193. +6 −6 src/test/ui/self/elision/lt-ref-self-async.stderr
  194. +0 −2 src/test/ui/self/elision/lt-self-async.rs
  195. +0 −2 src/test/ui/self/elision/lt-struct-async.rs
  196. +0 −2 src/test/ui/self/elision/multiple-ref-self-async.rs
  197. +0 −2 src/test/ui/self/elision/ref-alias-async.rs
  198. +0 −2 src/test/ui/self/elision/ref-assoc-async.rs
  199. +0 −1 src/test/ui/self/elision/ref-mut-alias-async.rs
  200. +12 −12 src/test/ui/self/elision/ref-mut-self-async.nll.stderr
  201. +0 −2 src/test/ui/self/elision/ref-mut-self-async.rs
  202. +6 −6 src/test/ui/self/elision/ref-mut-self-async.stderr
  203. +10 −10 src/test/ui/self/elision/ref-mut-struct-async.nll.stderr
  204. +0 −2 src/test/ui/self/elision/ref-mut-struct-async.rs
  205. +5 −5 src/test/ui/self/elision/ref-mut-struct-async.stderr
  206. +14 −14 src/test/ui/self/elision/ref-self-async.nll.stderr
  207. +0 −2 src/test/ui/self/elision/ref-self-async.rs
  208. +7 −7 src/test/ui/self/elision/ref-self-async.stderr
  209. +10 −10 src/test/ui/self/elision/ref-struct-async.nll.stderr
  210. +0 −2 src/test/ui/self/elision/ref-struct-async.rs
  211. +5 −5 src/test/ui/self/elision/ref-struct-async.stderr
  212. +0 −2 src/test/ui/self/elision/self-async.rs
  213. +0 −2 src/test/ui/self/elision/struct-async.rs
  214. +0 −2 src/test/ui/self/self_lifetime-async.rs
  215. +1 −1 src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs
  216. +2 −2 src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs
  217. +4 −4 src/test/ui/suggestions/dont-suggest-ref/simple.rs
  218. +0 −1 src/test/ui/traits/traits-conditional-model-fn.rs
@@ -618,13 +618,7 @@ impl<'a> Builder<'a> {
}

fn run(self, builder: &Builder<'_>) -> Interned<PathBuf> {
let compiler = self.compiler;
let config = &builder.build.config;
let lib = if compiler.stage >= 1 && config.libdir_relative().is_some() {
builder.build.config.libdir_relative().unwrap()
} else {
Path::new("lib")
};
let lib = builder.sysroot_libdir_relative(self.compiler);
let sysroot = builder
.sysroot(self.compiler)
.join(lib)
@@ -678,6 +672,18 @@ impl<'a> Builder<'a> {
}
}

/// Returns the compiler's relative libdir where the standard library and other artifacts are
/// found for a compiler's sysroot.
///
/// For example this returns `lib` on Unix and Windows.
pub fn sysroot_libdir_relative(&self, compiler: Compiler) -> &Path {
match self.config.libdir_relative() {
Some(relative_libdir) if compiler.stage >= 1
=> relative_libdir,
_ => Path::new("lib")
}
}

/// Adds the compiler's directory of dynamic libraries to `cmd`'s dynamic
/// library lookup path.
pub fn add_rustc_lib_path(&self, compiler: Compiler, cmd: &mut Command) {
@@ -469,7 +469,6 @@ impl Step for Rustc {
fn prepare_image(builder: &Builder<'_>, compiler: Compiler, image: &Path) {
let host = compiler.host;
let src = builder.sysroot(compiler);
let libdir = builder.rustc_libdir(compiler);

// Copy rustc/rustdoc binaries
t!(fs::create_dir_all(image.join("bin")));
@@ -481,20 +480,26 @@ impl Step for Rustc {

// Copy runtime DLLs needed by the compiler
if libdir_relative.to_str() != Some("bin") {
let libdir = builder.rustc_libdir(compiler);
for entry in builder.read_dir(&libdir) {
let name = entry.file_name();
if let Some(s) = name.to_str() {
if is_dylib(s) {
builder.install(&entry.path(), &image.join(&libdir_relative), 0o644);
// Don't use custom libdir here because ^lib/ will be resolved again
// with installer
builder.install(&entry.path(), &image.join("lib"), 0o644);
}
}
}
}

// Copy over the codegen backends
let backends_src = builder.sysroot_codegen_backends(compiler);
let backends_rel = backends_src.strip_prefix(&src).unwrap();
let backends_dst = image.join(&backends_rel);
let backends_rel = backends_src.strip_prefix(&src).unwrap()
.strip_prefix(builder.sysroot_libdir_relative(compiler)).unwrap();
// Don't use custom libdir here because ^lib/ will be resolved again with installer
let backends_dst = image.join("lib").join(&backends_rel);

t!(fs::create_dir_all(&backends_dst));
builder.cp_r(&backends_src, &backends_dst);

@@ -2088,7 +2088,6 @@ generator can be constructed.
Erroneous code example:
```edition2018,compile-fail,E0698
#![feature(async_await)]
async fn bar<T>() -> () {}
async fn foo() {
@@ -2101,7 +2100,6 @@ To fix this you must bind `T` to a concrete type such as `String`
so that a generator can then be constructed:
```edition2018
#![feature(async_await)]
async fn bar<T>() -> () {}
async fn foo() {
@@ -68,9 +68,9 @@ pub struct CrateMetadata {
pub alloc_decoding_state: AllocDecodingState,

// NOTE(eddyb) we pass `'static` to a `'tcx` parameter because this
// lifetime is only used behind `Lazy` / `LazySeq`, and therefore
// acts like an universal (`for<'tcx>`), that is paired up with
// whichever `TyCtxt` is being used to decode those values.
// lifetime is only used behind `Lazy`, and therefore acts like an
// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt`
// is being used to decode those values.
pub root: schema::CrateRoot<'static>,

/// For each definition in this crate, we encode a key. When the
@@ -80,7 +80,7 @@ pub struct CrateMetadata {
/// compilation support.
pub def_path_table: Lrc<DefPathTable>,

pub trait_impls: FxHashMap<(u32, DefIndex), schema::LazySeq<DefIndex>>,
pub trait_impls: FxHashMap<(u32, DefIndex), schema::Lazy<[DefIndex]>>,

pub dep_kind: Lock<DepKind>,
pub source: CrateSource,
@@ -134,14 +134,14 @@ impl<'a, 'tcx, T: Decodable> Lazy<T> {
}
}

impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable> LazySeq<T> {
impl<'a: 'x, 'tcx: 'x, 'x, T: Decodable> Lazy<[T]> {
pub fn decode<M: Metadata<'a, 'tcx>>(
self,
meta: M,
) -> impl ExactSizeIterator<Item = T> + Captures<'a> + Captures<'tcx> + 'x {
let mut dcx = meta.decoder(self.position);
dcx.lazy_state = LazyState::NodeStart(self.position);
(0..self.len).map(move |_| T::decode(&mut dcx).unwrap())
(0..self.meta).map(move |_| T::decode(&mut dcx).unwrap())
}
}

@@ -154,18 +154,22 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> {
self.cdata.expect("missing CrateMetadata in DecodeContext")
}

fn read_lazy_distance(&mut self, min_size: usize) -> Result<usize, <Self as Decoder>::Error> {
fn read_lazy_with_meta<T: ?Sized + LazyMeta>(
&mut self,
meta: T::Meta,
) -> Result<Lazy<T>, <Self as Decoder>::Error> {
let min_size = T::min_size(meta);
let distance = self.read_usize()?;
let position = match self.lazy_state {
LazyState::NoNode => bug!("read_lazy_distance: outside of a metadata node"),
LazyState::NoNode => bug!("read_lazy_with_meta: outside of a metadata node"),
LazyState::NodeStart(start) => {
assert!(distance + min_size <= start);
start - distance - min_size
}
LazyState::Previous(last_min_end) => last_min_end + distance,
};
self.lazy_state = LazyState::Previous(position + min_size);
Ok(position)
Ok(Lazy::from_position_and_meta(position, meta))
}
}

@@ -230,19 +234,18 @@ impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> {

impl<'a, 'tcx, T> SpecializedDecoder<Lazy<T>> for DecodeContext<'a, 'tcx> {
fn specialized_decode(&mut self) -> Result<Lazy<T>, Self::Error> {
Ok(Lazy::with_position(self.read_lazy_distance(Lazy::<T>::min_size())?))
self.read_lazy_with_meta(())
}
}

impl<'a, 'tcx, T> SpecializedDecoder<LazySeq<T>> for DecodeContext<'a, 'tcx> {
fn specialized_decode(&mut self) -> Result<LazySeq<T>, Self::Error> {
impl<'a, 'tcx, T> SpecializedDecoder<Lazy<[T]>> for DecodeContext<'a, 'tcx> {
fn specialized_decode(&mut self) -> Result<Lazy<[T]>, Self::Error> {
let len = self.read_usize()?;
let position = if len == 0 {
0
if len == 0 {
Ok(Lazy::empty())
} else {
self.read_lazy_distance(LazySeq::<T>::min_size(len))?
};
Ok(LazySeq::with_position_and_length(position, len))
self.read_lazy_with_meta(len)
}
}
}

@@ -378,7 +381,7 @@ impl<'tcx> MetadataBlob {
}

pub fn get_rustc_version(&self) -> String {
Lazy::with_position(METADATA_HEADER.len() + 4).decode(self)
Lazy::<String>::from_position(METADATA_HEADER.len() + 4).decode(self)
}

pub fn get_root(&self) -> CrateRoot<'tcx> {
@@ -387,7 +390,7 @@ impl<'tcx> MetadataBlob {
let pos = (((slice[offset + 0] as u32) << 24) | ((slice[offset + 1] as u32) << 16) |
((slice[offset + 2] as u32) << 8) |
((slice[offset + 3] as u32) << 0)) as usize;
Lazy::with_position(pos).decode(self)
Lazy::<CrateRoot<'tcx>>::from_position(pos).decode(self)
}

pub fn list_crate_metadata(&self,
@@ -1140,7 +1143,7 @@ impl<'a, 'tcx> CrateMetadata {
EntryKind::Fn(data) |
EntryKind::ForeignFn(data) => data.decode(self).arg_names,
EntryKind::Method(data) => data.decode(self).fn_data.arg_names,
_ => LazySeq::empty(),
_ => Lazy::empty(),
};
arg_names.decode(self).collect()
}

0 comments on commit bea0372

Please sign in to comment.
You can’t perform that action at this time.