Skip to content

Commit 1c8b245

Browse files
committed
Auto merge of #32229 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests - Successful merges: #32164, #32179, #32212, #32218 - Failed merges:
2 parents c21644a + 2e21ff1 commit 1c8b245

File tree

8 files changed

+53
-11
lines changed

8 files changed

+53
-11
lines changed

src/doc/book/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ Cargo checks to see if any of your project’s files have been modified, and onl
501501
rebuilds your project if they’ve changed since the last time you built it.
502502

503503
With simple projects, Cargo doesn't bring a whole lot over just using `rustc`,
504-
but it will become useful in future. This is especially true when you start
504+
but it will become useful in the future. This is especially true when you start
505505
using crates; these are synonymous with a ‘library’ or ‘package’ in other
506506
programming languages. For complex projects composed of multiple crates, it’s
507507
much easier to let Cargo coordinate the build. Using Cargo, you can run `cargo

src/doc/book/if.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Rust’s take on `if` is not particularly complex, but it’s much more like the
44
`if` you’ll find in a dynamically typed language than in a more traditional
55
systems language. So let’s talk about it, to make sure you grasp the nuances.
66

7-
`if` is a specific form of a more general concept, the ‘branch’. The name comes
7+
`if` is a specific form of a more general concept, the ‘branch’, whose name comes
88
from a branch in a tree: a decision point, where depending on a choice,
99
multiple paths can be taken.
1010

src/doc/book/strings.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ let s = "foo\
4444
assert_eq!("foobar", s);
4545
```
4646

47-
Rust has more than only `&str`s though. A `String`, is a heap-allocated string.
47+
Rust has more than only `&str`s though. A `String` is a heap-allocated string.
4848
This string is growable, and is also guaranteed to be UTF-8. `String`s are
4949
commonly created by converting from a string slice using the `to_string`
5050
method.
@@ -89,7 +89,7 @@ Viewing a `String` as a `&str` is cheap, but converting the `&str` to a
8989

9090
## Indexing
9191

92-
Because strings are valid UTF-8, strings do not support indexing:
92+
Because strings are valid UTF-8, they do not support indexing:
9393

9494
```rust,ignore
9595
let s = "hello";

src/librustc/middle/infer/mod.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,15 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11201120
.map(|method| resolve_ty(method.ty)))
11211121
}
11221122

1123+
pub fn errors_since_creation(&self) -> bool {
1124+
self.tcx.sess.err_count() - self.err_count_on_creation != 0
1125+
}
1126+
11231127
pub fn node_type(&self, id: ast::NodeId) -> Ty<'tcx> {
11241128
match self.tables.borrow().node_types.get(&id) {
11251129
Some(&t) => t,
11261130
// FIXME
1127-
None if self.tcx.sess.err_count() - self.err_count_on_creation != 0 =>
1131+
None if self.errors_since_creation() =>
11281132
self.tcx.types.err,
11291133
None => {
11301134
self.tcx.sess.bug(
@@ -1147,7 +1151,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11471151
free_regions: &FreeRegionMap,
11481152
subject_node_id: ast::NodeId) {
11491153
let errors = self.region_vars.resolve_regions(free_regions, subject_node_id);
1150-
self.report_region_errors(&errors); // see error_reporting.rs
1154+
if !self.errors_since_creation() {
1155+
// As a heuristic, just skip reporting region errors
1156+
// altogether if other errors have been reported while
1157+
// this infcx was in use. This is totally hokey but
1158+
// otherwise we have a hard time separating legit region
1159+
// errors from silly ones.
1160+
self.report_region_errors(&errors); // see error_reporting.rs
1161+
}
11511162
}
11521163

11531164
pub fn ty_to_string(&self, t: Ty<'tcx>) -> String {

src/librustc/session/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
10951095
}
10961096
}
10971097

1098+
if cg.codegen_units < 1 {
1099+
early_error(error_format, "Value for codegen units must be a positive nonzero integer");
1100+
}
1101+
10981102
let cg = cg;
10991103

11001104
let sysroot_opt = matches.opt_str("sysroot").map(|m| PathBuf::from(&m));

src/libsyntax/ast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ pub enum ExprKind {
927927
Binary(BinOp, P<Expr>, P<Expr>),
928928
/// A unary operation (For example: `!x`, `*x`)
929929
Unary(UnOp, P<Expr>),
930-
/// A literal (For example: `1u8`, `"foo"`)
930+
/// A literal (For example: `1`, `"foo"`)
931931
Lit(P<Lit>),
932932
/// A cast (`foo as f64`)
933933
Cast(P<Expr>, P<Ty>),
@@ -1016,7 +1016,7 @@ pub enum ExprKind {
10161016

10171017
/// An array literal constructed from one repeated element.
10181018
///
1019-
/// For example, `[1u8; 5]`. The first expression is the element
1019+
/// For example, `[1; 5]`. The first expression is the element
10201020
/// to be repeated; the second is the number of times to repeat it.
10211021
Repeat(P<Expr>, P<Expr>),
10221022

@@ -1288,7 +1288,7 @@ pub enum LitKind {
12881288
Byte(u8),
12891289
/// A character literal (`'a'`)
12901290
Char(char),
1291-
/// An integer literal (`1u8`)
1291+
/// An integer literal (`1`)
12921292
Int(u64, LitIntType),
12931293
/// A float literal (`1f64` or `1E10f64`)
12941294
Float(InternedString, FloatTy),

src/libsyntax/print/pp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ pub fn mk_printer<'a>(out: Box<io::Write+'a>, linewidth: usize) -> Printer<'a> {
168168
let n: usize = 3 * linewidth;
169169
debug!("mk_printer {}", linewidth);
170170
let token = vec![Token::Eof; n];
171-
let size = vec![0_isize; n];
172-
let scan_stack = vec![0_usize; n];
171+
let size = vec![0; n];
172+
let scan_stack = vec![0; n];
173173
Printer {
174174
out: out,
175175
buf_len: n,

src/test/compile-fail/issue-30580.rs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Test that we do not see uninformative region-related errors
12+
// when we get some basic type-checking failure. See #30580.
13+
14+
pub struct Foo { a: u32 }
15+
pub struct Pass<'a, 'tcx: 'a>(&'a mut &'a (), &'a &'tcx ());
16+
17+
impl<'a, 'tcx> Pass<'a, 'tcx>
18+
{
19+
pub fn tcx(&self) -> &'a &'tcx () { self.1 }
20+
fn lol(&mut self, b: &Foo)
21+
{
22+
b.c; //~ ERROR no field with that name was found
23+
self.tcx();
24+
}
25+
}
26+
27+
fn main() {}

0 commit comments

Comments
 (0)