Auto merge of #85984 - JohnTitor:rollup-rq0g9ph, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #85717 (Document `From` impls for cow.rs) - #85850 (Remove unused feature gates) - #85888 (Fix typo in internal documentation for `TrustedRandomAccess`) - #85889 (Restoring the `num_def_ids` function in the CStore API ) - #85899 (jsondocck small cleanup) - #85937 (Fix bad suggestions for code from proc_macro) - #85963 (Show `::{{constructor}}` in std::any::type_name().) - #85977 (Fix linkcheck script from getting out of sync.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4afa3a8092
38 changed files with 161 additions and 120 deletions
18
src/test/ui/suggestions/auxiliary/proc-macro-type-error.rs
Normal file
18
src/test/ui/suggestions/auxiliary/proc-macro-type-error.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// force-host
|
||||
// no-prefer-dynamic
|
||||
#![crate_type = "proc-macro"]
|
||||
#![feature(proc_macro_quote)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::{quote, TokenStream};
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn hello(_: TokenStream, _: TokenStream) -> TokenStream {
|
||||
quote!(
|
||||
fn f(_: &mut i32) {}
|
||||
fn g() {
|
||||
f(123);
|
||||
}
|
||||
)
|
||||
}
|
||||
29
src/test/ui/suggestions/suggest-ref-macro.rs
Normal file
29
src/test/ui/suggestions/suggest-ref-macro.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// run-check
|
||||
// aux-build:proc-macro-type-error.rs
|
||||
|
||||
extern crate proc_macro_type_error;
|
||||
|
||||
use proc_macro_type_error::hello;
|
||||
|
||||
#[hello] //~ERROR mismatched types
|
||||
fn abc() {}
|
||||
|
||||
fn x(_: &mut i32) {}
|
||||
|
||||
macro_rules! bla {
|
||||
() => {
|
||||
x(123);
|
||||
//~^ ERROR mismatched types
|
||||
//~| SUGGESTION &mut 123
|
||||
};
|
||||
($v:expr) => {
|
||||
x($v)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
bla!();
|
||||
bla!(456);
|
||||
//~^ ERROR mismatched types
|
||||
//~| SUGGESTION &mut 456
|
||||
}
|
||||
34
src/test/ui/suggestions/suggest-ref-macro.stderr
Normal file
34
src/test/ui/suggestions/suggest-ref-macro.stderr
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/suggest-ref-macro.rs:8:1
|
||||
|
|
||||
LL | #[hello]
|
||||
| ^^^^^^^^ expected `&mut i32`, found integer
|
||||
|
|
||||
= note: this error originates in the attribute macro `hello` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/suggest-ref-macro.rs:15:11
|
||||
|
|
||||
LL | x(123);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&mut i32`, found integer
|
||||
| help: consider mutably borrowing here: `&mut 123`
|
||||
...
|
||||
LL | bla!();
|
||||
| ------- in this macro invocation
|
||||
|
|
||||
= note: this error originates in the macro `bla` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/suggest-ref-macro.rs:26:10
|
||||
|
|
||||
LL | bla!(456);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `&mut i32`, found integer
|
||||
| help: consider mutably borrowing here: `&mut 456`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -8,8 +8,7 @@ edition = "2018"
|
|||
jsonpath_lib = "0.2"
|
||||
getopts = "0.2"
|
||||
regex = "1.4"
|
||||
lazy_static = "1.4"
|
||||
shlex = "0.1"
|
||||
serde = "1.0"
|
||||
shlex = "1.0"
|
||||
serde_json = "1.0"
|
||||
fs-err = "2.5.0"
|
||||
once_cell = "1.0"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use jsonpath_lib::select;
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::{Regex, RegexBuilder};
|
||||
use serde_json::Value;
|
||||
use std::borrow::Cow;
|
||||
|
|
@ -94,19 +94,19 @@ impl fmt::Display for CommandKind {
|
|||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref LINE_PATTERN: Regex = RegexBuilder::new(
|
||||
static LINE_PATTERN: Lazy<Regex> = Lazy::new(|| {
|
||||
RegexBuilder::new(
|
||||
r#"
|
||||
\s(?P<invalid>!?)@(?P<negated>!?)
|
||||
(?P<cmd>[A-Za-z]+(?:-[A-Za-z]+)*)
|
||||
(?P<args>.*)$
|
||||
"#
|
||||
"#,
|
||||
)
|
||||
.ignore_whitespace(true)
|
||||
.unicode(true)
|
||||
.build()
|
||||
.unwrap();
|
||||
}
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
fn print_err(msg: &str, lineno: usize) {
|
||||
eprintln!("Invalid command: {} on line {}", msg, lineno)
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ fi
|
|||
if [ ! -e "linkchecker/main.rs" ] || [ "$iterative" = "0" ]
|
||||
then
|
||||
echo "Downloading linkchecker source..."
|
||||
nightly_hash=$(rustc +nightly -Vv | grep commit-hash | cut -f2 -d" ")
|
||||
url="https://raw.githubusercontent.com/rust-lang/rust"
|
||||
mkdir linkchecker
|
||||
curl -o linkchecker/Cargo.toml \
|
||||
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/Cargo.toml
|
||||
curl -o linkchecker/main.rs \
|
||||
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/main.rs
|
||||
curl -o linkchecker/Cargo.toml ${url}/${nightly_hash}/src/tools/linkchecker/Cargo.toml
|
||||
curl -o linkchecker/main.rs ${url}/${nightly_hash}/src/tools/linkchecker/main.rs
|
||||
fi
|
||||
|
||||
echo "Building book \"$book_name\"..."
|
||||
|
|
@ -106,7 +106,7 @@ else
|
|||
check_path="linkcheck/$book_name"
|
||||
fi
|
||||
echo "Running linkchecker on \"$check_path\"..."
|
||||
cargo run --manifest-path=linkchecker/Cargo.toml -- "$check_path"
|
||||
cargo run --release --manifest-path=linkchecker/Cargo.toml -- "$check_path"
|
||||
|
||||
if [ "$iterative" = "0" ]
|
||||
then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue