Skip to content

Commit e5aaff8

Browse files
committed
---
yaml --- r: 234728 b: refs/heads/tmp c: b2c7e77 h: refs/heads/master v: v3
1 parent 18ace87 commit e5aaff8

File tree

45 files changed

+278
-153
lines changed

Some content is hidden

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

45 files changed

+278
-153
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 5ab3058569245171a44283fddee6c119a31765b7
28+
refs/heads/tmp: b2c7e7791a0793df5199e209470734e4f26dccbe
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/COMPILER_TESTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Compiler Test Documentation
22

3-
In the Rust project, we use a special set of comands imbedded in
3+
In the Rust project, we use a special set of comands embedded in
44
comments to test the Rust compiler. There are two groups of commands:
55

66
1. Header commands
@@ -29,11 +29,11 @@ The error levels that you can have are:
2929
3. `NOTE`
3030
4. `HELP` and `SUGGESTION`*
3131

32-
\* **Note**: `SUGGESTION` must follow emediatly after `HELP`.
32+
\* **Note**: `SUGGESTION` must follow immediately after `HELP`.
3333

3434
## Summary of Header Commands
3535

36-
Header commands specify something about the entire test file, as a
36+
Header commands specify something about the entire test file as a
3737
whole, instead of just a few lines inside the test.
3838

3939
* `ignore-X` where `X` is an architecture, OS or stage will ignore the test accordingly

branches/tmp/RELEASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 1.3.0 (September 2015)
1+
Version 1.3.0 (2015-09-17)
22
==============================
33

44
* ~900 changes, numerous bugfixes

branches/tmp/configure

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,12 @@ envopt CPP
10951095
envopt CFLAGS
10961096
envopt CXXFLAGS
10971097

1098+
# stdc++ name in use
1099+
# used to manage non-standard name (on OpenBSD for example)
1100+
program_transform_name=$($CFG_CC -v 2>&1 | sed -n "s/.*--program-transform-name='\([^']*\)'.*/\1/p")
1101+
CFG_STDCPP_NAME=$(echo "stdc++" | sed "${program_transform_name}")
1102+
putvar CFG_STDCPP_NAME
1103+
10981104
# a little post-processing of various config values
10991105
CFG_PREFIX=${CFG_PREFIX%/}
11001106
CFG_MANDIR=${CFG_MANDIR%/}

branches/tmp/mk/llvm.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ $$(LLVM_STAMP_$(1)): $(S)src/rustllvm/llvm-auto-clean-trigger
7373

7474
ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
7575
LLVM_STDCPP_RUSTFLAGS_$(1) = -L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
76-
-print-file-name=libstdc++.a))"
76+
-print-file-name=lib$(CFG_STDCPP_NAME).a))"
7777
else
7878
LLVM_STDCPP_RUSTFLAGS_$(1) =
7979
endif
@@ -83,7 +83,7 @@ endif
8383
LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
8484
$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
8585
$(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(LLVM_COMPONENTS)" "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
86-
$$(LLVM_CONFIG_$(1))
86+
$$(LLVM_CONFIG_$(1)) "$(CFG_STDCPP_NAME)"
8787
endef
8888

8989
$(foreach host,$(CFG_HOST), \

branches/tmp/src/doc/trpl/guessing-game.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ a few tricks up their sleeves.
147147

148148
For example, they’re [immutable][immutable] by default. That’s why our example
149149
uses `mut`: it makes a binding mutable, rather than immutable. `let` doesn’t
150-
take a name on the left hand side, it actually accepts a
150+
take a name on the left hand side of the assignment, it actually accepts a
151151
[pattern][patterns]’. We’ll use patterns later. It’s easy enough
152152
to use for now:
153153

branches/tmp/src/etc/mklldeps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
components = sys.argv[2].split() # splits on whitespace
1818
enable_static = sys.argv[3]
1919
llvm_config = sys.argv[4]
20+
stdcpp_name = sys.argv[5]
2021

2122
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2223
// file at the top-level directory of this distribution and at
@@ -77,15 +78,15 @@ def run(args):
7778
out = run([llvm_config, '--cxxflags'])
7879
if enable_static == '1':
7980
assert('stdlib=libc++' not in out)
80-
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")
81+
f.write("#[link(name = \"" + stdcpp_name + "\", kind = \"static\")]\n")
8182
else:
8283
# Note that we use `cfg_attr` here because on MSVC the C++ standard library
8384
# is not c++ or stdc++, but rather the linker takes care of linking the
8485
# right standard library.
8586
if 'stdlib=libc++' in out:
8687
f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"c++\"))]\n")
8788
else:
88-
f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"stdc++\"))]\n")
89+
f.write("#[cfg_attr(not(target_env = \"msvc\"), link(name = \"" + stdcpp_name + "\"))]\n")
8990

