Skip to content

fix #24968 more friend error message for Self in fn args #25096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
3c503a5
more friend error message for in fn arg
XuefengWu May 4, 2015
7ec6bd9
change Self type error message
XuefengWu May 10, 2015
f1ab664
rustc_back: Only use archive member filenames
alexcrichton May 9, 2015
e5efea4
Delete `_book` folder if it exists from previous runs
mdinger May 13, 2015
cce30b2
Remove errant line
tamird May 12, 2015
5f932e8
make diagnostic message clearer when called from cargo
mathroc May 13, 2015
4774d5d
Allow `T::C` syntax in match patterns to refer to trait-assosociated …
quantheory May 1, 2015
f548a05
Unignore some tests in stage1
tamird May 12, 2015
809be9b
Fix link to RFC 255 in Reference.
May 14, 2015
b4bbf3a
Fix ICE that occurs when an associated const is ambiguous.
quantheory May 3, 2015
556e76b
std: Redesign Duration, implementing RFC 1040
alexcrichton Apr 28, 2015
a4444aa
Add error explanations for E0066 and E0069.
May 12, 2015
44a5bf1
libstd/env: Add non-Rust synchronization warnings for setenv()
cgwalters Apr 23, 2015
71f7fb2
Fix table syntax.
dreid May 14, 2015
1b5b639
Auto merge of #25065 - quantheory:fix_associated_const_ambiguity_mess…
bors May 14, 2015
f539c41
Fix automatic substitution of task->thread.
dreid May 14, 2015
e77b03d
Auto merge of #25238 - alexcrichton:fix-archive-with-slashes, r=brson
bors May 14, 2015
06aef33
Add error explanations for E0053, E0251, E0252, E0255, E0256, E0368.
May 14, 2015
0a1a53d
Auto merge of #24741 - cgwalters:note-setenv-and-unsetenv-are-not-thr…
bors May 14, 2015
d636b5c
Improve examples in the E0255/E0256 error explanations.
May 14, 2015
588777f
Improve E0053 and E0066 error explanations.
May 14, 2015
b1bd3a3
Auto merge of #25338 - tamird:unignore-stage-tests, r=alexcrichton
bors May 14, 2015
af52207
Auto merge of #25381 - mathroc:patch-1, r=alexcrichton
bors May 14, 2015
62d0ef4
Fix crates.io link.
WiSaGaN May 14, 2015
ca225df
Rollup merge of #25354 - mdinger:delete_book, r=steveklabnik
Manishearth May 14, 2015
ab47005
Rollup merge of #25381 - mathroc:patch-1, r=alexcrichton
Manishearth May 14, 2015
3ce4b99
Rollup merge of #25391 - nham:ref_rfc255_link, r=alexcrichton
Manishearth May 14, 2015
0cbef04
Rollup merge of #25395 - dreid:patch-1, r=alexcrichton
Manishearth May 14, 2015
ff207b7
Rollup merge of #25397 - dreid:patch-2, r=alexcrichton
Manishearth May 14, 2015
1109b6d
Rollup merge of #25398 - nham:E0066_E0069, r=huonw
Manishearth May 14, 2015
2df7ae6
Rollup merge of #25401 - WiSaGaN:bugfix/fix_crates_io_link, r=stevekl…
Manishearth May 14, 2015
b4e1ce5
trpl-docs: Specify correct type of variable binding
dnaeon May 14, 2015
acb5e02
Another thread->task fix.
dreid May 14, 2015
e2bb734
trpl: punctuation fix
durka May 14, 2015
90b9529
Move configuration 1 phase before crate metadata collection
lilyball May 14, 2015
785cbe3
I fixed the typo of the value of e in the memory tables. It is a refe…
May 14, 2015
dd4dad8
Auto merge of #24920 - alexcrichton:duration, r=aturon
bors May 14, 2015
dc6eb78
trpl: fix link from Structs to Traits
durka May 14, 2015
66c0fe0
trpl: fix link from Enums to Traits
durka May 14, 2015
c147ac4
trpl: fix link from Match to If Let
durka May 14, 2015
c8b0689
trpl: punctuation fix in Patterns
durka May 14, 2015
4bdeb31
Add #[inline] to Borrow<str>::borrow for String.
koute May 14, 2015
a1577db
TRPL: Fix Internal Link
killercup May 14, 2015
50fb669
s/Iterater/Iterator/
apasel422 May 14, 2015
571f371
Auto merge of #25403 - Manishearth:rollup, r=Manishearth
bors May 14, 2015
82c7282
trpl: Fix missing internal links
leunggamciu May 14, 2015
140577b
Don't use <Duration as Display>::display() in time passes
nrc May 14, 2015
568f13a
Remove an almost-duplicated sentence.
habnabit May 15, 2015
2792855
Auto merge of #25399 - kballard:crate-attributes-cfg_attr, r=alexcric…
bors May 15, 2015
6e9e76a
Fix error codes E0197-E0200
cactorium May 15, 2015
1f40cde
Rollup merge of #25404 - dnaeon:doc-fixes, r=steveklabnik
steveklabnik May 15, 2015
0028f85
Rollup merge of #25405 - dreid:patch-3, r=nikomatsakis
steveklabnik May 15, 2015
c356211
Rollup merge of #25407 - durka:patch-1, r=alexcrichton
steveklabnik May 15, 2015
765a55e
Rollup merge of #25408 - Nashenas88:rust-book-stack-and-heap-typo, r=…
steveklabnik May 15, 2015
dd60abc
Rollup merge of #25410 - durka:patch-2, r=steveklabnik
steveklabnik May 15, 2015
609b4a1
Rollup merge of #25412 - koute:master, r=alexcrichton
steveklabnik May 15, 2015
aa56011
Rollup merge of #25413 - killercup:patch-11, r=alexcrichton
steveklabnik May 15, 2015
8d52274
Rollup merge of #25414 - apasel422:patch-1, r=alexcrichton
steveklabnik May 15, 2015
5501f07
Rollup merge of #25418 - leunggamciu:patch-trpl, r=steveklabnik
steveklabnik May 15, 2015
6df13d4
Rollup merge of #25420 - habnabit:master, r=steveklabnik
steveklabnik May 15, 2015
507f8b8
Fix merge conflict and also add markdown formatting
cactorium May 15, 2015
0260333
Fix major compile time regression
dotdash May 15, 2015
daabc8a
Auto merge of #25421 - steveklabnik:rollup, r=steveklabnik
bors May 15, 2015
0077ffe
Auto merge of #25419 - nrc:time, r=alexcrichton
bors May 15, 2015
190de69
Add backticks around language keyword
cactorium May 15, 2015
072cba9
Auto merge of #25422 - cactorium:unsafe_errors, r=huonw
bors May 15, 2015
579e319
Auto merge of #25400 - nrc:save-api, r=huonw
bors May 15, 2015
7ebaf1c
Auto merge of #25423 - dotdash:assume, r=huonw
bors May 15, 2015
a1d4648
more friend error message for in fn arg
XuefengWu May 4, 2015
eac661c
add compile test and update error message for Self keyworkd
XuefengWu May 16, 2015
54f0828
Merge branch '24968_err_msg_parse_self_type' of github.com:XuefengWu/…
XuefengWu May 16, 2015
ba89495
fix typo for copyright year and trait capitalise
XuefengWu May 16, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3529,7 +3529,9 @@ The actual implementation for each vtable entry can vary on an object-by-object
basis.

