Commit Graph

79414 Commits

Author SHA1 Message Date
varkor
991efa4284 Address various comments 2018-06-20 12:23:33 +01:00
varkor
91712bc665 Lift attrs into hir::GenericParam 2018-06-20 12:23:23 +01:00
varkor
7de6ed06a5 Rename TraitTyParamBound to ParamBound::Trait 2018-06-20 12:23:23 +01:00
varkor
8bc3a35576 Fix HasAttrs support for GenericParam 2018-06-20 12:23:23 +01:00
varkor
390aa5d421 Introduce ParamName and use it in place of LifetimeName 2018-06-20 12:23:23 +01:00
varkor
59feafd9d8 Fix NodeLifetime/NodeGenericParam confusion 2018-06-20 12:23:08 +01:00
varkor
831b5c02df Take advantage of the lifetime refactoring 2018-06-20 12:23:08 +01:00
varkor
6015edf9af Remove name from GenericParamKind::Lifetime 2018-06-20 12:23:08 +01:00
varkor
c4e8e71880 Lift name into GenericParam 2018-06-20 12:23:08 +01:00
varkor
32b2dacdf8 Handle lifetimes in NodeGenericParam also 2018-06-20 12:23:07 +01:00
varkor
80dbe58efc Use ParamBounds in WhereRegionPredicate 2018-06-20 12:23:07 +01:00
varkor
aed530a457 Lift bounds into GenericParam 2018-06-20 12:22:46 +01:00
varkor
a5328bc17b Simply joint lifetime/type iteration 2018-06-20 12:21:52 +01:00
varkor
8bccfe7a52 Refactor counting methods 2018-06-20 12:21:52 +01:00
varkor
3bcb006fd9 Rename structures in ast 2018-06-20 12:21:52 +01:00
varkor
f457b3d10a Refactor generic parameters in rustdoc/clean 2018-06-20 12:21:52 +01:00
varkor
80b381e041 Remove all traces of lifetimes() and types() methods 2018-06-20 12:21:24 +01:00
varkor
10229fd9d5 Rename DefPathData::LifetimeDef to LifetimeParam 2018-06-20 12:21:24 +01:00
varkor
c65454850f Remove AngleBracketedArgs impl 2018-06-20 12:21:08 +01:00
varkor
e1d888c722 Remove methods from ast::GenericParam and ast::Generics 2018-06-20 12:21:08 +01:00
varkor
2c6ff2469a Refactor ast::GenericParam as a struct 2018-06-20 12:21:08 +01:00
varkor
fba1fe2108 Remove hir::GenericParam::is_*_param 2018-06-20 12:21:08 +01:00
varkor
c818a1df9b Remove specific parameter iterators from hir::Generics 2018-06-20 12:21:08 +01:00
varkor
82dba3d419 Refactor hir::GenericParam as a struct 2018-06-20 12:21:07 +01:00
varkor
d643946550 Rename ast::GenericParam and ast::GenericArg
It's so confusing to have everything having the same name, at least while refactoring.
2018-06-20 12:19:04 +01:00
varkor
f9d0968906 Make method and variable names more consistent 2018-06-20 12:19:04 +01:00
varkor
76c0d68745 Rename "parameter" to "arg" 2018-06-20 12:19:04 +01:00
varkor
3e89753283 Rename PathParameter(s) to GenericArg(s) 2018-06-20 12:19:04 +01:00
varkor
e05ad4f31a Abstract walk_path_parameters 2018-06-20 12:19:04 +01:00
varkor
1ed60a9173 Rename *Parameter to *Param 2018-06-20 12:19:04 +01:00
varkor
494859e8dd Consolidate PathParameters and AngleBracketedParameterData 2018-06-20 12:19:03 +01:00
bors
cca43a7f97 Auto merge of #51644 - Sgeo:patch-1, r=rkruppe
Remove erroneous example of main as a non-Result function.
2018-06-20 06:54:17 +00:00
bors
90c921ed47 Auto merge of #51631 - WiSaGaN:patch-1, r=Mark-Simulacrum
Fix links in RELEASES.md
2018-06-20 03:46:05 +00:00
bors
93a161170f Auto merge of #51617 - nnethercote:nll-allocs, r=pnkfelix
Reduce number of allocations done by NLL

A couple of easy wins. Here are the NLL speedups that exceed 1%:
```
sentry-cli-check
        avg: -3.5%      min: -3.5%      max: -3.5%
inflate-check
        avg: -1.9%      min: -1.9%      max: -1.9%
inflate
        avg: -1.7%      min: -1.7%      max: -1.7%
clap-rs-check
        avg: -1.6%      min: -1.6%      max: -1.6%
cargo-check
        avg: -1.6%      min: -1.6%      max: -1.6%
ripgrep-check
        avg: -1.4%      min: -1.4%      max: -1.4%
serde-check
        avg: -1.2%      min: -1.2%      max: -1.2%
regex-check
        avg: -1.0%      min: -1.0%      max: -1.0%
sentry-cli
        avg: -1.0%      min: -1.0%      max: -1.0%
```
r? @nikomatsakis
2018-06-20 01:39:43 +00:00
bors
ac8d1f7623 Auto merge of #51639 - SimonSapin:missing-alloc, r=rkruppe
Update the error message for a missing global allocator