9091
# Attach everything to an extern block
9192
f.write("extern {}\n")

branches/tmp/src/librustc_borrowck/borrowck/check_loans.rs

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -464,40 +464,36 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
464464

465465
match (new_loan.kind, old_loan.kind) {
466466
(ty::MutBorrow, ty::MutBorrow) => {
467-
self.bccx.span_err(
468-
new_loan.span,
469-
&format!("cannot borrow `{}`{} as mutable \
470-
more than once at a time",
471-
nl, new_loan_msg))
467+
span_err!(self.bccx, new_loan.span, E0499,
468+
"cannot borrow `{}`{} as mutable \
469+
more than once at a time",
470+
nl, new_loan_msg);
472471
}
473472

474473
(ty::UniqueImmBorrow, _) => {
475-
self.bccx.span_err(
476-
new_loan.span,
477-
&format!("closure requires unique access to `{}` \
478-
but {} is already borrowed{}",
479-
nl, ol_pronoun, old_loan_msg));
474+
span_err!(self.bccx, new_loan.span, E0500,
475+
"closure requires unique access to `{}` \
476+
but {} is already borrowed{}",
477+
nl, ol_pronoun, old_loan_msg);
480478
}
481479

482480
(_, ty::UniqueImmBorrow) => {
483-
self.bccx.span_err(
484-
new_loan.span,
485-
&format!("cannot borrow `{}`{} as {} because \
486-
previous closure requires unique access",
487-
nl, new_loan_msg, new_loan.kind.to_user_str()));
481+
span_err!(self.bccx, new_loan.span, E0501,
482+
"cannot borrow `{}`{} as {} because \
483+
previous closure requires unique access",
484+
nl, new_loan_msg, new_loan.kind.to_user_str());
488485
}
489486

490487
(_, _) => {
491-
self.bccx.span_err(
492-
new_loan.span,
493-
&format!("cannot borrow `{}`{} as {} because \
494-
{} is also borrowed as {}{}",
495-
nl,
496-
new_loan_msg,
497-
new_loan.kind.to_user_str(),
498-
ol_pronoun,
499-
old_loan.kind.to_user_str(),
500-
old_loan_msg));
488+
span_err!(self.bccx, new_loan.span, E0502,
489+
"cannot borrow `{}`{} as {} because \
490+
{} is also borrowed as {}{}",
491+
nl,
492+
new_loan_msg,
493+
new_loan.kind.to_user_str(),
494+
ol_pronoun,
495+
old_loan.kind.to_user_str(),
496+
old_loan_msg);
501497
}
502498
}
503499