Note that for a trait object to be instantiated, the trait must be
_object-safe_. Object safety rules are defined in [RFC 255][rfc255].
_object-safe_. Object safety rules are defined in [RFC 255].

[RFC 255]: https://github.com/rust-lang/rfcs/blob/master/text/0255-object-safety.md

Given a pointer-typed expression `E` of type `&T` or `Box<T>`, where `T`
implements trait `R`, casting `E` to the corresponding pointer type `&R` or
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and more cores, yet many programmers aren't prepared to fully utilize them.

Rust's memory safety features also apply to its concurrency story too. Even
concurrent Rust programs must be memory safe, having no data races. Rust's type
system is up to the thread, and gives you powerful ways to reason about
system is up to the task, and gives you powerful ways to reason about
concurrent code at compile time.

Before we talk about the concurrency features that come with Rust, it's important
Expand Down
3 changes: 3 additions & 0 deletions src/doc/trpl/dining-philosophers.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ a name is all we need. We choose the [`String`][string] type for the name,
rather than `&str`. Generally speaking, working with a type which owns its
data is easier than working with one that uses references.

[struct]: structs.html
[string]: strings.html

Let’s continue:

```rust
Expand Down
4 changes: 1 addition & 3 deletions src/doc/trpl/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ fn process_color_change(msg: Message) {
}
```

