about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/config.rs16
-rw-r--r--src/bootstrap/flags.rs9
-rw-r--r--src/bootstrap/native.rs3
-rw-r--r--src/librustdoc/clean/inline.rs6
-rw-r--r--src/librustdoc/clean/mod.rs62
-rw-r--r--src/librustdoc/passes/html_tags.rs10
-rw-r--r--src/test/rustdoc-ui/invalid-html-tags.rs6
-rw-r--r--src/test/rustdoc-ui/invalid-html-tags.stderr14
-rw-r--r--src/test/ui/associated-consts/assoc-const-ty-mismatch.rs4
-rw-r--r--src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr8
-rw-r--r--src/test/ui/associated-type-bounds/issue-99828.rs11
-rw-r--r--src/test/ui/associated-type-bounds/issue-99828.stderr24
12 files changed, 112 insertions, 61 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index c7212ad2c21..4325a237c69 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -1312,6 +1312,13 @@ impl Config {
         git
     }
 
+    pub(crate) fn artifact_channel(&self, commit: &str) -> String {
+        let mut channel = self.git();
+        channel.arg("show").arg(format!("{}:src/ci/channel", commit));
+        let channel = output(&mut channel);
+        channel.trim().to_owned()
+    }
+
     /// Try to find the relative path of `bindir`, otherwise return it in full.
     pub fn bindir_relative(&self) -> &Path {
         let bindir = &self.bindir;
@@ -1547,8 +1554,7 @@ fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> {
 
 fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
     builder.verbose(&format!("using downloaded stage2 artifacts from CI (commit {commit})"));
-    // FIXME: support downloading artifacts from the beta channel
-    const CHANNEL: &str = "nightly";
+    let channel = builder.config.artifact_channel(commit);
     let host = builder.config.build.triple;
     let bin_root = builder.out.join(host).join("ci-rustc");
     let rustc_stamp = bin_root.join(".rustc-stamp");
@@ -1557,13 +1563,13 @@ fn download_ci_rustc(builder: &Builder<'_>, commit: &str) {
         if bin_root.exists() {
             t!(fs::remove_dir_all(&bin_root));
         }
-        let filename = format!("rust-std-{CHANNEL}-{host}.tar.xz");
+        let filename = format!("rust-std-{channel}-{host}.tar.xz");
         let pattern = format!("rust-std-{host}");
         download_ci_component(builder, filename, &pattern, commit);
-        let filename = format!("rustc-{CHANNEL}-{host}.tar.xz");
+        let filename = format!("rustc-{channel}-{host}.tar.xz");
         download_ci_component(builder, filename, "rustc", commit);
         // download-rustc doesn't need its own cargo, it can just use beta's.
-        let filename = format!("rustc-dev-{CHANNEL}-{host}.tar.xz");
+        let filename = format!("rustc-dev-{channel}-{host}.tar.xz");
         download_ci_component(builder, filename, "rustc-dev", commit);
 
         builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustc"));
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 1822c2936b7..80b3bcce860 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -623,15 +623,6 @@ Arguments:
             }
         };
 
-        if let Subcommand::Check { .. } = &cmd {
-            if matches.opt_str("keep-stage").is_some()
-                || matches.opt_str("keep-stage-std").is_some()
-            {
-                eprintln!("--keep-stage not yet supported for x.py check");
-                crate::detail_exit(1);
-            }
-        }
-
         Flags {
             verbose: matches.opt_count("verbose"),
             stage: matches.opt_str("stage").map(|j| j.parse().expect("`stage` should be a number")),
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 01e70b3fb2d..3347246ea8f 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -189,7 +189,8 @@ fn download_ci_llvm(builder: &Builder<'_>, llvm_sha: &str) {
     } else {
         &builder.config.stage0_metadata.config.artifacts_server
     };
-    let filename = format!("rust-dev-nightly-{}.tar.xz", builder.build.build.triple);
+    let channel = builder.config.artifact_channel(llvm_sha);
+    let filename = format!("rust-dev-{}-{}.tar.xz", channel, builder.build.build.triple);
     let tarball = rustc_cache.join(&filename);
     if !tarball.exists() {
         let help_on_error = "error: failed to download llvm from ci
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index 55d77a63f61..838283e32da 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -17,8 +17,8 @@ use rustc_span::symbol::{kw, sym, Symbol};
 
 use crate::clean::{
     self, clean_fn_decl_from_did_and_sig, clean_middle_field, clean_middle_ty, clean_ty,
-    clean_ty_generics, clean_visibility, utils, Attributes, AttributesExt, Clean, ImplKind, ItemId,
-    Type, Visibility,
+    clean_ty_generics, clean_variant_def, clean_visibility, utils, Attributes, AttributesExt,
+    Clean, ImplKind, ItemId, Type, Visibility,
 };
 use crate::core::DocContext;
 use crate::formats::item_type::ItemType;
@@ -236,7 +236,7 @@ fn build_enum(cx: &mut DocContext<'_>, did: DefId) -> clean::Enum {
 
     clean::Enum {
         generics: clean_ty_generics(cx, cx.tcx.generics_of(did), predicates),
-        variants: cx.tcx.adt_def(did).variants().iter().map(|v| v.clean(cx)).collect(),
+        variants: cx.tcx.adt_def(did).variants().iter().map(|v| clean_variant_def(v, cx)).collect(),
     }
 }
 
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index 10676aca480..4067cf8441b 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -1824,44 +1824,36 @@ pub(crate) fn clean_visibility(vis: ty::Visibility) -> Visibility {
     }
 }
 
+pub(crate) fn clean_variant_def<'tcx>(variant: &ty::VariantDef, cx: &mut DocContext<'tcx>) -> Item {
+    let kind = match variant.ctor_kind {
+        CtorKind::Const => Variant::CLike,
+        CtorKind::Fn => Variant::Tuple(
+            variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
+        ),
+        CtorKind::Fictive => Variant::Struct(VariantStruct {
+            struct_type: CtorKind::Fictive,
+            fields: variant.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
+        }),
+    };
+    let what_rustc_thinks =
+        Item::from_def_id_and_parts(variant.def_id, Some(variant.name), VariantItem(kind), cx);
+    // don't show `pub` for variants, which always inherit visibility
+    Item { visibility: Inherited, ..what_rustc_thinks }
+}
+
 fn clean_variant_data<'tcx>(
     variant: &hir::VariantData<'tcx>,
     cx: &mut DocContext<'tcx>,
-) -> VariantStruct {
-    VariantStruct {
-        struct_type: CtorKind::from_hir(variant),
-        fields: variant.fields().iter().map(|x| clean_field(x, cx)).collect(),
-    }
-}
-
-impl<'tcx> Clean<'tcx, Item> for ty::VariantDef {
-    fn clean(&self, cx: &mut DocContext<'tcx>) -> Item {
-        let kind = match self.ctor_kind {
-            CtorKind::Const => Variant::CLike,
-            CtorKind::Fn => Variant::Tuple(
-                self.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
-            ),
-            CtorKind::Fictive => Variant::Struct(VariantStruct {
-                struct_type: CtorKind::Fictive,
-                fields: self.fields.iter().map(|field| clean_middle_field(field, cx)).collect(),
-            }),
-        };
-        let what_rustc_thinks =
-            Item::from_def_id_and_parts(self.def_id, Some(self.name), VariantItem(kind), cx);
-        // don't show `pub` for variants, which always inherit visibility
-        Item { visibility: Inherited, ..what_rustc_thinks }
-    }
-}
-
-impl<'tcx> Clean<'tcx, Variant> for hir::VariantData<'tcx> {
-    fn clean(&self, cx: &mut DocContext<'tcx>) -> Variant {
-        match self {
-            hir::VariantData::Struct(..) => Variant::Struct(clean_variant_data(self, cx)),
-            hir::VariantData::Tuple(..) => {
-                Variant::Tuple(self.fields().iter().map(|x| clean_field(x, cx)).collect())
-            }
-            hir::VariantData::Unit(..) => Variant::CLike,
+) -> Variant {
+    match variant {
+        hir::VariantData::Struct(..) => Variant::Struct(VariantStruct {
+            struct_type: CtorKind::from_hir(variant),
+            fields: variant.fields().iter().map(|x| clean_field(x, cx)).collect(),
+        }),
+        hir::VariantData::Tuple(..) => {
+            Variant::Tuple(variant.fields().iter().map(|x| clean_field(x, cx)).collect())
         }
+        hir::VariantData::Unit(..) => Variant::CLike,
     }
 }
 
@@ -2009,7 +2001,7 @@ fn clean_maybe_renamed_item<'tcx>(
 
 impl<'tcx> Clean<'tcx, Item> for hir::Variant<'tcx> {
     fn clean(&self, cx: &mut DocContext<'tcx>) -> Item {
-        let kind = VariantItem(self.data.clean(cx));
+        let kind = VariantItem(clean_variant_data(&self.data, cx));
         let what_rustc_thinks =
             Item::from_hir_id_and_parts(self.id, Some(self.ident.name), kind, cx);
         // don't show `pub` for variants, which are always public
diff --git a/src/librustdoc/passes/html_tags.rs b/src/librustdoc/passes/html_tags.rs
index d8ad299c3d3..f3a3c853cac 100644
--- a/src/librustdoc/passes/html_tags.rs
+++ b/src/librustdoc/passes/html_tags.rs
@@ -94,6 +94,14 @@ fn extract_path_backwards(text: &str, end_pos: usize) -> Option<usize> {
     if current_pos == end_pos { None } else { Some(current_pos) }
 }
 
+fn is_valid_for_html_tag_name(c: char, is_empty: bool) -> bool {
+    // https://spec.commonmark.org/0.30/#raw-html
+    //
+    // > A tag name consists of an ASCII letter followed by zero or more ASCII letters, digits, or
+    // > hyphens (-).
+    c.is_ascii_alphabetic() || !is_empty && (c == '-' || c.is_ascii_digit())
+}
+
 fn extract_html_tag(
     tags: &mut Vec<(String, Range<usize>)>,
     text: &str,
@@ -117,7 +125,7 @@ fn extract_html_tag(
         // Checking if this is a closing tag (like `</a>` for `<a>`).
         if c == '/' && tag_name.is_empty() {
             is_closing = true;
-        } else if c.is_ascii_alphanumeric() {
+        } else if is_valid_for_html_tag_name(c, tag_name.is_empty()) {
             tag_name.push(c);
         } else {
             if !tag_name.is_empty() {
diff --git a/src/test/rustdoc-ui/invalid-html-tags.rs b/src/test/rustdoc-ui/invalid-html-tags.rs
index cec44b6d2ca..0f9d2e4b35d 100644
--- a/src/test/rustdoc-ui/invalid-html-tags.rs
+++ b/src/test/rustdoc-ui/invalid-html-tags.rs
@@ -108,3 +108,9 @@ pub fn j() {}
 /// <Vec<_> shouldn't warn!
 /// ``````
 pub fn k() {}
+
+/// Web Components style <dashed-tags>
+//~^ ERROR unclosed HTML tag `dashed-tags`
+/// Web Components style </unopened-tag>
+//~^ ERROR unopened HTML tag `unopened-tag`
+pub fn m() {}
diff --git a/src/test/rustdoc-ui/invalid-html-tags.stderr b/src/test/rustdoc-ui/invalid-html-tags.stderr
index 335e100c89d..24a455576e8 100644
--- a/src/test/rustdoc-ui/invalid-html-tags.stderr
+++ b/src/test/rustdoc-ui/invalid-html-tags.stderr
@@ -82,5 +82,17 @@ error: Unclosed HTML comment
 LL | /// <!--
    |     ^^^
 
-error: aborting due to 13 previous errors
+error: unopened HTML tag `unopened-tag`
+  --> $DIR/invalid-html-tags.rs:114:26
+   |
+LL | /// Web Components style </unopened-tag>
+   |                          ^^^^^^^^^^^^^^^
+
+error: unclosed HTML tag `dashed-tags`
+  --> $DIR/invalid-html-tags.rs:112:26
+   |
+LL | /// Web Components style <dashed-tags>
+   |                          ^^^^^^^^^^^^^
+
+error: aborting due to 15 previous errors
 
diff --git a/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs b/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs
index c3293156345..c5d78469e95 100644
--- a/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs
+++ b/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs
@@ -21,9 +21,9 @@ impl FooTy for Bar {
 
 
 fn foo<F: Foo<N=usize>>() {}
-//~^ ERROR mismatch in
+//~^ ERROR expected associated constant bound, found type
 fn foo2<F: FooTy<T=3usize>>() {}
-//~^ ERROR mismatch in
+//~^ ERROR expected associated type bound, found constant
 
 fn main() {
   foo::<Bar>();
diff --git a/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr b/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr
index 58a8aceca2f..11198729e38 100644
--- a/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr
+++ b/src/test/ui/associated-consts/assoc-const-ty-mismatch.stderr
@@ -1,22 +1,22 @@
-error: mismatch in bind of associated constant, got type
+error: expected associated constant bound, found type
   --> $DIR/assoc-const-ty-mismatch.rs:23:15
    |
 LL | fn foo<F: Foo<N=usize>>() {}
    |               ^^^^^^^
    |
-note: associated constant defined here does not match type
+note: associated constant defined here
   --> $DIR/assoc-const-ty-mismatch.rs:5:3
    |
 LL |   const N: usize;
    |   ^^^^^^^^^^^^^^
 
-error: mismatch in bind of associated type, got const
+error: expected associated type bound, found constant
   --> $DIR/assoc-const-ty-mismatch.rs:25:18
    |
 LL | fn foo2<F: FooTy<T=3usize>>() {}
    |                  ^^^^^^^^
    |
-note: associated type defined here does not match const
+note: associated type defined here
   --> $DIR/assoc-const-ty-mismatch.rs:9:3
    |
 LL |   type T;
diff --git a/src/test/ui/associated-type-bounds/issue-99828.rs b/src/test/ui/associated-type-bounds/issue-99828.rs
new file mode 100644
index 00000000000..7b711283f5b
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/issue-99828.rs
@@ -0,0 +1,11 @@
+fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
+    //~^ ERROR expected associated type bound, found constant
+    //~| ERROR associated const equality is incomplete
+    vec.iter()
+}
+
+fn main() {
+    let vec = Vec::new();
+    let mut iter = get_iter(&vec);
+    iter.next();
+}
diff --git a/src/test/ui/associated-type-bounds/issue-99828.stderr b/src/test/ui/associated-type-bounds/issue-99828.stderr
new file mode 100644
index 00000000000..1c20ead0556
--- /dev/null
+++ b/src/test/ui/associated-type-bounds/issue-99828.stderr
@@ -0,0 +1,24 @@
+error[E0658]: associated const equality is incomplete
+  --> $DIR/issue-99828.rs:1:43
+   |
+LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
+   |                                           ^^^^^^^^^
+   |
+   = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
+   = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
+
+error: expected associated type bound, found constant
+  --> $DIR/issue-99828.rs:1:43
+   |
+LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
+   |                                           ^^^^^^^^^
+   |
+note: associated type defined here
+  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
+   |
+LL |     type Item;
+   |     ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.