@@ -617,11 +613,9 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
617613
match self.analyze_restrictions_on_use(id, copy_path, ty::ImmBorrow) {
618614
UseOk => { }
619615
UseWhileBorrowed(loan_path, loan_span) => {
620-
self.bccx.span_err(
621-
span,
622-
&format!("cannot use `{}` because it was mutably borrowed",
623-
&self.bccx.loan_path_to_string(copy_path))
624-
);
616+
span_err!(self.bccx, span, E0503,
617+
"cannot use `{}` because it was mutably borrowed",
618+
&self.bccx.loan_path_to_string(copy_path));
625619
self.bccx.span_note(
626620
loan_span,
627621
&format!("borrow of `{}` occurs here",
@@ -642,18 +636,19 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
642636
match self.analyze_restrictions_on_use(id, move_path, ty::MutBorrow) {
643637
UseOk => { }
644638
UseWhileBorrowed(loan_path, loan_span) => {
645-
let err_message = match move_kind {
639+
match move_kind {
646640
move_data::Captured =>
647-
format!("cannot move `{}` into closure because it is borrowed",
648-
&self.bccx.loan_path_to_string(move_path)),
641+
span_err!(self.bccx, span, E0504,
642+
"cannot move `{}` into closure because it is borrowed",
643+
&self.bccx.loan_path_to_string(move_path)),
649644
move_data::Declared |
650645
move_data::MoveExpr |
651646
move_data::MovePat =>
652-
format!("cannot move out of `{}` because it is borrowed",
653-
&self.bccx.loan_path_to_string(move_path))
647+
span_err!(self.bccx, span, E0505,
648+
"cannot move out of `{}` because it is borrowed",
649+
&self.bccx.loan_path_to_string(move_path))
654650
};
655651

656-
self.bccx.span_err(span, &err_message[..]);
657652
self.bccx.span_note(
658653
loan_span,
659654
&format!("borrow of `{}` occurs here",
@@ -820,10 +815,9 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
820815
span: Span,
821816
loan_path: &LoanPath<'tcx>,
822817
loan: &Loan) {
823-
self.bccx.span_err(
824-
span,
825-
&format!("cannot assign to `{}` because it is borrowed",
826-
self.bccx.loan_path_to_string(loan_path)));
818+
span_err!(self.bccx, span, E0506,
819+
"cannot assign to `{}` because it is borrowed",
820+
self.bccx.loan_path_to_string(loan_path));
827821
self.bccx.span_note(
828822
loan.span,
829823
&format!("borrow of `{}` occurs here",

branches/tmp/src/librustc_borrowck/borrowck/gather_loans/move_error.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,18 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
119119
mc::cat_deref(_, _, mc::Implicit(..)) |
120120
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
121121
mc::cat_static_item => {
122-
bccx.span_err(move_from.span,
123-
&format!("cannot move out of {}",
124-
move_from.descriptive_string(bccx.tcx)));
122+
span_err!(bccx, move_from.span, E0507,
123+
"cannot move out of {}",
124+
move_from.descriptive_string(bccx.tcx));
125125
}
126126

127127
mc::cat_interior(ref b, mc::InteriorElement(Kind::Index, _)) => {
128128
let expr = bccx.tcx.map.expect_expr(move_from.id);
129129
if let hir::ExprIndex(..) = expr.node {
130-
bccx.span_err(move_from.span,
131-
&format!("cannot move out of type `{}`, \
132-
a non-copy fixed-size array",
133-
b.ty));
130+
span_err!(bccx, move_from.span, E0508,
131+
"cannot move out of type `{}`, \
132+
a non-copy fixed-size array",
133+
b.ty);
134134
}
135135
}
136136

@@ -139,11 +139,10 @@ fn report_cannot_move_out_of<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
139139
match b.ty.sty {
140140
ty::TyStruct(def, _) |
141141
ty::TyEnum(def, _) if def.has_dtor() => {
142-
bccx.span_err(
143-
move_from.span,
144-
&format!("cannot move out of type `{}`, \
145-
which defines the `Drop` trait",
146-
b.ty));
142+
span_err!(bccx, move_from.span, E0509,
143+
"cannot move out of type `{}`, \
144+
which defines the `Drop` trait",
145+
b.ty);
147146
},
148147
_ => {
149148
bccx.span_bug(move_from.span, "this path should not cause illegal move")

branches/tmp/src/librustc_borrowck/borrowck/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
803803
self.tcx.sess.span_err(s, m);
804804
}
805805

806+
pub fn span_err_with_code(&self, s: Span, msg: &str, code: &str) {
807+
self.tcx.sess.span_err_with_code(s, msg, code);
808+
}
809+
806810
pub fn span_bug(&self, s: Span, m: &str) {
807811
self.tcx.sess.span_bug(s, m);
808812
}

branches/tmp/src/librustc_borrowck/diagnostics.rs

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,50 @@ fn mutable() {
263263
You can read more about cell types in the API documentation:
264264
265265
https://doc.rust-lang.org/std/cell/
266-
"##
266+
"##,
267+
268+
E0499: r##"
269+
A variable was borrowed as mutable more than once. Erroneous code example:
270+
271+
```
272+
let mut i = 0;
273+
let mut x = &mut i;
274+
let mut a = &mut i;
275+
// error: cannot borrow `i` as mutable more than once at a time
276+
```
277+
278+
Please note that in rust, you can either have many immutable references, or one
279+
mutable reference. Take a look at
280+
https://doc.rust-lang.org/stable/book/references-and-borrowing.html for more
281+
information. Example:
282+
283+
284+
```
285+
let mut i = 0;
286+
let mut x = &mut i; // ok!
287+
288+
// or:
289+
let mut i = 0;
290+
let a = &i; // ok!
291+
let b = &i; // still ok!
292+
let c = &i; // still ok!
293+
```
294+
"##,
267295

268296
}
269297

270298
register_diagnostics! {
271299
E0385, // {} in an aliasable location
272300
E0388, // {} in a static location
273-
E0389 // {} in a `&` reference
301+
E0389, // {} in a `&` reference
302+
E0500, // closure requires unique access to `..` but .. is already borrowed
303+
E0501, // cannot borrow `..`.. as .. because previous closure requires unique access
304+
E0502, // cannot borrow `..`.. as .. because .. is also borrowed as ...
305+
E0503, // cannot use `..` because it was mutably borrowed
306+
E0504, // cannot move `..` into closure because it is borrowed
307+
E0505, // cannot move out of `..` because it is borrowed
308+
E0506, // cannot assign to `..` because it is borrowed
309+
E0507, // cannot move out of ..
310+
E0508, // cannot move out of type `..`, a non-copy fixed-size array
311+
E0509, // cannot move out of type `..`, which defines the `Drop` trait
274312
}

branches/tmp/src/librustc_front/fold.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ pub fn noop_fold_foreign_mod<T: Folder>(ForeignMod {abi, items}: ForeignMod,
415415
}
416416

417417
pub fn noop_fold_variant<T: Folder>(v: P<Variant>, fld: &mut T) -> P<Variant> {
418-
v.map(|Spanned {node: Variant_ {id, name, attrs, kind, disr_expr, vis}, span}| Spanned {
418+
v.map(|Spanned {node: Variant_ {id, name, attrs, kind, disr_expr}, span}| Spanned {
419419
node: Variant_ {
420420
id: fld.new_id(id),
421421
name: name,
@@ -430,7 +430,6 @@ pub fn noop_fold_variant<T: Folder>(v: P<Variant>, fld: &mut T) -> P<Variant> {
430430
}
431431
},
432432
disr_expr: disr_expr.map(|e| fld.fold_expr(e)),
433-
vis: vis,
434433
},
435434
span: fld.new_span(span),
436435
})

branches/tmp/src/librustc_front/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@ pub struct Variant_ {
10521052
pub id: NodeId,
10531053
/// Explicit discriminant, eg `Foo = 1`
10541054
pub disr_expr: Option<P<Expr>>,
1055-
pub vis: Visibility,
10561055
}
10571056

10581057
pub type Variant = Spanned<Variant_>;

branches/tmp/src/librustc_front/lowering.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ pub fn lower_variant(v: &Variant) -> P<hir::Variant> {
147147
}
148148
},
149149
disr_expr: v.node.disr_expr.as_ref().map(|e| lower_expr(e)),
150-
vis: lower_visibility(v.node.vis),
151150
},
152151
span: v.span,
153152
})

branches/tmp/src/librustc_front/print/pprust.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ impl<'a> State<'a> {
944944
}
945945

946946
pub fn print_variant(&mut self, v: &hir::Variant) -> io::Result<()> {
947-
try!(self.print_visibility(v.node.vis));
948947
match v.node.kind {
949948
hir::TupleVariantKind(ref args) => {
950949
try!(self.print_ident(v.node.name));

branches/tmp/src/librustc_lint/builtin.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4949
use syntax::{abi, ast};
5050
use syntax::attr::{self, AttrMetaMethods};
5151
use syntax::codemap::{self, Span};
52-
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType};
52+
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType, emit_feature_err, GateIssue};
5353
use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
5454
use syntax::ptr::P;
5555

@@ -381,13 +381,12 @@ impl LateLintPass for TypeLimits {
381381

382382
fn check_unsigned_negation_feature(cx: &LateContext, span: Span) {
383383
if !cx.sess().features.borrow().negate_unsigned {
384-
// FIXME(#27141): change this to syntax::feature_gate::emit_feature_err…
385-
cx.sess().span_warn(span,
386-
"unary negation of unsigned integers will be feature gated in the future");
387-
// …and remove following two expressions.
388-
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
389-
cx.sess().fileline_help(span, "add #![feature(negate_unsigned)] to the \
390-
crate attributes to enable the gate in advance");
384+
emit_feature_err(
385+
&cx.sess().parse_sess.span_diagnostic,
386+
"negate_unsigned",
387+
span,
388+
GateIssue::Language,
389+
"unary negation of unsigned integers may be removed in the future");
391390
}
392391
}
393392
}

0 commit comments

Comments
 (0)