Don’t mention `#[default_lib_allocator]` (which is an implementation detail irrelevant to most users) and  instead suggest using `#[global_allocator]`, which is often the correct fix.
2018-06-19 23:37:09 +00:00
Sgeo
0b9c686b47
Remove erroneous example of main as a non-Result function. 2018-06-19 18:32:44 -04:00
bors
f28c7aef7f Auto merge of #51275 - pnkfelix:nll-diagnostics-revise-check-access-permissions, r=nikomatsakis
NLL diagnostics: revise `fn check_access_permissions`

NLL: revise `fn check_access_permissions` so that its (still branchy) shares more code paths between the different cases, and also provide more diagnostics in more cases (though the added diagnostics still do not always meet the quality bar established by AST-borrowck)

----

Transcribing "checklist" suggested by Niko, except I am rendering it as a table to make it clear that I do not regard every item in the list to be a "must have" for landing this PR.

goal | does this PR do it?
-----|------------------------------
no suggestions for `ref mut` |  yes
suggestions for direct local assignment (`{ let x = 3; x = 4; }`) | yes (see commits at end)
suggestions for direct field assignment (`{ let x = (3, 4); x.0 = 5; }` | yes (see commits at end)
suggestions for upvars (`let x = 3; let c = \|\| { &mut x; }`) | yes

Note that I added support for a couple of rows via changes that are not strictly part of `fn check_access_permissions`. If desired I can remove those commits from this PR and leave them for a later PR.

Fix #51031
Fix #51032
(bug #51191 needs a little more investigation before closing.)
Fix #51578
2018-06-19 21:31:36 +00:00
bors
d692ab406e Auto merge of #51543 - SimonSapin:oom, r=SimonSapin
Rename OOM to allocation error

The acronym is not descriptive unless one has seen it before.

* Rename the `oom` function to `handle_alloc_error`. It was **stabilized in 1.28**, so if we do this at all we need to land it this cycle.
* Rename `set_oom_hook` to `set_alloc_error_hook`
* Rename `take_oom_hook` to `take_alloc_error_hook`

Bikeshed: `on` v.s. `for`, `alloc` v.s. `allocator`, `error` v.s. `failure`
2018-06-19 19:22:12 +00:00
Simon Sapin
d2fe6c4527 Update the error message for a missing global allocator
Don’t mention `#[default_lib_allocator]` (which is an implementation detail
irrelevant to most users) and instead suggest using `#[global_allocator]`,
which is often the correct fix.
2018-06-19 20:16:43 +02:00
Simon Sapin
a9a0f4cdd1 Add a UI test for the missing allocator error message 2018-06-19 20:06:28 +02:00
Felix S. Klock II
46846496ed Add unit test for case that didn't seem to be covered in existing UI tests
(since I made this mistake at first but the tests didn't catch it):
we should not suggest adding `mut` to a reassigned `ref` or `ref mut` binding.

(The Rust language, since at least 1.0, does not have `mut ref mut` or
`ref mut mut` etc.)
2018-06-19 19:41:54 +02:00
Felix S. Klock II
a32fca71ed Update the existing compile-fail tests to reflect diagnostic changes in NLL. 2018-06-19 19:41:54 +02:00
Felix S. Klock II
35971ccc41 Update the existing UI tests to reflect diagnostic changes in NLL. 2018-06-19 19:41:48 +02:00
Felix S. Klock II
0d9998cb97 Added diagnostics for suggesting mut x on repeated mutations of x.
(Follow-on commits updating the test suite show the resulting changes
to diagnostic output.)
2018-06-19 19:38:37 +02:00
Felix S. Klock II
620a8536f6 updates to compile-fail tests for changes to NLL. 2018-06-19 19:38:37 +02:00
Felix S. Klock II
2d4df5b53e NLL: Updates to diagnostic output in test/ui. 2018-06-19 19:38:37 +02:00
Felix S. Klock II
7fd4b52b1b NLL: Broad rewrite of check_access_perimssions.
Tried to unify various common code paths and also vaguely approximate
the AST-borrowck diagnostics.

The change in (subjective) quality of diagnostics is not a universal
improvement. But I think this is a better code base to work from
for future fixes.
2018-06-19 19:38:37 +02:00
Felix S. Klock II
6dfed7e813 small refactoring: replaced mutable state with return statements in control flow.
As a drive-by, removed some dead-code.
2018-06-19 19:38:37 +02:00
Felix S. Klock II
be645be660 Thread more argument info down from Hir into the mir::LocalDecls.
Namely, we thread down the `HirId` of the explicit type of the
argument.  In the case of the special `self` variable with an implicit
type, we also thread down a description of its structure (`self`/`mut
self`/`&self`/`&mut self`).
2018-06-19 19:38:37 +02:00
Felix S. Klock II
c5c4c5e938 Add fn fn_decl to Hir, for looking up the FnDecl of a body owner. 2018-06-19 19:38:37 +02:00