Skip to content

Commit c9f8304

Browse files
committed
Auto merge of #59012 - pietroalbini:rollup, r=pietroalbini
Rollup of 24 pull requests Successful merges: - #58080 (Add FreeBSD armv6 and armv7 targets) - #58204 (On return type `impl Trait` for block with no expr point at last semi) - #58269 (Add librustc and libsyntax to rust-src distribution.) - #58369 (Make the Entry API of HashMap<K, V> Sync and Send) - #58861 (Expand where negative supertrait specific error is shown) - #58877 (Suggest removal of `&` when borrowing macro and appropriate) - #58883 (Suggest appropriate code for unused field when destructuring pattern) - #58891 (Remove stray ` in the docs for the FromIterator implementation for Option) - #58893 (race condition in thread local storage example) - #58906 (Monomorphize generator field types for debuginfo) - #58911 (Regression test for #58435.) - #58912 (Regression test for #58813) - #58916 (Fix release note problems noticed after merging.) - #58918 (Regression test added for an async ICE.) - #58921 (Add an explicit test for issue #50582) - #58926 (Make the lifetime parameters of tcx consistent.) - #58931 (Elide invalid method receiver error when it contains TyErr) - #58940 (Remove JSBackend from config.toml) - #58950 (Add self to mailmap) - #58961 (On incorrect cfg literal/identifier, point at the right span) - #58963 (libstd: implement Error::source for io::Error) - #58970 (delay_span_bug in wfcheck's ty.lift_to_tcx unwrap) - #58984 (Teach `-Z treat-err-as-bug` to take a number of errors to emit) - #59007 (Add a test for invalid const arguments) Failed merges: - #58959 (Add release notes for PR #56243) r? @ghost
2 parents 777cc25 + 961e378 commit c9f8304

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+588
-106
lines changed

.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Michael Woerister <michaelwoerister@posteo> <michaelwoerister@gmail>
161161
Mickaël Raybaud-Roig <[email protected]> m-r-r <[email protected]>
162162
163163
Mukilan Thiagarajan <[email protected]>
164+
164165
Nathan Wilson <[email protected]>
165166
Nathaniel Herman <[email protected]> Nathaniel Herman <[email protected]>
166167

RELEASES.md

+23-21
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ Version 1.33.0 (2019-02-28)
44
Language
55
--------
66
- [You can now use the `cfg(target_vendor)` attribute.][57465] E.g.
7-
`#[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); }`
7+
`#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }`
88
- [Integer patterns such as in a match expression can now be exhaustive.][56362]
99
E.g. You can have match statement on a `u8` that covers `0..=255` and
10-
you would no longer be required to have a `_ => unreachable!()` case.
10+
you would no longer be required to have a `_ => unreachable!()` case.
1111
- [You can now have multiple patterns in `if let` and `while let`
1212
expressions.][57532] You can do this with the same syntax as a `match`
1313
expression. E.g.
@@ -51,8 +51,7 @@ Language
5151
// Allowed as there is only one `Read` in the module.
5252
pub trait Read {}
5353
```
54-
- [`extern` functions will now abort by default when panicking.][55982]
55-
This was previously undefined behaviour.
54+
- [You may now use `Rc`, `Arc`, and `Pin` as method receivers][56805].
5655

5756
Compiler
5857
--------
@@ -109,27 +108,30 @@ Compatibility Notes
109108
are now deprecated in the standard library, and their usage will now produce a warning.
110109
Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}`
111110
methods instead.
111+
- The `Error::cause` method has been deprecated in favor of `Error::source` which supports
112+
downcasting.
112113

113-
[57615]: https://github.com/rust-lang/rust/pull/57615/
114-
[57465]: https://github.com/rust-lang/rust/pull/57465/
115-
[57532]: https://github.com/rust-lang/rust/pull/57532/
116-
[57535]: https://github.com/rust-lang/rust/pull/57535/
117-
[57566]: https://github.com/rust-lang/rust/pull/57566/
114+
[55982]: https://github.com/rust-lang/rust/pull/55982/
115+
[56303]: https://github.com/rust-lang/rust/pull/56303/
116+
[56351]: https://github.com/rust-lang/rust/pull/56351/
117+
[56362]: https://github.com/rust-lang/rust/pull/56362
118+
[56642]: https://github.com/rust-lang/rust/pull/56642/
119+
[56769]: https://github.com/rust-lang/rust/pull/56769/
120+
[56805]: https://github.com/rust-lang/rust/pull/56805
121+
[56947]: https://github.com/rust-lang/rust/pull/56947/
122+
[57049]: https://github.com/rust-lang/rust/pull/57049/
123+
[57067]: https://github.com/rust-lang/rust/pull/57067/
124+
[57105]: https://github.com/rust-lang/rust/pull/57105
118125
[57130]: https://github.com/rust-lang/rust/pull/57130/
119126
[57167]: https://github.com/rust-lang/rust/pull/57167/
120127
[57175]: https://github.com/rust-lang/rust/pull/57175/
121128
[57234]: https://github.com/rust-lang/rust/pull/57234/
122129
[57332]: https://github.com/rust-lang/rust/pull/57332/
123-
[56947]: https://github.com/rust-lang/rust/pull/56947/
124-
[57049]: https://github.com/rust-lang/rust/pull/57049/
125-
[57067]: https://github.com/rust-lang/rust/pull/57067/
126-
[56769]: https://github.com/rust-lang/rust/pull/56769/
127-
[56642]: https://github.com/rust-lang/rust/pull/56642/
128-
[56303]: https://github.com/rust-lang/rust/pull/56303/
129-
[56351]: https://github.com/rust-lang/rust/pull/56351/
130-
[55982]: https://github.com/rust-lang/rust/pull/55982/
131-
[56362]: https://github.com/rust-lang/rust/pull/56362
132-
[57105]: https://github.com/rust-lang/rust/pull/57105
130+
[57465]: https://github.com/rust-lang/rust/pull/57465/
131+
[57532]: https://github.com/rust-lang/rust/pull/57532/
132+
[57535]: https://github.com/rust-lang/rust/pull/57535/
133+
[57566]: https://github.com/rust-lang/rust/pull/57566/
134+
[57615]: https://github.com/rust-lang/rust/pull/57615/
133135
[cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/
134136
[`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at
135137
[`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at
@@ -170,7 +172,7 @@ Language
170172
- [You can now match against literals in macros with the `literal`
171173
specifier.][56072] This will match against a literal of any type.
172174
E.g. `1`, `'A'`, `"Hello World"`
173-
- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g.
175+
- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g.
174176
```rust
175177
struct Point(i32, i32);
176178

@@ -460,7 +462,7 @@ Version 1.31.0 (2018-12-06)
460462

461463
Language
462464
--------
463-
- 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉
465+
- 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉
464466
- [New lifetime elision rules now allow for eliding lifetimes in functions and
465467
impl headers.][54778] E.g. `impl<'a> Reader for BufReader<'a> {}` can now be
466468
`impl Reader for BufReader<'_> {}`. Lifetimes are still required to be defined

config.toml.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# support. You'll need to write a target specification at least, and most
6262
# likely, teach rustc about the C ABI of the target. Get in touch with the
6363
# Rust team and file an issue if you need assistance in porting!
64-
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon"
64+
#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon"
6565

6666
# LLVM experimental targets to build support for. These targets are specified in
6767
# the same format as above, but since these targets are experimental, they are

src/bootstrap/bootstrap.py

+4
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ def default_build_triple():
262262
cputype = 'arm'
263263
if ostype == 'linux-android':
264264
ostype = 'linux-androideabi'
265+
elif ostype == 'unknown-freebsd':
266+
cputype = subprocess.check_output(
267+
['uname', '-p']).strip().decode(default_encoding)
268+
ostype = 'unknown-freebsd'
265269
elif cputype == 'armv6l':
266270
cputype = 'arm'
267271
if ostype == 'linux-android':

src/bootstrap/dist.rs

+2
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,8 @@ impl Step for Src {
904904
"src/stdsimd",
905905
"src/libproc_macro",
906906
"src/tools/rustc-std-workspace-core",
907+
"src/librustc",
908+
"src/libsyntax",
907909
];
908910

909911
copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src);

src/libcore/option.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
12861286
/// # Examples
12871287
///
12881288
/// Here is an example which increments every integer in a vector.
1289-
/// `We use the checked variant of `add` that returns `None` when the
1289+
/// We use the checked variant of `add` that returns `None` when the
12901290
/// calculation would result in an overflow.
12911291
///
12921292
/// ```

src/librustc/middle/liveness.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,22 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>,
379379
let body = ir.tcx.hir().body(body_id);
380380

381381
for arg in &body.arguments {
382+
let is_shorthand = match arg.pat.node {
383+
crate::hir::PatKind::Struct(..) => true,
384+
_ => false,
385+
};
382386
arg.pat.each_binding(|_bm, hir_id, _x, ident| {
383387
debug!("adding argument {:?}", hir_id);
384-
fn_maps.add_variable(Arg(hir_id, ident.name));
388+
let var = if is_shorthand {
389+
Local(LocalInfo {
390+
id: hir_id,
391+
name: ident.name,
392+
is_shorthand: true,
393+
})
394+
} else {
395+
Arg(hir_id, ident.name)
396+
};
397+
fn_maps.add_variable(var);
385398
})
386399
};
387400

src/librustc/session/config.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,8 @@ macro_rules! options {
816816
Some("crate=integer");
817817
pub const parse_unpretty: Option<&str> =
818818
Some("`string` or `string=string`");
819+
pub const parse_treat_err_as_bug: Option<&str> =
820+
Some("either no value or a number bigger than 0");
819821
pub const parse_lto: Option<&str> =
820822
Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \
821823
`fat`, or omitted");
@@ -1022,6 +1024,13 @@ macro_rules! options {
10221024
}
10231025
}
10241026

1027+
fn parse_treat_err_as_bug(slot: &mut Option<usize>, v: Option<&str>) -> bool {
1028+
match v {
1029+
Some(s) => { *slot = s.parse().ok().filter(|&x| x != 0); slot.unwrap_or(0) != 0 }
1030+
None => { *slot = Some(1); true }
1031+
}
1032+
}
1033+
10251034
fn parse_lto(slot: &mut LtoCli, v: Option<&str>) -> bool {
10261035
if v.is_some() {
10271036
let mut bool_arg = None;
@@ -1236,8 +1245,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12361245
"load proc macros for both target and host, but only link to the target"),
12371246
no_codegen: bool = (false, parse_bool, [TRACKED],
12381247
"run all passes except codegen; no output"),
1239-
treat_err_as_bug: bool = (false, parse_bool, [TRACKED],
1240-
"treat all errors that occur as bugs"),
1248+
treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED],
1249+
"treat error number `val` that occurs as bug"),
12411250
report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
12421251
"immediately print bugs registered with `delay_span_bug`"),
12431252
external_macro_backtrace: bool = (false, parse_bool, [UNTRACKED],
@@ -3214,7 +3223,7 @@ mod tests {
32143223
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
32153224

32163225
opts = reference.clone();
3217-
opts.debugging_opts.treat_err_as_bug = true;
3226+
opts.debugging_opts.treat_err_as_bug = Some(1);
32183227
assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash());
32193228

32203229
opts = reference.clone();

src/librustc/session/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ pub fn early_error(output: config::ErrorOutputType, msg: &str) -> ! {
13151315
Box::new(EmitterWriter::stderr(color_config, None, true, false))
13161316
}
13171317
};
1318-
let handler = errors::Handler::with_emitter(true, false, emitter);
1318+
let handler = errors::Handler::with_emitter(true, None, emitter);
13191319
handler.emit(&MultiSpan::new(), msg, errors::Level::Fatal);
13201320
errors::FatalError.raise();
13211321
}
@@ -1330,7 +1330,7 @@ pub fn early_warn(output: config::ErrorOutputType, msg: &str) {
13301330
Box::new(EmitterWriter::stderr(color_config, None, true, false))
13311331
}
13321332
};
1333-
let handler = errors::Handler::with_emitter(true, false, emitter);
1333+
let handler = errors::Handler::with_emitter(true, None, emitter);
13341334
handler.emit(&MultiSpan::new(), msg, errors::Level::Warning);
13351335
}
13361336