Both variants are named `Digit`, but since they’re scoped to the `enum` name
there's no ambiguity.

Not supporting these operations may seem rather limiting, but it’s a limitation
which we can overcome. There are two ways: by implementing equality ourselves,
or by pattern matching variants with [`match`][match] expressions, which you’ll
Expand All @@ -66,3 +63,4 @@ equality yet, but we’ll find out in the [`traits`][traits] section.

[match]: match.html
[if-let]: if-let.html
[traits]: traits.html
4 changes: 2 additions & 2 deletions src/doc/trpl/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ The next part will use this handle to get input from the user:
```

Here, we call the [`read_line()`][read_line] method on our handle.
[Method][method]s are like associated functions, but are only available on a
[Methods][method] are like associated functions, but are only available on a
particular instance of a type, rather than the type itself. We’re also passing
one argument to `read_line()`: `&mut guess`.

[read_line]: ../std/io/struct.Stdin.html#method.read_line
[method]: methods.html
[method]: method-syntax.html

Remember how we bound `guess` above? We said it was mutable. However,
`read_line` doesn’t take a `String` as an argument: it takes a `&mut String`.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ loop is just a handy way to write this `loop`/`match`/`break` construct.
`for` loops aren't the only thing that uses iterators, however. Writing your
own iterator involves implementing the `Iterator` trait. While doing that is
outside of the scope of this guide, Rust provides a number of useful iterators
to accomplish various threads. Before we talk about those, we should talk about a
to accomplish various tasks. Before we talk about those, we should talk about a
Rust anti-pattern. And that's using ranges like this.

Yes, we just talked about how ranges are cool. But ranges are also very
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/match.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ Unlike the previous uses of `match`, you can’t use the normal `if`
statement to do this. You can use the [`if let`][if-let] statement,
which can be seen as an abbreviated form of `match`.

[if-let][if-let.html]
[if-let]: if-let.html
2 changes: 1 addition & 1 deletion src/doc/trpl/mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let y = &mut x;

`y` is an immutable binding to a mutable reference, which means that you can’t
bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s
bound to `y`. (`*y = 5`) A subtle distinction.
bound to `y` (`*y = 5`). A subtle distinction.

Of course, if you need both:

Expand Down
4 changes: 2 additions & 2 deletions src/doc/trpl/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ match x {
}
```

This prints `something else`
This prints `something else`.

# Bindings

Expand Down Expand Up @@ -152,7 +152,7 @@ match x {
}
```

This prints `Got an int!`
This prints `Got an int!`.

# ref and ref mut

Expand Down
2 changes: 2 additions & 0 deletions src/doc/trpl/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,5 @@ useful. For instance, a library may ask you to create a structure that
implements a certain [trait][trait] to handle events. If you don’t have
any data you need to store in the structure, you can just create a
unit-like struct.

[trait]: traits.html
52 changes: 26 additions & 26 deletions src/doc/trpl/the-stack-and-the-heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ This memory is kind of like a giant array: addresses start at zero and go
up to the final number. So here’s a diagram of our first stack frame:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 0 | x | 42 |

We’ve got `x` located at address `0`, with the value `42`.

When `foo()` is called, a new stack frame is allocated:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 2 | z | 100 |
| 1 | y | 5 |
| 0 | x | 42 |
Expand All @@ -107,7 +107,7 @@ value being stored.
After `foo()` is over, its frame is deallocated:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 0 | x | 42 |

And then, after `main()`, even this last value goes away. Easy!
Expand Down Expand Up @@ -142,13 +142,13 @@ fn main() {
Okay, first, we call `main()`:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 0 | x | 42 |

Next up, `main()` calls `foo()`:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 3 | c | 1 |
| 2 | b | 100 |
| 1 | a | 5 |
Expand All @@ -157,7 +157,7 @@ Next up, `main()` calls `foo()`:
And then `foo()` calls `bar()`:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 4 | i | 6 |
| 3 | c | 1 |
| 2 | b | 100 |
Expand All @@ -170,7 +170,7 @@ After `bar()` is over, its frame is deallocated, leaving just `foo()` and
`main()`:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 3 | c | 1 |
| 2 | b | 100 |
| 1 | a | 5 |
Expand All @@ -179,7 +179,7 @@ After `bar()` is over, its frame is deallocated, leaving just `foo()` and
And then `foo()` ends, leaving just `main()`

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 0 | x | 42 |

And then we’re done. Getting the hang of it? It’s like piling up dishes: you
Expand All @@ -206,7 +206,7 @@ fn main() {
Here’s what happens in memory when `main()` is called:

| Address | Name | Value |
+---------+------+--------+
|---------|------|--------|
| 1 | y | 42 |
| 0 | x | ?????? |

Expand All @@ -218,7 +218,7 @@ it allocates some memory for the heap, and puts `5` there. The memory now looks
like this:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 5 |
| ... | ... | ... |
| 1 | y | 42 |
Expand All @@ -243,7 +243,7 @@ layout of a program which has been running for a while now:


| Address | Name | Value |
+----------------------+------+----------------------+
|----------------------|------|----------------------|
| 2<sup>30</sup> | | 5 |
| (2<sup>30</sup>) - 1 | | |
| (2<sup>30</sup>) - 2 | | |
Expand Down Expand Up @@ -272,7 +272,7 @@ when it was created. Great! So when `x` goes away, it first frees the memory
allocated on the heap:

| Address | Name | Value |
+---------+------+--------+
|---------|------|--------|
| 1 | y | 42 |
| 0 | x | ?????? |

Expand Down Expand Up @@ -305,7 +305,7 @@ fn main() {
When we enter `main()`, memory looks like this:

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 1 | y | 0 |
| 0 | x | 5 |

Expand All @@ -315,7 +315,7 @@ memory location that `x` lives at, which in this case is `0`.
What about when we call `foo()`, passing `y` as an argument?

| Address | Name | Value |
+---------+------+-------+
|---------|------|-------|
| 3 | z | 42 |
| 2 | i | 0 |
| 1 | y | 0 |
Expand Down Expand Up @@ -367,7 +367,7 @@ fn main() {
First, we call `main()`:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 2 | j | 0 |
Expand All @@ -380,7 +380,7 @@ value pointing there.
Next, at the end of `main()`, `foo()` gets called:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 5 | z | 4 |
Expand All @@ -397,7 +397,7 @@ since `j` points at `h`.
Next, `foo()` calls `baz()`, passing `z`:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 7 | g | 100 |
Expand All @@ -413,7 +413,7 @@ We’ve allocated memory for `f` and `g`. `baz()` is very short, so when it’s
over, we get rid of its stack frame:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 5 | z | 4 |
Expand All @@ -426,11 +426,11 @@ over, we get rid of its stack frame:
Next, `foo()` calls `bar()` with `x` and `z`:

| Address | Name | Value |
+----------------------+------+----------------------+
|----------------------|------|----------------------|
| 2<sup>30</sup> | | 20 |
| (2<sup>30</sup>) - 1 | | 5 |
| ... | ... | ... |
| 10 | e | 4 |
| 10 | e | 9 |
| 9 | d | (2<sup>30</sup>) - 1 |
| 8 | c | 5 |
| 7 | b | 4 |
Expand All @@ -449,13 +449,13 @@ case, we set up the variables as usual.
At the end of `bar()`, it calls `baz()`:

| Address | Name | Value |
+----------------------+------+----------------------+
|----------------------|------|----------------------|
| 2<sup>30</sup> | | 20 |
| (2<sup>30</sup>) - 1 | | 5 |
| ... | ... | ... |
| 12 | g | 100 |
| 11 | f | 4 |
| 10 | e | 4 |
| 10 | e | 9 |
| 9 | d | (2<sup>30</sup>) - 1 |
| 8 | c | 5 |
| 7 | b | 4 |
Expand All @@ -473,11 +473,11 @@ far.
After `baz()` is over, we get rid of `f` and `g`:

| Address | Name | Value |
+----------------------+------+----------------------+
|----------------------|------|----------------------|
| 2<sup>30</sup> | | 20 |
| (2<sup>30</sup>) - 1 | | 5 |
| ... | ... | ... |
| 10 | e | 4 |
| 10 | e | 9 |
| 9 | d | (2<sup>30</sup>) - 1 |
| 8 | c | 5 |
| 7 | b | 4 |
Expand All @@ -493,7 +493,7 @@ Next, we return from `bar()`. `d` in this case is a `Box<T>`, so it also frees
what it points to: (2<sup>30</sup>) - 1.

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 5 | z | 4 |
Expand All @@ -506,7 +506,7 @@ what it points to: (2<sup>30</sup>) - 1.
And after that, `foo()` returns:

| Address | Name | Value |
+-----------------+------+----------------+
|-----------------|------|----------------|
| 2<sup>30</sup> | | 20 |
| ... | ... | ... |
| 2 | j | 0 |
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/while-loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Rust also has a `while` loop. It looks like this:

```{rust}
let mut x = 5; // mut x: u32
let mut x = 5; // mut x: i32
let mut done = false; // mut done: bool

