Skip to content

Commit 98f0a91

Browse files
committed
Auto merge of #32454 - eddyb:rollup, r=eddyb
Rollup of 11 pull requests - Successful merges: #32404, #32420, #32423, #32425, #32429, #32430, #32431, #32434, #32437, #32441, #32443 - Failed merges:
2 parents b76f818 + 2e9b40f commit 98f0a91

File tree

19 files changed

+173
-32
lines changed

19 files changed

+173
-32
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ then
10341034
if [ -n "$CFG_OSX_CLANG_VERSION" ]
10351035
then
10361036
case $CFG_OSX_CLANG_VERSION in
1037-
(7.0* | 7.1* | 7.2*)
1037+
(7.0* | 7.1* | 7.2* | 7.3*)
10381038
step_msg "found ok version of APPLE CLANG: $CFG_OSX_CLANG_VERSION"
10391039
;;
10401040
(*)

src/doc/book/lifetimes.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,12 @@ to it.
282282

283283
## Lifetime Elision
284284

285-
Rust supports powerful local type inference in function bodies, but it’s
286-
forbidden in item signatures to allow reasoning about the types based on
287-
the item signature alone. However, for ergonomic reasons a very restricted
288-
secondary inference algorithm called “lifetime elision” applies in function
289-
signatures. It infers only based on the signature components themselves and not
290-
based on the body of the function, only infers lifetime parameters, and does
291-
this with only three easily memorizable and unambiguous rules. This makes
292-
lifetime elision a shorthand for writing an item signature, while not hiding
285+
Rust supports powerful local type inference in the bodies of functions but not in their item signatures.
286+
It's forbidden to allow reasoning about types based on the item signature alone.
287+
However, for ergonomic reasons, a very restricted secondary inference algorithm called
288+
“lifetime elision” does apply when judging lifetimes. Lifetime elision is concerned solely to infer
289+
lifetime parameters using three easily memorizable and unambiguous rules. This means lifetime elision
290+
acts as a shorthand for writing an item signature, while not hiding
293291
away the actual types involved as full local inference would if applied to it.
294292

295293
When talking about lifetime elision, we use the term *input lifetime* and

src/doc/book/patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Patterns
22

33
Patterns are quite common in Rust. We use them in [variable
4-
bindings][bindings], [match statements][match], and other places, too. Let’s go
4+
bindings][bindings], [match expressions][match], and other places, too. Let’s go
55
on a whirlwind tour of all of the things patterns can do!
66

77
[bindings]: variable-bindings.html

