Skip to content

Commit 7b0085a

Browse files
committed
Auto merge of #63779 - Centril:rollup-sx96dli, r=Centril
Rollup of 7 pull requests Successful merges: - #63721 (Do not emit JSON dumps of diagnostic codes) - #63753 (Bump toml dependency.) - #63755 (Use dedicated type for spans in pre-expansion gating.) - #63759 (Allow 'default async fn' to parse.) - #63760 (Update books) - #63762 (`async_await` was stabilized in 1.39.0, not 1.38.0.) - #63766 (Remove some duplication when resolving constants) Failed merges: r? @ghost
2 parents bea0372 + b25ec04 commit 7b0085a

File tree

24 files changed

+177
-239
lines changed

24 files changed

+177
-239
lines changed

Cargo.lock

+9-17
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ dependencies = [
185185
"serde",
186186
"serde_json",
187187
"time",
188-
"toml 0.4.10",
188+
"toml",
189189
]
190190

191191
[[package]]
@@ -202,7 +202,7 @@ name = "build-manifest"
202202
version = "0.1.0"
203203
dependencies = [
204204
"serde",
205-
"toml 0.4.10",
205+
"toml",
206206
]
207207

208208
[[package]]
@@ -316,7 +316,7 @@ dependencies = [
316316
"tar",
317317
"tempfile",
318318
"termcolor",
319-
"toml 0.5.3",
319+
"toml",
320320
"unicode-width",
321321
"url 2.1.0",
322322
"walkdir",
@@ -442,7 +442,7 @@ dependencies = [
442442
"semver",
443443
"serde",
444444
"smallvec",
445-
"toml 0.5.3",
445+
"toml",
446446
"unicode-normalization",
447447
"url 2.1.0",
448448
]
@@ -946,6 +946,7 @@ name = "error_index_generator"
946946
version = "0.0.0"
947947
dependencies = [
948948
"rustdoc",
949+
"walkdir",
949950
]
950951

951952
[[package]]
@@ -1785,7 +1786,7 @@ dependencies = [
17851786
"serde_json",
17861787
"shlex",
17871788
"tempfile",
1788-
"toml 0.5.3",
1789+
"toml",
17891790
"toml-query",
17901791
]
17911792

@@ -2760,7 +2761,7 @@ dependencies = [
27602761
"tokio",
27612762
"tokio-process",
27622763
"tokio-timer",
2763-
"toml 0.5.3",
2764+
"toml",
27642765
"url 1.7.2",
27652766
"walkdir",
27662767
]
@@ -3590,7 +3591,7 @@ dependencies = [
35903591
"serde_json",
35913592
"structopt",
35923593
"term 0.6.0",
3593-
"toml 0.5.3",
3594+
"toml",
35943595
"unicode-segmentation",
35953596
"unicode-width",
35963597
"unicode_categories",
@@ -4382,15 +4383,6 @@ dependencies = [
43824383
"tokio-reactor",
43834384
]
43844385

4385-
[[package]]
4386-
name = "toml"
4387-
version = "0.4.10"
4388-
source = "registry+https://github.com/rust-lang/crates.io-index"
4389-
checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
4390-
dependencies = [
4391-
"serde",
4392-
]
4393-
43944386
[[package]]
43954387
name = "toml"
43964388
version = "0.5.3"
@@ -4411,7 +4403,7 @@ dependencies = [
44114403
"is-match",
44124404
"lazy_static 1.3.0",
44134405
"regex",
4414-
"toml 0.5.3",
4406+
"toml",
44154407
"toml-query_derive",
44164408
]
44174409

src/bootstrap/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ cc = "1.0.35"
4444
libc = "0.2"
4545
serde = { version = "1.0.8", features = ["derive"] }
4646
serde_json = "1.0.2"
47-
toml = "0.4"
47+
toml = "0.5"
4848
lazy_static = "1.3.0"
4949
time = "0.1"
5050
petgraph = "0.4.13"

src/bootstrap/doc.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,7 @@ impl Step for ErrorIndex {
825825
index.arg(crate::channel::CFG_RELEASE_NUM);
826826

827827
// FIXME: shouldn't have to pass this env var
828-
index.env("CFG_BUILD", &builder.config.build)
829-
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
828+
index.env("CFG_BUILD", &builder.config.build);
830829

831830
builder.run(&mut index);
832831
}

src/bootstrap/test.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1535,8 +1535,7 @@ impl Step for ErrorIndex {
15351535
);
15361536
tool.arg("markdown")
15371537
.arg(&output)
1538-
.env("CFG_BUILD", &builder.config.build)
1539-
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());
1538+
.env("CFG_BUILD", &builder.config.build);
15401539

15411540
builder.info(&format!("Testing error-index stage{}", compiler.stage));
15421541
let _time = util::timeit(&builder);

src/doc/nomicon

src/doc/reference

src/librustc/ty/relate.rs

+3-21
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::hir::def_id::DefId;
88
use crate::ty::subst::{Kind, UnpackedKind, SubstsRef};
99
use crate::ty::{self, Ty, TyCtxt, TypeFoldable};
1010
use crate::ty::error::{ExpectedFound, TypeError};
11-
use crate::mir::interpret::{ConstValue, Scalar, GlobalId};
11+
use crate::mir::interpret::{ConstValue, Scalar};
1212
use std::rc::Rc;
1313
use std::iter;
1414
use rustc_target::spec::abi;
@@ -551,26 +551,8 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
551551
let tcx = relation.tcx();
552552

553553
let eagerly_eval = |x: &'tcx ty::Const<'tcx>| {
554-
if let ConstValue::Unevaluated(def_id, substs) = x.val {
555-
// FIXME(eddyb) get the right param_env.
556-
let param_env = ty::ParamEnv::empty();
557-
if !substs.has_local_value() {
558-
let instance = ty::Instance::resolve(
559-
tcx.global_tcx(),
560-
param_env,
561-
def_id,
562-
substs,
563-
);
564-
if let Some(instance) = instance {
565-
let cid = GlobalId {
566-
instance,
567-
promoted: None,
568-
};
569-
if let Ok(ct) = tcx.const_eval(param_env.and(cid)) {
570-
return ct.val;
571-
}
572-
}
573-
}
554+
if !x.val.has_local_value() {
555+
return x.eval(tcx, relation.param_env()).val;
574556
}
575557
x.val
576558
};

src/librustc/ty/sty.rs

+17-7
Original file line numberDiff line numberDiff line change
@@ -2299,23 +2299,33 @@ impl<'tcx> Const<'tcx> {
22992299
assert_eq!(self.ty, ty);
23002300
// if `ty` does not depend on generic parameters, use an empty param_env
23012301
let size = tcx.layout_of(param_env.with_reveal_all().and(ty)).ok()?.size;
2302+
self.eval(tcx, param_env).val.try_to_bits(size)
2303+
}
2304+
2305+
#[inline]
2306+
pub fn eval(
2307+
&self,
2308+
tcx: TyCtxt<'tcx>,
2309+
param_env: ParamEnv<'tcx>,
2310+
) -> &Const<'tcx> {
2311+
// FIXME(const_generics): this doesn't work right now,
2312+
// because it tries to relate an `Infer` to a `Param`.
23022313
match self.val {
2303-
// FIXME(const_generics): this doesn't work right now,
2304-
// because it tries to relate an `Infer` to a `Param`.
23052314
ConstValue::Unevaluated(did, substs) => {
23062315
// if `substs` has no unresolved components, use and empty param_env
23072316
let (param_env, substs) = param_env.with_reveal_all().and(substs).into_parts();
23082317
// try to resolve e.g. associated constants to their definition on an impl
2309-
let instance = ty::Instance::resolve(tcx, param_env, did, substs)?;
2318+
let instance = match ty::Instance::resolve(tcx, param_env, did, substs) {
2319+
Some(instance) => instance,
2320+
None => return self,
2321+
};
23102322
let gid = GlobalId {
23112323
instance,
23122324
promoted: None,
23132325
};
2314-
let evaluated = tcx.const_eval(param_env.and(gid)).ok()?;
2315-
evaluated.val.try_to_bits(size)
2326+
tcx.const_eval(param_env.and(gid)).unwrap_or(self)
23162327
},
2317-
// otherwise just extract a `ConstValue`'s bits if possible
2318-
_ => self.val.try_to_bits(size),
2328+
_ => self,
23192329
}
23202330
}
23212331

src/libsyntax/diagnostics/metadata.rs

-93
This file was deleted.

src/libsyntax/diagnostics/plugin.rs

+4-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::BTreeMap;
2-
use std::env;
32

43
use crate::ast::{self, Ident, Name};
54
use crate::source_map;
@@ -12,8 +11,6 @@ use crate::tokenstream::{TokenTree};
1211
use smallvec::smallvec;
1312
use syntax_pos::Span;
1413

15-
use crate::diagnostics::metadata::output_metadata;
16-
1714
pub use errors::*;
1815

1916
// Maximum width of any line in an extended error description (inclusive).
@@ -127,36 +124,13 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt<'_>,
127124
token_tree: &[TokenTree])
128125
-> Box<dyn MacResult+'cx> {
129126
assert_eq!(token_tree.len(), 3);
130-
let (crate_name, ident) = match (&token_tree[0], &token_tree[2]) {
131-
(
132-
// Crate name.
133-
&TokenTree::Token(Token { kind: token::Ident(crate_name, _), .. }),
134-
// DIAGNOSTICS ident.
135-
&TokenTree::Token(Token { kind: token::Ident(name, _), span })
136-
) => (crate_name, Ident::new(name, span)),
127+
let ident = match &token_tree[2] {
128+
// DIAGNOSTICS ident.
129+
&TokenTree::Token(Token { kind: token::Ident(name, _), span })
130+
=> Ident::new(name, span),
137131
_ => unreachable!()
138132
};
139133

140-
// Output error metadata to `tmp/extended-errors/<target arch>/<crate name>.json`
141-
if let Ok(target_triple) = env::var("CFG_COMPILER_HOST_TRIPLE") {
142-
ecx.parse_sess.registered_diagnostics.with_lock(|diagnostics| {
143-
if let Err(e) = output_metadata(ecx,
144-
&target_triple,
145-
&crate_name.as_str(),
146-
diagnostics) {
147-
ecx.span_bug(span, &format!(
148-
"error writing metadata for triple `{}` and crate `{}`, error: {}, \
149-
cause: {:?}",
150-
target_triple, crate_name, e.description(), e.source()
151-
));
152-
}
153-
});
154-
} else {
155-
ecx.span_err(span, &format!(
156-
"failed to write metadata for crate `{}` because $CFG_COMPILER_HOST_TRIPLE is not set",
157-
crate_name));
158-
}
159-
160134
// Construct the output expression.
161135
let (count, expr) =
162136
ecx.parse_sess.registered_diagnostics.with_lock(|diagnostics| {

0 commit comments

Comments
 (0)