Skip to content
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

Rollup of 14 pull requests #65454

Merged
merged 41 commits into from
Oct 16, 2019
Merged
Changes from 2 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
48fff6f
don't assume we can *always* find a return type hint in async fn
nikomatsakis Oct 9, 2019
429fc9d
Test an assoc. type in struct member def inside fn
Xanewok Oct 12, 2019
7b3cd1b
Use empty typeck tables when nesting on items without those
Xanewok Oct 4, 2019
eefc169
Nest typeck tables when processing struct member types
Xanewok Oct 12, 2019
6a64e9c
Add long error explanation for E0574
GuillaumeGomez Oct 11, 2019
9f392c4
Update ui tests
GuillaumeGomez Oct 11, 2019
a975259
Add more tests for underscore imports
matthewjasper Sep 7, 2019
061b906
Return `false` from `needs_drop` for all zero-sized arrays
ecstatic-morse Oct 13, 2019
8fd16ba
Remove special case for zero-sized arrays from indirectly mut locals
ecstatic-morse Oct 13, 2019
c08a871
Add regression test for #65348
ecstatic-morse Oct 13, 2019
f81b154
Add troubleshooting section to PGO chapter in rustc book.
michaelwoerister Oct 14, 2019
307a356
Sort long error code explanation by error code
GuillaumeGomez Oct 10, 2019
c6de3eb
Uncomment E0386 to let users have access to its old definition
GuillaumeGomez Oct 10, 2019
6545819
Unification and cleanup of librustc_mir error codes
GuillaumeGomez Oct 10, 2019
d4e3e6b
Delete extra file
GuillaumeGomez Oct 14, 2019
fe09bb5
Add expanded type cache to OpaqueTypeExpander
tmandry Oct 10, 2019
802554f
Only expand types that contain projections
tmandry Oct 10, 2019
53187c5
Slides path lifetime to the lifetime resolver
Phosphorus15 Oct 11, 2019
1fb8cfb
Organize `never_type` tests
Centril Oct 15, 2019
dee53d7
Fix suggestion to constrain trait for method to be found
estebank Oct 9, 2019
d82c1c5
Avoid unused lifetime warning for lifetimes introduced when desugerin…
gilescope Oct 15, 2019
fa3a4ae
Implement AsRef<[T]> for List<T>
spastorino Oct 15, 2019
2918a7d
Add `BitIter::new()`.
nnethercote Oct 14, 2019
60851b0
Optimize `BitSet` iteration.
nnethercote Oct 14, 2019
1a2597b
Don't use `gensym_if_underscore` to resolve `_` bindings
matthewjasper Sep 9, 2019
94967f2
Remove gensyms
matthewjasper Aug 31, 2019
4198df1
Remove some mentions of gensyms
matthewjasper Aug 31, 2019
fcef4b1
Rollup merge of #64603 - gilescope:unused-lifetime-warning, r=matthew…
tmandry Oct 15, 2019
af3d9e5
Rollup merge of #64623 - matthewjasper:underscore-imports, r=petroche…
tmandry Oct 15, 2019
bbf4eb3
Rollup merge of #65235 - nikomatsakis:issue-65159-async-fn-return-ice…
tmandry Oct 15, 2019
ef9d6ee
Rollup merge of #65242 - estebank:contrain-trait-sugg, r=varkor
tmandry Oct 15, 2019
8f09085
Rollup merge of #65265 - GuillaumeGomez:cleanup-librustc_mir-err-code…
tmandry Oct 15, 2019
a6ae7ae
Rollup merge of #65293 - tmandry:turbo-expander, r=matthewjasper
tmandry Oct 15, 2019
ff9b99d
Rollup merge of #65307 - Phosphorus15:master, r=varkor
tmandry Oct 15, 2019
42b3596
Rollup merge of #65308 - GuillaumeGomez:long-err-explanation-E0574, r…
tmandry Oct 15, 2019
820fb7c
Rollup merge of #65353 - Xanewok:sa-empty-tables, r=nikomatsakis
tmandry Oct 15, 2019
bbcf66a
Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=e…
tmandry Oct 15, 2019
2dac8b9
Rollup merge of #65402 - michaelwoerister:pgo-troubleshooting-docs, r…
tmandry Oct 15, 2019
6416079
Rollup merge of #65425 - nnethercote:optimize-BitIter, r=zackmdavis
tmandry Oct 15, 2019
ef54203
Rollup merge of #65438 - Centril:almost, r=varkor
tmandry Oct 15, 2019
3182f73
Rollup merge of #65444 - spastorino:as-ref-for-list, r=Mark-Simulacrum
tmandry Oct 15, 2019
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
8 changes: 7 additions & 1 deletion src/librustc/middle/resolve_lifetime.rs
Original file line number Diff line number Diff line change
@@ -708,15 +708,22 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
match param.kind {
GenericParamKind::Lifetime { .. } => {
let (name, reg) = Region::early(&self.tcx.hir(), &mut index, &param);
let def_id = if let Region::EarlyBound(_ ,def_id , _) = reg {
def_id
} else {
bug!();
};
if let hir::ParamName::Plain(param_name) = name {
if param_name.name == kw::UnderscoreLifetime {
// Pick the elided lifetime "definition" if one exists
// and use it to make an elision scope.
self.lifetime_uses.insert(def_id.clone(), LifetimeUseSet::Many);
elision = Some(reg);
} else {
lifetimes.insert(name, reg);
}
} else {
self.lifetime_uses.insert(def_id.clone(), LifetimeUseSet::Many);
lifetimes.insert(name, reg);
}
}
@@ -1615,7 +1622,6 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
_ => None,
} {
debug!("id = {:?} span = {:?} name = {:?}", id, span, name);

if name.name == kw::UnderscoreLifetime {
continue;
}
42 changes: 42 additions & 0 deletions src/test/ui/async-await/unused-lifetime.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// edition:2018

// Avoid spurious warnings of unused lifetime. The below async functions
// are desugered to have an unused lifetime
// but we don't want to warn about that as there's nothing they can do about it.

#![deny(unused_lifetimes)]
#![allow(dead_code)]

pub async fn october(s: &str) {
println!("{}", s);
}

pub async fn async_fn(&mut ref s: &mut[i32]) {
println!("{:?}", s);
}

macro_rules! foo_macro {
() => {
pub async fn async_fn_in_macro(&mut ref _s: &mut[i32]) {}
};
}

foo_macro!();

pub async fn func_with_unused_lifetime<'a>(s: &'a str) {
//~^ ERROR lifetime parameter `'a` never used
println!("{}", s);
}