src/librustc_trans/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
381381
llconst = addr_of(cx, llconst, type_of::align_of(cx, ty), "autoref");
382382
ty = cx.tcx().mk_imm_ref(cx.tcx().mk_region(ty::ReStatic), ty);
383383
}
384-
} else {
384+
} else if adj.autoderefs > 0 {
385385
let (dv, dt) = const_deref(cx, llconst, ty);
386386
llconst = dv;
387387

src/librustdoc/clean/inline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ pub fn build_impls(cx: &DocContext,
256256
cstore::DlImpl(did) => build_impl(cx, tcx, did, impls),
257257
cstore::DlDef(Def::Mod(did)) => {
258258
// Don't recurse if this is a #[doc(hidden)] module
259-
if load_attrs(cx, tcx, did).list_def("doc").has_word("hidden") {
259+
if load_attrs(cx, tcx, did).list("doc").has_word("hidden") {
260260
return;
261261
}
262262

@@ -299,7 +299,7 @@ pub fn build_impl(cx: &DocContext,
299299
if let Some(ref t) = associated_trait {
300300
// If this is an impl for a #[doc(hidden)] trait, be sure to not inline
301301
let trait_attrs = load_attrs(cx, tcx, t.def_id);
302-
if trait_attrs.list_def("doc").has_word("hidden") {
302+
if trait_attrs.list("doc").has_word("hidden") {
303303
return
304304
}
305305
}

src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl Clean<Item> for doctree::Module {
418418
pub trait Attributes {
419419
fn has_word(&self, &str) -> bool;
420420
fn value<'a>(&'a self, &str) -> Option<&'a str>;
421-
fn list_def<'a>(&'a self, &str) -> &'a [Attribute];
421+
fn list<'a>(&'a self, &str) -> &'a [Attribute];
422422
}
423423

424424
impl Attributes for [Attribute] {
@@ -447,7 +447,7 @@ impl Attributes for [Attribute] {
447447
}
448448

449449
/// Finds an attribute as List and returns the list of attributes nested inside.
450-
fn list_def<'a>(&'a self, name: &str) -> &'a [Attribute] {
450+
fn list<'a>(&'a self, name: &str) -> &'a [Attribute] {
451451
for attr in self {
452452
if let List(ref x, ref list) = *attr {
453453
if name == *x {
@@ -1535,7 +1535,7 @@ impl PrimitiveType {
15351535
}
15361536

15371537
fn find(attrs: &[Attribute]) -> Option<PrimitiveType> {
1538-
for attr in attrs.list_def("doc") {
1538+
for attr in attrs.list("doc") {
15391539
if let NameValue(ref k, ref v) = *attr {
15401540
if "primitive" == *k {
15411541
if let ret@Some(..) = PrimitiveType::from_str(v) {
@@ -1885,7 +1885,7 @@ impl<'tcx> Clean<Item> for ty::VariantDefData<'tcx, 'static> {
18851885
source: Span::empty(),
18861886
name: Some(field.name.clean(cx)),
18871887
attrs: Vec::new(),
1888-
visibility: Some(hir::Public),
1888+
visibility: Some(field.vis),
18891889
// FIXME: this is not accurate, we need an id for
18901890
// the specific field but we're using the id
18911891
// for the whole variant. Thus we read the

src/librustdoc/html/render.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ pub fn run(mut krate: clean::Crate,
432432

433433
// Crawl the crate attributes looking for attributes which control how we're
434434
// going to emit HTML
435-
if let Some(attrs) = krate.module.as_ref().map(|m| m.attrs.list_def("doc")) {
435+
if let Some(attrs) = krate.module.as_ref().map(|m| m.attrs.list("doc")) {
436436
for attr in attrs {
437437
match *attr {
438438
clean::NameValue(ref x, ref s)
@@ -832,7 +832,7 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation {
832832

833833
// Failing that, see if there's an attribute specifying where to find this
834834
// external crate
835-
e.attrs.list_def("doc").value("html_root_url").map(|url| {
835+
e.attrs.list("doc").value("html_root_url").map(|url| {
836836
let mut url = url.to_owned();
837837
if !url.ends_with("/") {
838838
url.push('/')
@@ -1845,6 +1845,7 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
18451845

18461846
fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
18471847
f: &clean::Function) -> fmt::Result {
1848+
// FIXME(#24111): remove when `const_fn` is stabilized
18481849
let vis_constness = match get_unstable_features_setting() {
18491850
UnstableFeatures::Allow => f.constness,
18501851
_ => hir::Constness::NotConst

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
384384

385385
// Process all of the crate attributes, extracting plugin metadata along
386386
// with the passes which we are supposed to run.
387-
for attr in krate.module.as_ref().unwrap().attrs.list_def("doc") {
387+
for attr in krate.module.as_ref().unwrap().attrs.list("doc") {
388388
match *attr {
389389
clean::Word(ref w) if "no_default_passes" == *w => {
390390
default_passes = false;

src/librustdoc/passes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn strip_hidden(krate: clean::Crate) -> plugins::PluginResult {
3333
}
3434
impl<'a> fold::DocFolder for Stripper<'a> {
3535
fn fold_item(&mut self, i: Item) -> Option<Item> {
36-
if i.attrs.list_def("doc").has_word("hidden") {
36+
if i.attrs.list("doc").has_word("hidden") {
3737
debug!("found one in strip_hidden; removing");
3838
self.stripped.insert(i.def_id);
3939

src/librustdoc/visit_ast.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
229229
while let Some(id) = cx.map.get_enclosing_scope(node) {
230230
node = id;
231231
let attrs = cx.map.attrs(node).clean(cx);
232-
if attrs.list_def("doc").has_word("hidden") {
232+
if attrs.list("doc").has_word("hidden") {
233233
return true;
234234
}
235235
if node == ast::CRATE_NODE_ID {
@@ -251,11 +251,14 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
251251
Some(analysis) => analysis, None => return false
252252
};
253253

254+
let use_attrs = tcx.map.attrs(id).clean(self.cx);
255+
254256
let is_private = !analysis.access_levels.is_public(def);
255257
let is_hidden = inherits_doc_hidden(self.cx, def_node_id);
258+
let is_no_inline = use_attrs.list("doc").has_word("no_inline");
256259

257260
// Only inline if requested or if the item would otherwise be stripped
258-
if !please_inline && !is_private && !is_hidden {
261+
if (!please_inline && !is_private && !is_hidden) || is_no_inline {
259262
return false
260263
}
261264

0 commit comments

Comments
 (0)