src/librustc/traits/error_reporting.rs

+52-12
Original file line numberDiff line numberDiff line change
@@ -599,11 +599,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
599599
}
600600
}
601601

602-
pub fn report_selection_error(&self,
603-
obligation: &PredicateObligation<'tcx>,
604-
error: &SelectionError<'tcx>,
605-
fallback_has_occurred: bool)
606-
{
602+
pub fn report_selection_error(
603+
&self,
604+
obligation: &PredicateObligation<'tcx>,
605+
error: &SelectionError<'tcx>,
606+
fallback_has_occurred: bool,
607+
) {
607608
let span = obligation.cause.span;
608609

609610
let mut err = match *error {
@@ -673,6 +674,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
673674

674675
self.suggest_borrow_on_unsized_slice(&obligation.cause.code, &mut err);
675676
self.suggest_remove_reference(&obligation, &mut err, &trait_ref);
677+
self.suggest_semicolon_removal(&obligation, &mut err, span, &trait_ref);
676678

677679
// Try to report a help message
678680
if !trait_ref.has_infer_types() &&
@@ -900,9 +902,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
900902

901903
/// When encountering an assignment of an unsized trait, like `let x = ""[..];`, provide a
902904
/// suggestion to borrow the initializer in order to use have a slice instead.
903-
fn suggest_borrow_on_unsized_slice(&self,
904-
code: &ObligationCauseCode<'tcx>,
905-
err: &mut DiagnosticBuilder<'tcx>) {
905+
fn suggest_borrow_on_unsized_slice(
906+
&self,
907+
code: &ObligationCauseCode<'tcx>,
908+
err: &mut DiagnosticBuilder<'tcx>,
909+
) {
906910
if let &ObligationCauseCode::VariableType(node_id) = code {
907911
let parent_node = self.tcx.hir().get_parent_node(node_id);
908912
if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) {
@@ -924,10 +928,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
924928

925929
/// Whenever references are used by mistake, like `for (i, e) in &vec.iter().enumerate()`,
926930
/// suggest removing these references until we reach a type that implements the trait.
927-
fn suggest_remove_reference(&self,
928-
obligation: &PredicateObligation<'tcx>,
929-
err: &mut DiagnosticBuilder<'tcx>,
930-
trait_ref: &ty::Binder<ty::TraitRef<'tcx>>) {
931+
fn suggest_remove_reference(
932+
&self,
933+
obligation: &PredicateObligation<'tcx>,
934+
err: &mut DiagnosticBuilder<'tcx>,
935+
trait_ref: &ty::Binder<ty::TraitRef<'tcx>>,
936+
) {
931937
let trait_ref = trait_ref.skip_binder();
932938
let span = obligation.cause.span;
933939

@@ -969,6 +975,40 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
969975
}
970976
}
971977

978+
fn suggest_semicolon_removal(
979+
&self,
980+
obligation: &PredicateObligation<'tcx>,
981+
err: &mut DiagnosticBuilder<'tcx>,
982+
span: Span,
983+
trait_ref: &ty::Binder<ty::TraitRef<'tcx>>,
984+
) {
985+
let hir = self.tcx.hir();
986+
let parent_node = hir.get_parent_node(
987+
hir.hir_to_node_id(obligation.cause.body_id),
988+
);
989+
let node = hir.find(parent_node);
990+
if let Some(hir::Node::Item(hir::Item {
991+
node: hir::ItemKind::Fn(decl, _, _, body_id),
992+
..
993+
})) = node {
994+
let body = hir.body(*body_id);
995+
if let hir::ExprKind::Block(blk, _) = &body.value.node {
996+
if decl.output.span().overlaps(span) && blk.expr.is_none() &&
997+
"()" == &trait_ref.self_ty().to_string()
998+
{
999+
// FIXME(estebank): When encountering a method with a trait
1000+
// bound not satisfied in the return type with a body that has
1001+
// no return, suggest removal of semicolon on last statement.
1002+
// Once that is added, close #54771.
1003+
if let Some(ref stmt) = blk.stmts.last() {
1004+
let sp = self.tcx.sess.source_map().end_point(stmt.span);
1005+
err.span_label(sp, "consider removing this semicolon");
1006+
}
1007+
}
1008+
}
1009+
}
1010+
}
1011+
9721012
/// Given some node representing a fn-like thing in the HIR map,
9731013
/// returns a span and `ArgKind` information that describes the
9741014
/// arguments it expects. This can be supplied to

src/librustc_codegen_llvm/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ impl ExtraBackendMethods for LlvmCodegenBackend {
123123
) -> EncodedMetadata {
124124
base::write_metadata(tcx, metadata)
125125
}
126-
fn codegen_allocator(
126+
fn codegen_allocator<'b, 'gcx>(
127127
&self,
128-
tcx: TyCtxt<'_, '_, '_>,
128+
tcx: TyCtxt<'b, 'gcx, 'gcx>,
129129
mods: &mut ModuleLlvm,
130130
kind: AllocatorKind
131131
) {

src/librustc_codegen_ssa/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
247247

248248
impl<B: WriteBackendMethods> CodegenContext<B> {
249249
pub fn create_diag_handler(&self) -> Handler {
250-
Handler::with_emitter(true, false, Box::new(self.diag_emitter.clone()))
250+
Handler::with_emitter(true, None, Box::new(self.diag_emitter.clone()))
251251
}
252252

253253
pub fn config(&self, kind: ModuleKind) -> &ModuleConfig {

src/librustc_codegen_ssa/mir/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
673673
.zip(state_tys)
674674
.enumerate()
675675
.filter_map(move |(i, (decl, ty))| {
676+
let ty = fx.monomorphize(&ty);
676677
decl.name.map(|name| (i + upvar_count + 1, name, false, ty))
677678
})
678679
}).into_iter().flatten();

src/librustc_codegen_ssa/traits/backend.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
3838
tcx: TyCtxt<'b, 'gcx, 'gcx>,
3939
metadata: &mut Self::Module,
4040
) -> EncodedMetadata;
41-
fn codegen_allocator(
41+
fn codegen_allocator<'b, 'gcx>(
4242
&self,
43-
tcx: TyCtxt<'_, '_, '_>,
43+
tcx: TyCtxt<'b, 'gcx, 'gcx>,
4444
mods: &mut Self::Module,
4545
kind: AllocatorKind
4646
);

src/librustc_driver/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn run<F>(run_compiler: F) -> isize
148148
true,
149149
false
150150
);
151-
let handler = errors::Handler::with_emitter(true, false, Box::new(emitter));
151+
let handler = errors::Handler::with_emitter(true, None, Box::new(emitter));
152152
handler.emit(&MultiSpan::new(),
153153
"aborting due to previous error(s)",
154154
errors::Level::Fatal);
@@ -1327,7 +1327,7 @@ pub fn monitor<F: FnOnce() + Send + 'static>(f: F) -> Result<(), CompilationFail
13271327
None,
13281328
false,
13291329
false));
1330-
let handler = errors::Handler::with_emitter(true, false, emitter);
1330+
let handler = errors::Handler::with_emitter(true, None, emitter);
13311331

13321332
// a .span_bug or .bug call has already printed what
13331333
// it wants to print.

src/librustc_driver/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn test_env_with_pool<F>(
113113
) where
114114
F: FnOnce(Env),
115115
{
116-
let diagnostic_handler = errors::Handler::with_emitter(true, false, emitter);
116+
let diagnostic_handler = errors::Handler::with_emitter(true, None, emitter);
117117
let sess = session::build_session_(
118118
options,
119119
None,

src/librustc_errors/diagnostic_builder.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ impl<'a> DiagnosticBuilder<'a> {
103103
/// Buffers the diagnostic for later emission, unless handler
104104
/// has disabled such buffering.
105105
pub fn buffer(mut self, buffered_diagnostics: &mut Vec<Diagnostic>) {
106-
if self.handler.flags.dont_buffer_diagnostics || self.handler.flags.treat_err_as_bug {
106+
if self.handler.flags.dont_buffer_diagnostics ||
107+
self.handler.flags.treat_err_as_bug.is_some()
108+
{
107109
self.emit();
108110
return;
109111
}

0 commit comments

Comments
 (0)