while !done {
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ macro_rules! utf8_acc_cont_byte {

#[stable(feature = "rust1", since = "1.0.0")]
impl Borrow<str> for String {
#[inline]
fn borrow(&self) -> &str { &self[..] }
}

Expand Down
32 changes: 16 additions & 16 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,14 @@ macro_rules! iterator {
#[inline]
fn next(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
if self.ptr == self.end {
None
} else {
unsafe {
if mem::size_of::<T>() != 0 {
::intrinsics::assume(!self.ptr.is_null());
::intrinsics::assume(!self.end.is_null());
}
unsafe {
if mem::size_of::<T>() != 0 {
assume(!self.ptr.is_null());
assume(!self.end.is_null());
}
if self.ptr == self.end {
None
} else {
let old = self.ptr;
self.ptr = slice_offset!(self.ptr, 1);
Some(slice_ref!(old))
Expand Down Expand Up @@ -710,15 +710,15 @@ macro_rules! iterator {
#[inline]
fn next_back(&mut self) -> Option<$elem> {
// could be implemented with slices, but this avoids bounds checks
if self.end == self.ptr {
None
} else {
unsafe {
unsafe {
if mem::size_of::<T>() != 0 {
assume(!self.ptr.is_null());
assume(!self.end.is_null());
}
if self.end == self.ptr {
None
} else {
self.end = slice_offset!(self.end, -1);
if mem::size_of::<T>() != 0 {
::intrinsics::assume(!self.ptr.is_null());
::intrinsics::assume(!self.end.is_null());
}
Some(slice_ref!(self.end))
}
}
Expand Down
Loading