pub async fn func_with_two_unused_lifetime<'a, 'b>(s: &'a str, t: &'b str) {
//~^ ERROR lifetime parameter `'a` never used
//~^^ ERROR lifetime parameter `'b` never used
println!("{}", s);
}

pub async fn func_with_unused_lifetime_in_two_params<'c>(s: &'c str, t: &'c str) {
//~^ ERROR lifetime parameter `'c` never used
println!("{}", s);
}

fn main() {}
32 changes: 32 additions & 0 deletions src/test/ui/async-await/unused-lifetime.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
error: lifetime parameter `'a` never used
--> $DIR/unused-lifetime.rs:26:40
|
LL | pub async fn func_with_unused_lifetime<'a>(s: &'a str) {
| ^^
|
note: lint level defined here
--> $DIR/unused-lifetime.rs:7:9
|
LL | #![deny(unused_lifetimes)]
| ^^^^^^^^^^^^^^^^

error: lifetime parameter `'a` never used
--> $DIR/unused-lifetime.rs:31:44
|
LL | pub async fn func_with_two_unused_lifetime<'a, 'b>(s: &'a str, t: &'b str) {
| ^^

error: lifetime parameter `'b` never used
--> $DIR/unused-lifetime.rs:31:48
|
LL | pub async fn func_with_two_unused_lifetime<'a, 'b>(s: &'a str, t: &'b str) {
| ^^

error: lifetime parameter `'c` never used
--> $DIR/unused-lifetime.rs:37:54
|
LL | pub async fn func_with_unused_lifetime_in_two_params<'c>(s: &'c str, t: &'c str) {
| ^^

error: aborting due to 4 previous errors